little fixes; also fixed a tyPo

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1662 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2009-09-18 22:38:51 +00:00
parent b6d7d6acc6
commit 3a487dd64e
6 changed files with 30 additions and 8 deletions

View File

@ -352,7 +352,7 @@ public class RodGeliText extends BasicReferenceOrderedDatum implements Variation
* @return a map in lexigraphical order of the genotypes
*/
@Override
public Genotype getCallexGenotype() {
public Genotype getCalledGenotype() {
return new BasicGenotype(getLocation(), this.getAltBasesFWD(), refBase, lodBtnb);
}

View File

@ -265,7 +265,7 @@ public class RodGenotypeChipAsGFF extends BasicReferenceOrderedDatum implements
* @return a map in lexigraphical order of the genotypes
*/
@Override
public Genotype getCallexGenotype() {
public Genotype getCalledGenotype() {
return new BasicGenotype(this.getLocation(),this.feature,this.getRefSnpFWD(),this.getConsensusConfidence());
}

View File

@ -255,7 +255,7 @@ public class RodVCF extends BasicReferenceOrderedDatum implements Variation, Var
* @return a map in lexigraphical order of the genotypes
*/
@Override
public Genotype getCallexGenotype() {
public Genotype getCalledGenotype() {
throw new UnsupportedOperationException("We don't support this right now");
}
@ -283,6 +283,27 @@ public class RodVCF extends BasicReferenceOrderedDatum implements Variation, Var
return genotypes;
}
/**
* a private helper method
*
* @return an array in lexigraphical order of the likelihoods
*/
private Genotype getGenotype(DiploidGenotype x) {
if (x.toString().equals(getReference()))
return new BasicGenotype(this.getLocation(), getReference(), this.getReference().charAt(0), 0);
for (VCFGenotypeRecord record : mCurrentRecord.getVCFGenotypeRecords()) {
if (Utils.join("", record.getAlleles()).equals(x.toString())) {
double qual = 0.0;
if (record.getAlleles().equals(this.getReference()))
qual = this.getNegLog10PError();
else if (record.getFields().containsKey("GQ"))
qual = Double.valueOf(record.getFields().get("GQ")) / 10.0;
return new BasicGenotype(this.getLocation(), Utils.join("", record.getAlleles()), this.getReference().charAt(0), qual);
}
}
return null;
}
/**
* do we have the specified genotype? not all backedByGenotypes
* have all the genotype data.
@ -293,7 +314,9 @@ public class RodVCF extends BasicReferenceOrderedDatum implements Variation, Var
*/
@Override
public boolean hasGenotype(DiploidGenotype x) {
return (this.getAlternateBases().contains(x.toString()));
if (getGenotype(x) != null)
return true;
return false;
}
@Override

View File

@ -358,7 +358,7 @@ public class rodDbSNP extends BasicReferenceOrderedDatum implements Variation, V
* @return a map in lexigraphical order of the genotypes
*/
@Override
public org.broadinstitute.sting.utils.genotype.Genotype getCallexGenotype() {
public org.broadinstitute.sting.utils.genotype.Genotype getCalledGenotype() {
return new BasicGenotype(this.getLocation(), this.getAltBasesFWD(), this.getRefSnpFWD(), this.getConsensusConfidence());
}

View File

@ -2,7 +2,6 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.utils.genotype.DiploidGenotype;
import org.broadinstitute.sting.utils.genotype.Genotype;
import org.broadinstitute.sting.utils.genotype.VariantBackedByGenotype;
import org.broadinstitute.sting.utils.genotype.Variation;
@ -69,7 +68,7 @@ public class CallableBasesAnalysis extends BasicVariantAnalysis implements Genot
// For every threshold, updated discoverable and callable
for (int i = 0; i < thresholds.length; i++) {
double threshold = thresholds[i];
Genotype genotype = ((VariantBackedByGenotype)eval).getGenotypes().get(0);
Genotype genotype = ((VariantBackedByGenotype)eval).getCalledGenotype();
// update discoverable
if ( eval.isSNP() && eval.getNegLog10PError() >= threshold)

View File

@ -15,7 +15,7 @@ public interface VariantBackedByGenotype {
*
* @return a specific genotype that represents the called genotype
*/
public Genotype getCallexGenotype();
public Genotype getCalledGenotype();
/**
* get the genotype