Refactored the quasi-useful IndelType annotation into the more useful VariantType.
The indels are still annotated as before, but now all other variant types are annotated too. I'm doing this because of requests on the forum but am not making it standard. If we find it to be useful we can turn it on by default later.
This commit is contained in:
parent
6171419e6c
commit
e6f468b647
|
|
@ -15,9 +15,9 @@ import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
|||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Rough category of indel type (insertion, deletion, multi-allelic, other)
|
||||
* Assigns a roughly correct category of the variant type (SNP, MNP, insertion, deletion, etc.)
|
||||
*/
|
||||
public class IndelType extends InfoFieldAnnotation implements ExperimentalAnnotation {
|
||||
public class VariantType extends InfoFieldAnnotation implements ExperimentalAnnotation {
|
||||
|
||||
public Map<String, Object> annotate(final RefMetaDataTracker tracker,
|
||||
final AnnotatorCompatible walker,
|
||||
|
|
@ -26,41 +26,35 @@ public class IndelType extends InfoFieldAnnotation implements ExperimentalAnnota
|
|||
final VariantContext vc,
|
||||
final Map<String, PerReadAlleleLikelihoodMap> stratifiedPerReadAlleleLikelihoodMap) {
|
||||
|
||||
int run;
|
||||
if (vc.isMixed()) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyNames().get(0), String.format("%s", "MIXED"));
|
||||
return map;
|
||||
|
||||
}
|
||||
else if ( vc.isIndel() ) {
|
||||
String type="";
|
||||
if (!vc.isBiallelic())
|
||||
type = "MULTIALLELIC_INDEL";
|
||||
else {
|
||||
if (vc.isSimpleInsertion())
|
||||
type = "INS.";
|
||||
else if (vc.isSimpleDeletion())
|
||||
type = "DEL.";
|
||||
else
|
||||
type = "OTHER.";
|
||||
ArrayList<Integer> inds = IndelUtils.findEventClassificationIndex(vc, ref);
|
||||
for (int k : inds) {
|
||||
type = type+ IndelUtils.getIndelClassificationName(k)+".";
|
||||
}
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyNames().get(0), String.format("%s", type));
|
||||
return map;
|
||||
StringBuffer type = new StringBuffer("");
|
||||
if ( vc.isVariant() && !vc.isBiallelic() )
|
||||
type.append("MULTIALLELIC_");
|
||||
|
||||
if ( !vc.isIndel() ) {
|
||||
type.append(vc.getType().toString());
|
||||
} else {
|
||||
return null;
|
||||
if (vc.isSimpleInsertion())
|
||||
type.append("INSERTION.");
|
||||
else if (vc.isSimpleDeletion())
|
||||
type.append("DELETION.");
|
||||
else
|
||||
type.append("COMPLEX.");
|
||||
ArrayList<Integer> inds = IndelUtils.findEventClassificationIndex(vc, ref);
|
||||
type.append(IndelUtils.getIndelClassificationName(inds.get(0)));
|
||||
|
||||
for (int i = 1; i < inds.size(); i++ ) {
|
||||
type.append(".");
|
||||
type.append(IndelUtils.getIndelClassificationName(inds.get(i)));
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyNames().get(0), String.format("%s", type));
|
||||
return map;
|
||||
}
|
||||
|
||||
public List<String> getKeyNames() { return Arrays.asList("IndelType"); }
|
||||
public List<String> getKeyNames() { return Arrays.asList("VariantType"); }
|
||||
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("IndelType", 1, VCFHeaderLineType.String, "Indel type description")); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("VariantType", 1, VCFHeaderLineType.String, "Variant type description")); }
|
||||
|
||||
}
|
||||
|
|
@ -122,9 +122,9 @@ public class IndelUtils {
|
|||
|
||||
ArrayList<Integer> inds = new ArrayList<Integer>();
|
||||
if ( vc.isSimpleInsertion() ) {
|
||||
indelAlleleString = vc.getAlternateAllele(0).getDisplayString();
|
||||
indelAlleleString = vc.getAlternateAllele(0).getDisplayString().substring(1);
|
||||
} else if ( vc.isSimpleDeletion() ) {
|
||||
indelAlleleString = vc.getReference().getDisplayString();
|
||||
indelAlleleString = vc.getReference().getDisplayString().substring(1);
|
||||
}
|
||||
else {
|
||||
inds.add(IND_FOR_OTHER_EVENT);
|
||||
|
|
|
|||
Loading…
Reference in New Issue