a) Made indel VQSR consensus script operational again, b) Made VariantsToTable more indel-friendly when printing out REF and ALT fields: strip out * from REF and print out alleles in the same way as the VCF so that offline processing is easier

This commit is contained in:
Guillermo del Angel 2011-07-15 10:13:02 -04:00
parent 0e9b81283b
commit 9d59c2cb61
1 changed files with 15 additions and 3 deletions

View File

@ -76,17 +76,29 @@ public class VariantsToTable extends RodWalker<Integer, Integer> {
// #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT
getters.put("CHROM", new Getter() { public String get(VariantContext vc) { return vc.getChr(); } });
getters.put("POS", new Getter() { public String get(VariantContext vc) { return Integer.toString(vc.getStart()); } });
getters.put("REF", new Getter() { public String get(VariantContext vc) { return vc.getReference().toString(); } });
getters.put("REF", new Getter() {
public String get(VariantContext vc) {
String x = "";
if (vc.hasAttribute(VariantContext.REFERENCE_BASE_FOR_INDEL_KEY)) {
Byte refByte = (Byte)(vc.getAttribute(VariantContext.REFERENCE_BASE_FOR_INDEL_KEY));
x=x+new String(new byte[]{refByte});
}
return x+vc.getReference().getDisplayString();
}
});
getters.put("ALT", new Getter() {
public String get(VariantContext vc) {
StringBuilder x = new StringBuilder();
int n = vc.getAlternateAlleles().size();
if ( n == 0 ) return ".";
if (vc.hasAttribute(VariantContext.REFERENCE_BASE_FOR_INDEL_KEY)) {
Byte refByte = (Byte)(vc.getAttribute(VariantContext.REFERENCE_BASE_FOR_INDEL_KEY));
x.append(new String(new byte[]{refByte}));
}
for ( int i = 0; i < n; i++ ) {
if ( i != 0 ) x.append(",");
x.append(vc.getAlternateAllele(i).toString());
x.append(vc.getAlternateAllele(i).getDisplayString());
}
return x.toString();
}