Re-enabling indels for the Genomic Annotator as per Steve's patch. Steve assures me that he will test this out really well.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4139 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
6f4af47aac
commit
dda84a0e54
|
|
@ -122,58 +122,56 @@ public class GenomicAnnotation implements InfoFieldAnnotation {
|
||||||
|
|
||||||
//The HAPLOTYPE_REFERENCE_COLUMN matches the variant's reference allele based on a case-insensitive string comparison.
|
//The HAPLOTYPE_REFERENCE_COLUMN matches the variant's reference allele based on a case-insensitive string comparison.
|
||||||
//The HAPLOTYPE_ALTERNATE_COLUMN can optionally list more than allele separated by one of these chars: ,\/:|
|
//The HAPLOTYPE_ALTERNATE_COLUMN can optionally list more than allele separated by one of these chars: ,\/:|
|
||||||
String hapAltValue = annotationsForRecord.get( generateInfoFieldKey(name, HAPLOTYPE_ALTERNATE_COLUMN) );
|
// only check this value for SNPs
|
||||||
if(hapAltValue != null)
|
String hapAltValue = vc.isSNP() ? annotationsForRecord.get( generateInfoFieldKey(name, HAPLOTYPE_ALTERNATE_COLUMN) ) : null;
|
||||||
{
|
if ( hapAltValue != null && !hapAltValue.equals("*") ) {
|
||||||
if(!hapAltValue.equals("*"))
|
Set<Allele> alternateAlleles = vc.getAlternateAlleles();
|
||||||
{
|
//if(alternateAlleles.isEmpty()) {
|
||||||
Set<Allele> alternateAlleles = vc.getAlternateAlleles();
|
//handle a site that has been called monomorphic reference
|
||||||
//if(alternateAlleles.isEmpty()) {
|
//alternateAlleles.add(vc.getReference());
|
||||||
//handle a site that has been called monomorphic reference
|
//continue; //TODO If this site is monomorphic in the VC, and the current record specifies a particular alternate allele, skip this record. Right?
|
||||||
//alternateAlleles.add(vc.getReference());
|
//} else
|
||||||
//continue; //TODO If this site is monomorphic in the VC, and the current record specifies a particular alternate allele, skip this record. Right?
|
if(alternateAlleles.size() > 1) {
|
||||||
//} else
|
throw new StingException("Record [" + vc + "] contains " + alternateAlleles.size() + " alternate alleles. GenomicAnnotion currently only supports annotating 1 alternate allele.");
|
||||||
if(alternateAlleles.size() > 1) {
|
}
|
||||||
throw new StingException("Record [" + vc + "] contains " + alternateAlleles.size() + " alternate alleles. GenomicAnnotion currently only supports annotating 1 alternate allele.");
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean positiveStrand = true; //if HAPLOTYPE_STRAND_COLUMN isn't specified, assume positive strand.
|
boolean positiveStrand = true; //if HAPLOTYPE_STRAND_COLUMN isn't specified, assume positive strand.
|
||||||
String hapStrandValue = annotationsForRecord.get( generateInfoFieldKey(name, HAPLOTYPE_STRAND_COLUMN) );
|
String hapStrandValue = annotationsForRecord.get( generateInfoFieldKey(name, HAPLOTYPE_STRAND_COLUMN) );
|
||||||
if(hapStrandValue != null ) {
|
if(hapStrandValue != null ) {
|
||||||
hapStrandValue = hapStrandValue.trim().toLowerCase();
|
hapStrandValue = hapStrandValue.trim().toLowerCase();
|
||||||
if(hapStrandValue.equals("-") || hapStrandValue.equals("r")) {
|
if(hapStrandValue.equals("-") || hapStrandValue.equals("r")) {
|
||||||
positiveStrand = false;
|
positiveStrand = false;
|
||||||
} else if(!hapStrandValue.equals("+") && !hapStrandValue.equals("f")) {
|
} else if(!hapStrandValue.equals("+") && !hapStrandValue.equals("f")) {
|
||||||
throw new StingException("Record (" + gatkFeature.getUnderlyingObject() + ") in " + name + " has an invalid value for " + HAPLOTYPE_STRAND_COLUMN + ". This value is: \"" + hapStrandValue + "\"");
|
throw new StingException("Record (" + gatkFeature.getUnderlyingObject() + ") in " + name + " has an invalid value for " + HAPLOTYPE_STRAND_COLUMN + ". This value is: \"" + hapStrandValue + "\"");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Allele vcAlt;
|
Allele vcAlt;
|
||||||
if(alternateAlleles.isEmpty()) {
|
if(alternateAlleles.isEmpty()) {
|
||||||
vcAlt = vc.getReference();
|
vcAlt = vc.getReference();
|
||||||
} else {
|
} else {
|
||||||
vcAlt = alternateAlleles.iterator().next();
|
vcAlt = alternateAlleles.iterator().next();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean matchFound = false;
|
||||||
|
for(String hapAlt : hapAltValue.split("[,\\\\/:|]")) {
|
||||||
|
if(!positiveStrand) {
|
||||||
|
hapAlt = new String(BaseUtils.simpleReverseComplement(hapAlt.getBytes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean matchFound = false;
|
if(!hapAlt.isEmpty() && vcAlt.basesMatch(hapAlt)) {
|
||||||
for(String hapAlt : hapAltValue.split("[,\\\\/:|]")) {
|
matchFound = true;
|
||||||
if(!positiveStrand) {
|
break;
|
||||||
hapAlt = new String(BaseUtils.simpleReverseComplement(hapAlt.getBytes()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!hapAlt.isEmpty() && vcAlt.basesMatch(hapAlt)) {
|
|
||||||
matchFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!matchFound) {
|
|
||||||
continue; //skip record - none of its alternate alleles match the variant's alternate allele
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!matchFound) {
|
||||||
|
continue; //skip record - none of its alternate alleles match the variant's alternate allele
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String hapRefValue = annotationsForRecord.get( generateInfoFieldKey(name, HAPLOTYPE_REFERENCE_COLUMN) );
|
// only check this value for SNPs
|
||||||
|
String hapRefValue = vc.isSNP() ? annotationsForRecord.get( generateInfoFieldKey(name, HAPLOTYPE_REFERENCE_COLUMN) ) : null;
|
||||||
if(hapRefValue != null)
|
if(hapRefValue != null)
|
||||||
{
|
{
|
||||||
hapRefValue = hapRefValue.trim();
|
hapRefValue = hapRefValue.trim();
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ public class GenomicAnnotator extends RodWalker<Integer, Integer> implements Tre
|
||||||
Set<VariantContext> results = new LinkedHashSet<VariantContext>();
|
Set<VariantContext> results = new LinkedHashSet<VariantContext>();
|
||||||
for (VariantContext vc : tracker.getVariantContexts(ref, "variant", null, context.getLocation(), true, false)) {
|
for (VariantContext vc : tracker.getVariantContexts(ref, "variant", null, context.getLocation(), true, false)) {
|
||||||
if ( vc.isFiltered() ||
|
if ( vc.isFiltered() ||
|
||||||
(vc.isVariant() && (!vc.isSNP() || !vc.isBiallelic())) ) {
|
(vc.isVariant() && !vc.isBiallelic()) ) {
|
||||||
results.add(vc);
|
results.add(vc);
|
||||||
} else {
|
} else {
|
||||||
Map<String, StratifiedAlignmentContext> stratifiedContexts = StratifiedAlignmentContext.splitContextBySample(context.getBasePileup());
|
Map<String, StratifiedAlignmentContext> stratifiedContexts = StratifiedAlignmentContext.splitContextBySample(context.getBasePileup());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue