fix for the eval tests, and a change to the backedbygenotypes interface, more changes to come
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1661 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
4318f75910
commit
b6d7d6acc6
|
|
@ -266,7 +266,6 @@ public class RodGeliText extends BasicReferenceOrderedDatum implements Variation
|
||||||
|
|
||||||
public List<String> getGenotype() throws IllegalStateException {
|
public List<String> getGenotype() throws IllegalStateException {
|
||||||
return Arrays.asList(getBestGenotype());
|
return Arrays.asList(getBestGenotype());
|
||||||
//throw new IllegalStateException("huh?");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPloidy() throws IllegalStateException {
|
public int getPloidy() throws IllegalStateException {
|
||||||
|
|
@ -348,14 +347,13 @@ public class RodGeliText extends BasicReferenceOrderedDatum implements Variation
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the likelihoods
|
* get the genotype
|
||||||
*
|
*
|
||||||
* @return an array in lexigraphical order of the likelihoods
|
* @return a map in lexigraphical order of the genotypes
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Genotype getGenotype(DiploidGenotype x) {
|
public Genotype getCallexGenotype() {
|
||||||
if (x.toString() != this.getAltBasesFWD()) throw new IllegalStateException("We don't contain genotype " + x);
|
return new BasicGenotype(getLocation(), this.getAltBasesFWD(), refBase, lodBtnb);
|
||||||
return new BasicGenotype(getLocation(), x.toString(), refBase, lodBtnb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -259,6 +259,16 @@ public class RodGenotypeChipAsGFF extends BasicReferenceOrderedDatum implements
|
||||||
public boolean isBiallelic() { return true; }
|
public boolean isBiallelic() { return true; }
|
||||||
public int length() { return 1; }
|
public int length() { return 1; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the genotype
|
||||||
|
*
|
||||||
|
* @return a map in lexigraphical order of the genotypes
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Genotype getCallexGenotype() {
|
||||||
|
return new BasicGenotype(this.getLocation(),this.feature,this.getRefSnpFWD(),this.getConsensusConfidence());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the likelihoods
|
* get the likelihoods
|
||||||
*
|
*
|
||||||
|
|
@ -271,17 +281,6 @@ public class RodGenotypeChipAsGFF extends BasicReferenceOrderedDatum implements
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* get the likelihoods
|
|
||||||
*
|
|
||||||
* @return an array in lexigraphical order of the likelihoods
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Genotype getGenotype(DiploidGenotype x) {
|
|
||||||
if (!x.toString().equals(this.getAltBasesFWD())) throw new IllegalStateException("Unable to retrieve genotype");
|
|
||||||
return new BasicGenotype(this.getLocation(),this.feature,this.getRefSnpFWD(),this.getConsensusConfidence());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* do we have the specified genotype? not all backedByGenotypes
|
* do we have the specified genotype? not all backedByGenotypes
|
||||||
* have all the genotype data.
|
* have all the genotype data.
|
||||||
|
|
|
||||||
|
|
@ -249,6 +249,16 @@ public class RodVCF extends BasicReferenceOrderedDatum implements Variation, Var
|
||||||
return mCurrentRecord.getReferenceBase();
|
return mCurrentRecord.getReferenceBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the genotype
|
||||||
|
*
|
||||||
|
* @return a map in lexigraphical order of the genotypes
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Genotype getCallexGenotype() {
|
||||||
|
throw new UnsupportedOperationException("We don't support this right now");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the genotypes
|
* get the genotypes
|
||||||
*
|
*
|
||||||
|
|
@ -273,29 +283,6 @@ public class RodVCF extends BasicReferenceOrderedDatum implements Variation, Var
|
||||||
return genotypes;
|
return genotypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the likelihoods
|
|
||||||
*
|
|
||||||
* @return an array in lexigraphical order of the likelihoods
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public 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
|
* do we have the specified genotype? not all backedByGenotypes
|
||||||
* have all the genotype data.
|
* have all the genotype data.
|
||||||
|
|
@ -306,9 +293,7 @@ public class RodVCF extends BasicReferenceOrderedDatum implements Variation, Var
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean hasGenotype(DiploidGenotype x) {
|
public boolean hasGenotype(DiploidGenotype x) {
|
||||||
if (getGenotype(x) != null)
|
return (this.getAlternateBases().contains(x.toString()));
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,7 @@ package org.broadinstitute.sting.gatk.refdata;
|
||||||
|
|
||||||
import net.sf.picard.util.SequenceUtil;
|
import net.sf.picard.util.SequenceUtil;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
import org.broadinstitute.sting.utils.genotype.BasicGenotype;
|
import org.broadinstitute.sting.utils.genotype.*;
|
||||||
import org.broadinstitute.sting.utils.genotype.DiploidGenotype;
|
|
||||||
import org.broadinstitute.sting.utils.genotype.VariantBackedByGenotype;
|
|
||||||
import org.broadinstitute.sting.utils.genotype.Variation;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -355,6 +352,16 @@ public class rodDbSNP extends BasicReferenceOrderedDatum implements Variation, V
|
||||||
return (int) (loc.getStop() - loc.getStart() + 1);
|
return (int) (loc.getStop() - loc.getStart() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the genotype
|
||||||
|
*
|
||||||
|
* @return a map in lexigraphical order of the genotypes
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public org.broadinstitute.sting.utils.genotype.Genotype getCallexGenotype() {
|
||||||
|
return new BasicGenotype(this.getLocation(), this.getAltBasesFWD(), this.getRefSnpFWD(), this.getConsensusConfidence());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the likelihoods
|
* get the likelihoods
|
||||||
*
|
*
|
||||||
|
|
@ -367,17 +374,6 @@ public class rodDbSNP extends BasicReferenceOrderedDatum implements Variation, V
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* get the likelihoods
|
|
||||||
*
|
|
||||||
* @return an array in lexigraphical order of the likelihoods
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public org.broadinstitute.sting.utils.genotype.Genotype getGenotype(DiploidGenotype x) {
|
|
||||||
if (!x.toString().equals(this.getAltBasesFWD())) throw new IllegalStateException("Unable to retrieve genotype");
|
|
||||||
return new BasicGenotype(this.getLocation(), this.getAltBasesFWD(), this.getRefSnpFWD(), this.getConsensusConfidence());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* do we have the specified genotype? not all backedByGenotypes
|
* do we have the specified genotype? not all backedByGenotypes
|
||||||
* have all the genotype data.
|
* have all the genotype data.
|
||||||
|
|
|
||||||
|
|
@ -11,18 +11,18 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface VariantBackedByGenotype {
|
public interface VariantBackedByGenotype {
|
||||||
/**
|
/**
|
||||||
* get the likelihoods
|
* get the genotype
|
||||||
*
|
*
|
||||||
* @return a map in lexigraphical order of the likelihoods
|
* @return a specific genotype that represents the called genotype
|
||||||
*/
|
*/
|
||||||
public List<Genotype> getGenotypes();
|
public Genotype getCallexGenotype();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the likelihoods
|
* get the genotype
|
||||||
*
|
*
|
||||||
* @return a map in lexigraphical order of the likelihoods
|
* @return a map in lexigraphical order of the genotypes
|
||||||
*/
|
*/
|
||||||
public Genotype getGenotype(DiploidGenotype x);
|
public List<Genotype> getGenotypes();
|
||||||
/**
|
/**
|
||||||
* do we have the specified genotype? not all backedByGenotypes
|
* do we have the specified genotype? not all backedByGenotypes
|
||||||
* have all the genotype data.
|
* have all the genotype data.
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ public class VariantEvalWalkerIntegrationTest extends WalkerTest {
|
||||||
@Test
|
@Test
|
||||||
public void testEvalGenotypeROD() {
|
public void testEvalGenotypeROD() {
|
||||||
List<String> md5 = new ArrayList<String>();
|
List<String> md5 = new ArrayList<String>();
|
||||||
md5.add("439c2983a6e1250cd845c686a0e5a085");
|
md5.add("d337f22057d2e9cfda03af3be70ce35a");
|
||||||
/**
|
/**
|
||||||
* the above MD5 was calculated after running the following command:
|
* the above MD5 was calculated after running the following command:
|
||||||
*
|
*
|
||||||
|
|
@ -144,5 +144,32 @@ public class VariantEvalWalkerIntegrationTest extends WalkerTest {
|
||||||
md5);
|
md5);
|
||||||
List<File> result = executeTest("testEvalGenotypeROD", spec).getFirst();
|
List<File> result = executeTest("testEvalGenotypeROD", spec).getFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEvalMarksGenotypingExample() {
|
||||||
|
List<String> md5 = new ArrayList<String>();
|
||||||
|
md5.add("39ea64299cad44f816f033db54c8e622");
|
||||||
|
/**
|
||||||
|
* Run with the following commands:
|
||||||
|
*
|
||||||
|
* java -Xmx2048m -jar /humgen/gsa-hphome1/depristo/dev/GenomeAnalysisTK/trunk/dist/GenomeAnalysisTK.jar
|
||||||
|
* -T VariantEval -R /broad/1KG/reference/human_b36_both.fasta -l INFO
|
||||||
|
* -B eval,Variants,/humgen/gsa-scr1/ebanks/concordanceForMark/UMichVsBroad.venn.set1Only.calls
|
||||||
|
* -D /humgen/gsa-scr1/GATK_Data/dbsnp_129_b36.rod -hc /humgen/gsa-scr1/GATK_Data/1KG_gffs/NA12878.1kg.gff
|
||||||
|
* -G -L 1 -o /humgen/gsa-scr1/ebanks/concordanceForMark/UMichVsBroad.venn.set1Only.calls.eval
|
||||||
|
*/
|
||||||
|
|
||||||
|
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||||
|
"-T VariantEval -R /broad/1KG/reference/human_b36_both.fasta " +
|
||||||
|
"-B eval,Variants,/humgen/gsa-scr1/GATK_Data/Validation_Data/UMichVsBroad.venn.set1Only.calls " +
|
||||||
|
"-D /humgen/gsa-scr1/GATK_Data/dbsnp_129_b36.rod -hc /humgen/gsa-scr1/GATK_Data/1KG_gffs/NA12878.1kg.gff " +
|
||||||
|
"-G " +
|
||||||
|
"--supressDateInformation " +
|
||||||
|
"-L 1:1-10,000,000 " +
|
||||||
|
"--outerr %s",
|
||||||
|
1, // just one output file
|
||||||
|
md5);
|
||||||
|
List<File> result = executeTest("testEvalMarksGenotypingExample", spec).getFirst();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue