-
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
remove caching of alleles in AbstractVCFCodec #1282
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ | |
public abstract class AbstractVCFCodec extends AsciiFeatureCodec<VariantContext> implements NameAwareCodec { | ||
public final static int MAX_ALLELE_SIZE_BEFORE_WARNING = (int)Math.pow(2, 20); | ||
|
||
protected final static int NUM_STANDARD_FIELDS = 8; // INFO is the 8th column | ||
protected final static int NUM_STANDARD_FIELDS = 8; // INFO is the 8th | ||
|
||
// we have to store the list of strings that make up the header until they're needed | ||
protected VCFHeader header = null; | ||
|
@@ -332,12 +332,14 @@ else if ( parts[2].equals(VCFConstants.EMPTY_ID_FIELD) ) | |
else | ||
builder.id(parts[2]); | ||
|
||
final String ref = getCachedString(parts[3].toUpperCase()); | ||
final String alts = getCachedString(parts[4]); | ||
final String ref = parts[3].toUpperCase(); | ||
final String alts = parts[4]; | ||
builder.log10PError(parseQual(parts[5])); | ||
|
||
final List<String> filters = parseFilters(getCachedString(parts[6])); | ||
if ( filters != null ) builder.filters(new HashSet<String>(filters)); | ||
if ( filters != null ) { | ||
builder.filters(new HashSet<>(filters)); | ||
} | ||
final Map<String, Object> attrs = parseInfo(parts[7]); | ||
builder.attributes(attrs); | ||
|
||
|
@@ -577,7 +579,7 @@ private static void checkAllele(String allele, boolean isRef, int lineNo) { | |
System.err.println(String.format("Allele detected with length %d exceeding max size %d at approximately line %d, likely resulting in degraded VCF processing performance", allele.length(), MAX_ALLELE_SIZE_BEFORE_WARNING, lineNo)); | ||
} | ||
|
||
if ( isSymbolicAllele(allele) ) { | ||
if (Allele.wouldBeSymbolicAllele(allele.getBytes())) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check is done before calling the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, there's a big redundant section of allele checking code here that I believe is redundant with the constructor. I wanted to make this as small a change set as possible though. I started a follow up branch that cleans up some of this stuff but I figured I'd get this one in before that. |
||
if ( isRef ) { | ||
generateException("Symbolic alleles not allowed as reference allele: " + allele, lineNo); | ||
} | ||
|
@@ -609,18 +611,6 @@ private static String generateExceptionTextForBadAlleleBases(final String allele | |
return "unparsable vcf record with allele " + allele; | ||
} | ||
|
||
/** | ||
* return true if this is a symbolic allele (e.g. <SOMETAG>) or | ||
* structural variation breakend (with [ or ]), otherwise false | ||
* @param allele the allele to check | ||
* @return true if the allele is a symbolic allele, otherwise false | ||
*/ | ||
private static boolean isSymbolicAllele(String allele) { | ||
return (allele != null && allele.length() > 2 && | ||
((allele.startsWith("<") && allele.endsWith(">")) || | ||
(allele.contains("[") || allele.contains("]")))); | ||
} | ||
|
||
/** | ||
* parse a single allele, given the allele list | ||
* @param alleles the alleles available | ||
|
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.
The use of
would
here confuses me. If this is a breakpoint allele string, then why notis
?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.
Yeah, it's weird, but it matches the existing methods. I think changing 1 of them is worse than having this weird convention. We could change all of them though...
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.
It's ok, I didn't see the rest of them.