-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
more changes to SAMTagUtil #1227
Conversation
* reverting the change from constants to static variables, deprecating the constants instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Back to @lbergelson with minor comments.
/** @deprecated reserved tag for backwards compatibility only */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stray whitespace separating this comment from the thing it's commenting on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gone
@@ -27,10 +27,12 @@ | |||
|
|||
/** | |||
* Facility for converting between String and short representation of a SAM tag. short representation | |||
* is used by SAM JDK internally and is much more efficient. Callers are encouraged to obtain the short | |||
* is used by Htsjdk internally and is much more efficient. Callers are encouraged to obtain the short |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Htsjdk -> HTSJDK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* value for a tag of interest once, and then use the SAMRecord attribute API that takes shorts rather than | ||
* Strings. | ||
* | ||
* Tags that are defined by the SAM spec are included in the enum {@link SAMTag} along with their precomputed short tag. | ||
* | ||
* @author alecw@broadinstitute.org | ||
*/ | ||
public final class SAMTagUtil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should perhaps consider deprecating this entire class, and moving the 2 non-deprecated methods to a different location (like the SAMTag
enum)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Codecov Report
@@ Coverage Diff @@
## master #1227 +/- ##
===============================================
- Coverage 69.031% 68.832% -0.198%
+ Complexity 8077 8074 -3
===============================================
Files 539 539
Lines 32616 32617 +1
Branches 5510 5510
===============================================
- Hits 22515 22451 -64
- Misses 7894 7959 +65
Partials 2207 2207
|
@cmnbroad Could you take a look at this? I just deprecated the SamTagUtil entirely and moved all the functionality to SAMTag so that we wouldn't have this weird split between them. |
@@ -140,8 +179,10 @@ public static SAMTagUtil getSingleton() { | |||
* | |||
* @param tag 2-character String representation of a tag name. | |||
* @return Tag name packed as 2 ASCII bytes in a short. | |||
* @deprecated u |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to finish the message....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woops, good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One unfinished deprecation message that should be completed otherwise LGTM once tests pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just the usual collection of minor comments.
private final short shortValue = SAMTag.makeBinaryTag(this.name());; | ||
// Cache of already-converted tags. Should speed up SAM text generation. | ||
// Not synchronized because race condition is not a problem. | ||
private static final String[] stringTags = new String[Short.MAX_VALUE]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static fields should be uppercase
private static final String[] stringTags = new String[Short.MAX_VALUE]; | |
private static final String[] STRING_TAGS = new String[Short.MAX_VALUE]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't really a constant though. My thought is that things that are constant are final, but this is a static cache that's updated with new values. It seems more confusing to make it caps since people assume those are immutable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I usually use all caps for any statics, since it's important to know what things are static, but I can see that all caps is typically used for constants only.
} | ||
return ret; | ||
@Deprecated | ||
public String makeStringTag(final short tag) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be static
public String makeStringTag(final short tag) { | |
public static String makeStringTag(final short tag) { |
Unless it needs to be non-static for backward compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping it non-static for backwards compatibility. I was changing them to be static but I realized that would cause confusing breaks in binary compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pr is basically me fixing some breaks in compatibility that I had though would be harmless but on further inspection seemd problematic.
*/ | ||
public static short makeBinaryTag(final String tag) { | ||
@Deprecated | ||
public short makeBinaryTag(final String tag) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be static
public short makeBinaryTag(final String tag) { | |
public static short makeBinaryTag(final String tag) { |
Co-Authored-By: lbergelson <louisb@broadinstitute.org>
@pshapiro4broad @cmnbroad Thank you for the reviews! |
the constants instead
Checklist