-Added convenience method to VCF record to tell if it's a no call and have rodVCF use it before querying for info fields

-Don't restrict info fields to 2-letter keys
[about to move these to core]


git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2002 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2009-11-09 20:52:51 +00:00
parent 740a5484c4
commit 3793519bd4
6 changed files with 24 additions and 10 deletions

View File

@ -304,13 +304,17 @@ public class RodVCF extends BasicReferenceOrderedDatum implements VariationRod,
if (lst.size() != 1) { if (lst.size() != 1) {
throw new IllegalStateException("VCF object does not have one and only one genotype record"); throw new IllegalStateException("VCF object does not have one and only one genotype record");
} }
VCFGenotypeRecord rec = lst.get(0);
if ( rec.isEmptyGenotype() )
return null;
double qual = 0; double qual = 0;
if (lst.get(0).getAlleles().equals(this.getReference())) if (rec.getAlleles().equals(this.getReference()))
qual = refQual; qual = refQual;
else if (lst.get(0).getFields().containsKey("GQ")) else if (rec.getFields().containsKey("GQ"))
qual = Double.valueOf(lst.get(0).getFields().get("GQ")) / 10.0; qual = Double.valueOf(rec.getFields().get("GQ")) / 10.0;
int coverage = (lst.get(0).getFields().containsKey("RD") ? Integer.valueOf(lst.get(0).getFields().get("RD")) : 0); int coverage = (rec.getFields().containsKey("RD") ? Integer.valueOf(rec.getFields().get("RD")) : 0);
return new VCFGenotypeCall(this.getReference().charAt(0), this.getLocation(), Utils.join("", lst.get(0).getAlleles()), qual, coverage, lst.get(0).getSampleName()); return new VCFGenotypeCall(this.getReference().charAt(0), this.getLocation(), Utils.join("", rec.getAlleles()), qual, coverage, rec.getSampleName());
} }
return null; return null;
} }
@ -329,6 +333,9 @@ public class RodVCF extends BasicReferenceOrderedDatum implements VariationRod,
double refQual = (this.getNegLog10PError()); double refQual = (this.getNegLog10PError());
// add the reference // add the reference
for (VCFGenotypeRecord rec : mCurrentRecord.getVCFGenotypeRecords()) { for (VCFGenotypeRecord rec : mCurrentRecord.getVCFGenotypeRecords()) {
if ( rec.isEmptyGenotype() )
continue;
;
double qual = 0; double qual = 0;
if (rec.getAlleles().equals(this.getReference())) if (rec.getAlleles().equals(this.getReference()))
qual = refQual; qual = refQual;

View File

@ -101,5 +101,5 @@ public class IndelSubsets implements ConcordanceType {
return Math.max(leftRun, rightRun); return Math.max(leftRun, rightRun);
} }
public String getInfoName() { return "IS"; } public String getInfoName() { return "IndelSubsets"; }
} }

View File

@ -32,11 +32,11 @@ public class NWayVenn implements ConcordanceType {
while ( iter.hasNext() ) { while ( iter.hasNext() ) {
tag.append(iter.next()); tag.append(iter.next());
if ( iter.hasNext() ) if ( iter.hasNext() )
tag.append("."); tag.append("-");
} }
return tag.toString(); return tag.toString();
} }
public String getInfoName() { return "NV"; } public String getInfoName() { return "NwayVenn"; }
} }

View File

@ -94,5 +94,5 @@ public class SNPGenotypeConcordance implements ConcordanceType {
return altAllele1 == altAllele2; return altAllele1 == altAllele2;
} }
public String getInfoName() { return "SG"; } public String getInfoName() { return "SnpConcordance"; }
} }

View File

@ -58,5 +58,5 @@ public class SimpleVenn implements ConcordanceType {
return "concordant"; return "concordant";
} }
public String getInfoName() { return "SV"; } public String getInfoName() { return "Venn"; }
} }

View File

@ -115,6 +115,13 @@ public class VCFGenotypeRecord {
} }
public boolean isEmptyGenotype() {
for ( VCFGenotypeEncoding encoding : mGenotypeAlleles ) {
if ( encoding.getType() != VCFGenotypeEncoding.TYPE.UNCALLED )
return false;
}
return true;
}
public boolean equals(Object other) { public boolean equals(Object other) {
if (other instanceof VCFGenotypeRecord) { if (other instanceof VCFGenotypeRecord) {