-Renamed rodVariants to RodGeliText
-Remove KGenomesSNPROD -Remove rodFLT -Renamed rodGFF to RodGenotypeChipAsGFF -Fixed a problem in SSGenotypeCall -Added basic SSGenotype Test class -Make VCFHeader constructors public git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1536 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
fd1c72c151
commit
0cc634ed5d
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
package org.broadinstitute.sting.gatk.contexts;
|
||||
|
||||
import org.broadinstitute.sting.gatk.refdata.rodVariants;
|
||||
import org.broadinstitute.sting.gatk.refdata.RodGeliText;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
|
||||
import net.sf.samtools.SAMRecord;
|
||||
|
|
@ -36,11 +36,11 @@ public class VariantContext {
|
|||
private RefMetaDataTracker tracker;
|
||||
private ReferenceContext ref;
|
||||
private AlignmentContext context;
|
||||
private rodVariants variant;
|
||||
private RodGeliText variant;
|
||||
private AlignmentContext Q0freeContext = null;
|
||||
|
||||
public VariantContext(RefMetaDataTracker tracker, ReferenceContext ref,
|
||||
AlignmentContext context, rodVariants variant) {
|
||||
AlignmentContext context, RodGeliText variant) {
|
||||
this.tracker = tracker;
|
||||
this.ref = ref;
|
||||
this.context = context;
|
||||
|
|
@ -49,7 +49,7 @@ public class VariantContext {
|
|||
|
||||
public RefMetaDataTracker getTracker() { return tracker; }
|
||||
public ReferenceContext getReferenceContext() { return ref; }
|
||||
public rodVariants getVariant() { return variant; }
|
||||
public RodGeliText getVariant() { return variant; }
|
||||
public AlignmentContext getAlignmentContext(boolean useMQ0Reads) {
|
||||
return (useMQ0Reads ? context : getQ0freeContext());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,61 +0,0 @@
|
|||
package org.broadinstitute.sting.gatk.refdata;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
|
||||
/**
|
||||
* loc ref alt EM_alt_freq discovery_likelihood discovery_null discovery_prior discovery_lod EM_N n_ref n_het n_hom
|
||||
* chr1:1104840 A N 0.000000 -85.341265 -85.341265 0.000000 0.000000 324.000000 162 0 0
|
||||
* chr1:1104841 C N 0.000000 -69.937928 -69.937928 0.000000 0.000000 324.000000 162 0 0
|
||||
* chr1:1104842 A N 0.000000 -84.816002 -84.816002 0.000000 0.000000 324.000000 162 0 0
|
||||
*
|
||||
*/
|
||||
public class KGenomesSNPROD extends TabularROD implements SNPCallFromGenotypes {
|
||||
public KGenomesSNPROD(final String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public GenomeLoc getLocation() {
|
||||
loc = GenomeLocParser.createGenomeLoc(this.get("0"), Long.parseLong(this.get("1")));
|
||||
return loc;
|
||||
}
|
||||
public String getRefBasesFWD() { return this.get("2"); }
|
||||
public char getRefSnpFWD() throws IllegalStateException { return getRefBasesFWD().charAt(0); }
|
||||
public String getAltBasesFWD() { return this.get("3"); }
|
||||
public char getAltSnpFWD() throws IllegalStateException {
|
||||
if ( getAltBasesFWD().charAt(0) != getRefSnpFWD() )
|
||||
return getAltBasesFWD().charAt(0);
|
||||
return getAltBasesFWD().charAt(1);
|
||||
}
|
||||
public boolean isReference() { return getVariationConfidence() < 0.01; }
|
||||
public boolean isSNP() { return ! isReference(); }
|
||||
public boolean isInsertion() { return false; }
|
||||
public boolean isDeletion() { return false; }
|
||||
public boolean isIndel() { return false; }
|
||||
public double getMAF() { return Double.parseDouble(this.get("4")); }
|
||||
public double getHeterozygosity() { return 2 * getMAF() * (1 - getMAF()); }
|
||||
public boolean isGenotype() { return false; }
|
||||
public double getVariationConfidence() { return Double.parseDouble(this.get("8")); }
|
||||
public double getConsensusConfidence() { return -1; }
|
||||
public List<String> getGenotype() throws IllegalStateException { throw new IllegalStateException(); }
|
||||
public int getPloidy() throws IllegalStateException { return 2; }
|
||||
public boolean isBiallelic() { return true; }
|
||||
|
||||
// SNPCallFromGenotypes interface
|
||||
public int nIndividuals() { return -1; }
|
||||
public int nHomRefGenotypes() { return -1; }
|
||||
public int nHetGenotypes() { return -1; }
|
||||
public int nHomVarGenotypes() { return -1; }
|
||||
public List<Genotype> getGenotypes() { return null; }
|
||||
public int length() { return 1; }
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(getLocation().getContig() + "\t" + getLocation().getStart() + "\t");
|
||||
sb.append(getRefSnpFWD() + "\t" + getGenotype().get(0) + "\t");
|
||||
sb.append(getMAF() + "\t0\t0\t0\t" + getVariationConfidence());
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -62,23 +62,21 @@ public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements
|
|||
|
||||
static {
|
||||
// All known ROD types
|
||||
addModule("GFF", rodGFF.class);
|
||||
addModule("GFF", RodGenotypeChipAsGFF.class);
|
||||
addModule("dbSNP", rodDbSNP.class);
|
||||
addModule("HapMapAlleleFrequencies", HapMapAlleleFrequenciesROD.class);
|
||||
addModule("SAMPileup", rodSAMPileup.class);
|
||||
addModule("GELI", rodGELI.class);
|
||||
addModule("FLT", rodFLT.class);
|
||||
addModule("RefSeq", rodRefSeq.class);
|
||||
addModule("Table", TabularROD.class);
|
||||
addModule("PooledEM", PooledEMSNPROD.class);
|
||||
addModule("1KGSNPs", KGenomesSNPROD.class);
|
||||
addModule("CleanedOutSNP", CleanedOutSNPROD.class);
|
||||
addModule("SangerSNP", SangerSNPROD.class);
|
||||
addModule("SimpleIndel", SimpleIndelROD.class);
|
||||
addModule("PointIndel", PointIndelROD.class);
|
||||
addModule("HapMapGenotype", HapMapGenotypeROD.class);
|
||||
addModule("Intervals", IntervalRod.class);
|
||||
addModule("Variants", rodVariants.class);
|
||||
addModule("Variants", RodGeliText.class);
|
||||
addModule("GLF", RodGLF.class);
|
||||
}
|
||||
|
||||
|
|
@ -232,7 +230,7 @@ public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements
|
|||
for (ReferenceOrderedDatum rec : this) {
|
||||
System.out.println(rec.toString());
|
||||
|
||||
rodGFF gff = (rodGFF) rec;
|
||||
RodGenotypeChipAsGFF gff = (RodGenotypeChipAsGFF) rec;
|
||||
String[] keys = {"LENGTH", "ALT", "FOBARBAR"};
|
||||
for (String key : keys) {
|
||||
System.out.printf(" -> %s is (%s)%n", key, gff.containsAttribute(key) ? gff.getAttribute(key) : "none");
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class rodVariants extends BasicReferenceOrderedDatum implements AllelicVariant {
|
||||
public class RodGeliText extends BasicReferenceOrderedDatum implements AllelicVariant {
|
||||
public enum Genotype { AA, AC, AG, AT, CC, CG, CT, GG, GT, TT }
|
||||
public GenomeLoc loc;
|
||||
public char refBase = 'N';
|
||||
|
|
@ -43,7 +43,7 @@ public class rodVariants extends BasicReferenceOrderedDatum implements AllelicVa
|
|||
public double lodBtnb;
|
||||
public double[] genotypeLikelihoods = new double[10];
|
||||
|
||||
public rodVariants(final String name) {
|
||||
public RodGeliText(final String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ import java.util.regex.Pattern;
|
|||
* Time: 10:47:14 AM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class rodGFF extends BasicReferenceOrderedDatum implements AllelicVariant {
|
||||
public class RodGenotypeChipAsGFF extends BasicReferenceOrderedDatum implements AllelicVariant {
|
||||
private String contig, source, feature, strand, frame;
|
||||
private long start, stop;
|
||||
private double score;
|
||||
|
|
@ -27,7 +27,7 @@ public class rodGFF extends BasicReferenceOrderedDatum implements AllelicVariant
|
|||
// Constructors
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
public rodGFF(final String name) {
|
||||
public RodGenotypeChipAsGFF(final String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
package org.broadinstitute.sting.gatk.refdata;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
|
||||
/**
|
||||
* 1 469 C S 51 52 0.00 44 1 C 0 M
|
||||
* 1 492 C Y 130 51 0.00 46 1 C 0 T
|
||||
* 1 20786 G K 5 6 0.00 46 1 T 38 G
|
||||
*
|
||||
*/
|
||||
public class rodFLT extends TabularROD implements SNPCallFromGenotypes {
|
||||
public rodFLT(final String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public GenomeLoc getLocation() {
|
||||
loc = GenomeLocParser.createGenomeLoc(this.get("0"), Long.parseLong(this.get("1")));
|
||||
return loc;
|
||||
}
|
||||
public String getRefBasesFWD() { return this.get("2"); }
|
||||
public char getRefSnpFWD() throws IllegalStateException { return getRefBasesFWD().charAt(0); }
|
||||
public String getAltBasesFWD() { return new String(BaseUtils.iupacToBases(this.get("3").charAt(0))); }
|
||||
public char getAltSnpFWD() throws IllegalStateException {
|
||||
char[] bases = BaseUtils.iupacToBases(this.get("3").charAt(0));
|
||||
if ( bases[0] != getRefSnpFWD() )
|
||||
return bases[0];
|
||||
else
|
||||
return bases[1];
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(loc.getContig() + "\t" + loc.getStart() + "\t");
|
||||
sb.append(getRefSnpFWD() + "\t-1\t-1\t" + getAltBasesFWD());
|
||||
for (int i=0; i < 12; i++)
|
||||
sb.append("\t0");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public boolean isReference() { return false; }
|
||||
public boolean isSNP() { return true; }
|
||||
public boolean isInsertion() { return false; }
|
||||
public boolean isDeletion() { return false; }
|
||||
public boolean isIndel() { return false; }
|
||||
public double getMAF() { return 0.0; }
|
||||
public double getHeterozygosity() { return 0.0; }
|
||||
public boolean isGenotype() { return false; }
|
||||
public double getVariationConfidence() {
|
||||
double value = Double.parseDouble(this.get("6"));
|
||||
return (value > 0.0 ? value : 1.0);
|
||||
}
|
||||
public double getConsensusConfidence() { return -1; }
|
||||
public List<String> getGenotype() throws IllegalStateException { return Arrays.asList(getAltBasesFWD()); }
|
||||
public int getPloidy() throws IllegalStateException { return 2; }
|
||||
public boolean isBiallelic() { return true; }
|
||||
public int length() { return 1; }
|
||||
|
||||
// SNPCallFromGenotypes interface
|
||||
public int nIndividuals() { return -1; }
|
||||
public int nHomRefGenotypes() { return -1; }
|
||||
public int nHetGenotypes() { return -1; }
|
||||
public int nHomVarGenotypes() { return -1; }
|
||||
public List<Genotype> getGenotypes() { return null; }
|
||||
}
|
||||
|
|
@ -2,10 +2,7 @@ package org.broadinstitute.sting.gatk.walkers;
|
|||
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||
import org.broadinstitute.sting.gatk.refdata.rodDbSNP;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.refdata.rodGFF;
|
||||
import org.broadinstitute.sting.gatk.refdata.*;
|
||||
import org.broadinstitute.sting.utils.cmdLine.Argument;
|
||||
import org.broadinstitute.sting.utils.ReadBackedPileup;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
|
|
@ -85,7 +82,7 @@ public class PileupWithContextWalker extends LocusWalker<Integer, Integer> imple
|
|||
}
|
||||
*/
|
||||
|
||||
if ( datum != null && (datum instanceof rodGFF)) {
|
||||
if ( datum != null && (datum instanceof RodGenotypeChipAsGFF)) {
|
||||
rodString += "Hapmap: " + datum.toSimpleString() + " ";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.filters;
|
||||
|
||||
import org.broadinstitute.sting.gatk.contexts.VariantContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.rodVariants;
|
||||
import org.broadinstitute.sting.gatk.refdata.RodGeliText;
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
import org.apache.log4j.Logger;
|
||||
import cern.jet.math.Arithmetic;
|
||||
|
||||
|
||||
public abstract class RatioFilter implements VariantExclusionCriterion {
|
||||
|
|
@ -37,14 +36,14 @@ public abstract class RatioFilter implements VariantExclusionCriterion {
|
|||
highThreshold = threshold;
|
||||
}
|
||||
|
||||
protected abstract Pair<Integer, Integer> scoreVariant(char ref, ReadBackedPileup pileup, rodVariants variant);
|
||||
protected abstract Pair<Integer, Integer> scoreVariant(char ref, ReadBackedPileup pileup, RodGeliText variant);
|
||||
protected abstract boolean excludeHetsOnly();
|
||||
|
||||
public boolean useZeroQualityReads() { return false; }
|
||||
|
||||
public void compute(VariantContextWindow contextWindow) {
|
||||
VariantContext context = contextWindow.getContext();
|
||||
rodVariants variant = context.getVariant();
|
||||
RodGeliText variant = context.getVariant();
|
||||
char ref = context.getReferenceContext().getBase();
|
||||
|
||||
ReadBackedPileup pileup = new ReadBackedPileup(ref, context.getAlignmentContext(useZeroQualityReads()));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.filters;
|
||||
|
||||
import org.broadinstitute.sting.gatk.refdata.rodVariants;
|
||||
import org.broadinstitute.sting.gatk.refdata.RodGeliText;
|
||||
import org.broadinstitute.sting.utils.ReadBackedPileup;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
import org.broadinstitute.sting.utils.Pair;
|
||||
|
|
@ -30,7 +30,7 @@ public class VECAlleleBalance extends RatioFilter {
|
|||
* Return the count of bases matching the major (first) and minor (second) alleles as a pair.
|
||||
*
|
||||
*/
|
||||
protected Pair<Integer, Integer> scoreVariant(char ref, ReadBackedPileup pileup, rodVariants variant) {
|
||||
protected Pair<Integer, Integer> scoreVariant(char ref, ReadBackedPileup pileup, RodGeliText variant) {
|
||||
final String genotype = variant.getBestGenotype();
|
||||
final String bases = pileup.getBases();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package org.broadinstitute.sting.gatk.walkers.filters;
|
|||
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.VariantContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.rodVariants;
|
||||
import org.broadinstitute.sting.gatk.refdata.RodGeliText;
|
||||
import org.broadinstitute.sting.utils.BaseUtils;
|
||||
import net.sf.samtools.SAMRecord;
|
||||
import cern.jet.math.Arithmetic;
|
||||
|
|
@ -23,7 +23,7 @@ public class VECFisherStrand implements VariantExclusionCriterion {
|
|||
|
||||
public void compute(VariantContextWindow contextWindow) {
|
||||
VariantContext context = contextWindow.getContext();
|
||||
rodVariants variant = context.getVariant();
|
||||
RodGeliText variant = context.getVariant();
|
||||
int allele1 = BaseUtils.simpleBaseToBaseIndex(variant.getBestGenotype().charAt(0));
|
||||
int allele2 = BaseUtils.simpleBaseToBaseIndex(variant.getBestGenotype().charAt(1));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.filters;
|
||||
|
||||
import org.broadinstitute.sting.gatk.refdata.rodVariants;
|
||||
import org.broadinstitute.sting.gatk.refdata.RodGeliText;
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
|
||||
public class VECOnOffGenotypeRatio extends RatioFilter {
|
||||
|
|
@ -26,7 +26,7 @@ public class VECOnOffGenotypeRatio extends RatioFilter {
|
|||
* best genotype). On are in the first field, off in the second.
|
||||
*
|
||||
*/
|
||||
protected Pair<Integer, Integer> scoreVariant(char ref, ReadBackedPileup pileup, rodVariants variant) {
|
||||
protected Pair<Integer, Integer> scoreVariant(char ref, ReadBackedPileup pileup, RodGeliText variant) {
|
||||
final String genotype = variant.getBestGenotype().toUpperCase();
|
||||
final String bases = pileup.getBases();
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import java.util.*;
|
|||
* The former modifiesthe likelihoods of each genotype, while the latter makes a decision to include or exclude a
|
||||
* variant outright. At the moment, the variants are expected to be in gelitext format.
|
||||
*/
|
||||
@Requires(value={DataSource.READS, DataSource.REFERENCE},referenceMetaData=@RMD(name="variant",type=rodVariants.class))
|
||||
@Requires(value={DataSource.READS, DataSource.REFERENCE},referenceMetaData=@RMD(name="variant",type= RodGeliText.class))
|
||||
public class VariantFiltrationWalker extends LocusWalker<Integer, Integer> {
|
||||
@Argument(fullName="variants_out_head", shortName="VOH", doc="File to which modified variants should be written") public String VARIANTS_OUT_HEAD;
|
||||
@Argument(fullName="features", shortName="F", doc="Feature test (optionally with arguments) to apply to genotype posteriors. Syntax: 'testname[:arguments]'", required=false) public String[] FEATURES;
|
||||
|
|
@ -176,7 +176,7 @@ public class VariantFiltrationWalker extends LocusWalker<Integer, Integer> {
|
|||
* @return 1 if the locus was successfully processed, 0 if otherwise
|
||||
*/
|
||||
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
rodVariants variant = (rodVariants) tracker.lookup("variant", null);
|
||||
RodGeliText variant = (RodGeliText) tracker.lookup("variant", null);
|
||||
|
||||
// Ignore places where we don't have a variant or where the reference base is ambiguous.
|
||||
if ( variant == null || BaseUtils.simpleBaseToBaseIndex(ref.getBase()) == -1 )
|
||||
|
|
@ -204,7 +204,7 @@ public class VariantFiltrationWalker extends LocusWalker<Integer, Integer> {
|
|||
VariantContext context = variantContextWindow.getContext();
|
||||
if ( context == null )
|
||||
return;
|
||||
rodVariants variant = context.getVariant();
|
||||
RodGeliText variant = context.getVariant();
|
||||
|
||||
HashMap<String, Double> exclusionResults = new HashMap<String, Double>();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package org.broadinstitute.sting.gatk.walkers.genotyper;
|
|||
|
||||
import net.sf.samtools.SAMRecord;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.MathUtils;
|
||||
import org.broadinstitute.sting.utils.ReadBackedPileup;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
import org.broadinstitute.sting.utils.genotype.*;
|
||||
|
|
@ -129,7 +128,7 @@ public class SSGenotypeCall implements Genotype, ReadBacked, GenotypesBacked, Li
|
|||
mCompareTo = DiploidGenotype.valueOf(Utils.dupString(this.getReference(),2));
|
||||
} else {
|
||||
Integer sorted[] = Utils.SortPermutation(mGenotypeLikelihoods.getPosteriors());
|
||||
mCompareTo = DiploidGenotype.values()[sorted[DiploidGenotype.values().length - 1]];
|
||||
mCompareTo = DiploidGenotype.values()[sorted[DiploidGenotype.values().length - 2]];
|
||||
}
|
||||
}
|
||||
return mCompareTo;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import net.sf.samtools.SAMRecord;
|
|||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.refdata.rodGFF;
|
||||
import org.broadinstitute.sting.gatk.refdata.RodGenotypeChipAsGFF;
|
||||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||
import org.broadinstitute.sting.gatk.walkers.genotyper.SSGenotypeCall;
|
||||
import org.broadinstitute.sting.gatk.walkers.genotyper.SingleSampleGenotyper;
|
||||
|
|
@ -52,7 +52,7 @@ public class CoverageEvalWalker extends LocusWalker<List<String>, String> {
|
|||
|
||||
public List<String> map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
|
||||
rodGFF hapmap_chip = (rodGFF)tracker.lookup("hapmap-chip", null);
|
||||
RodGenotypeChipAsGFF hapmap_chip = (RodGenotypeChipAsGFF)tracker.lookup("hapmap-chip", null);
|
||||
String hc_genotype;
|
||||
|
||||
if (hapmap_chip != null) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class VCFHeader {
|
|||
*
|
||||
* @param metaData the meta data associated with this header
|
||||
*/
|
||||
protected VCFHeader(Map<String, String> metaData) {
|
||||
public VCFHeader(Map<String, String> metaData) {
|
||||
for (String key : metaData.keySet()) mMetaData.put(key, metaData.get(key));
|
||||
checkVCFVersion();
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ public class VCFHeader {
|
|||
* @param metaData the meta data associated with this header
|
||||
* @param genotypeSampleNames the genotype format field, and the sample names
|
||||
*/
|
||||
protected VCFHeader(Map<String, String> metaData, List<String> genotypeSampleNames) {
|
||||
public VCFHeader(Map<String, String> metaData, List<String> genotypeSampleNames) {
|
||||
for (String key : metaData.keySet()) mMetaData.put(key, metaData.get(key));
|
||||
for (String col : genotypeSampleNames) {
|
||||
if (!col.equals("FORMAT"))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,115 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.genotyper;
|
||||
|
||||
import net.sf.samtools.SAMFileHeader;
|
||||
import net.sf.samtools.SAMRecord;
|
||||
import org.broadinstitute.sting.BaseTest;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
import org.broadinstitute.sting.utils.Pair;
|
||||
import org.broadinstitute.sting.utils.ReadBackedPileup;
|
||||
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author aaron
|
||||
* <p/>
|
||||
* Class SSGenotypeCallTest
|
||||
* <p/>
|
||||
* test the SS Genotype call class
|
||||
*/
|
||||
public class SSGenotypeCallTest extends BaseTest {
|
||||
|
||||
// we need a fake GenotypeLikelihoods class
|
||||
public class GenotypeLikelihoodsImpl extends GenotypeLikelihoods {
|
||||
|
||||
/**
|
||||
* Must be overridden by concrete subclasses
|
||||
*
|
||||
* @param observedBase
|
||||
* @param chromBase
|
||||
* @param read
|
||||
* @param offset
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected double log10PofTrueBaseGivenMiscall(char observedBase, char chromBase, SAMRecord read, int offset) {
|
||||
return 0; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
public GenotypeLikelihoodsImpl() {
|
||||
this.posteriors = new double[10];
|
||||
for (int x = 0; x < 10; x++) {
|
||||
posteriors[x] = -(x);
|
||||
}
|
||||
this.likelihoods = new double[10];
|
||||
for (int x = 0; x < 10; x++) {
|
||||
likelihoods[x] = -(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// make a fake read pile-up
|
||||
public Pair<ReadBackedPileup, GenomeLoc> makePileup() {
|
||||
List<SAMRecord> reads = new ArrayList<SAMRecord>();
|
||||
List<Integer> offset = new ArrayList<Integer>();
|
||||
SAMFileHeader header = ArtificialSAMUtils.createArtificialSamHeader(1, 1, 10000);
|
||||
for (int x = 0; x < 10; x++) {
|
||||
reads.add(ArtificialSAMUtils.createArtificialRead(header, "test", 0, 1, 100));
|
||||
offset.add(10 - x);
|
||||
}
|
||||
GenomeLocParser.setupRefContigOrdering(header.getSequenceDictionary());
|
||||
GenomeLoc loc = GenomeLocParser.createGenomeLoc("chr1", 1, 10);
|
||||
return new Pair(new ReadBackedPileup(loc, 'A', reads, offset), loc);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testBestVrsRefSame() {
|
||||
Pair<ReadBackedPileup, GenomeLoc> myPair = makePileup();
|
||||
SSGenotypeCall call = new SSGenotypeCall(true, myPair.second, 'A', new GenotypeLikelihoodsImpl(), myPair.first);
|
||||
Assert.assertEquals(0, call.getNegLog10PError(), 0.0000001);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBestVrsRef2() {
|
||||
Pair<ReadBackedPileup, GenomeLoc> myPair = makePileup();
|
||||
SSGenotypeCall call2 = new SSGenotypeCall(true, myPair.second, 'T', new GenotypeLikelihoodsImpl(), myPair.first);
|
||||
Assert.assertEquals(9, call2.getNegLog10PError(), 0.0000001);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBestVrsRef3() {
|
||||
Pair<ReadBackedPileup, GenomeLoc> myPair = makePileup();
|
||||
SSGenotypeCall call3 = new SSGenotypeCall(true, myPair.second, 'C', new GenotypeLikelihoodsImpl(), myPair.first);
|
||||
Assert.assertEquals(4, call3.getNegLog10PError(), 0.0000001);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testBestVrsNextSame() {
|
||||
Pair<ReadBackedPileup, GenomeLoc> myPair = makePileup();
|
||||
SSGenotypeCall call = new SSGenotypeCall(false, myPair.second, 'A', new GenotypeLikelihoodsImpl(), myPair.first);
|
||||
Assert.assertEquals(1, call.getNegLog10PError(), 0.0000001);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBestVrsNext2() {
|
||||
Pair<ReadBackedPileup, GenomeLoc> myPair = makePileup();
|
||||
SSGenotypeCall call2 = new SSGenotypeCall(false, myPair.second, 'A', new GenotypeLikelihoodsImpl(), myPair.first);
|
||||
Assert.assertEquals(1, call2.getNegLog10PError(), 0.0000001);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBestVrsNext3() {
|
||||
Pair<ReadBackedPileup, GenomeLoc> myPair = makePileup();
|
||||
SSGenotypeCall call3 = new SSGenotypeCall(false, myPair.second, 'C', new GenotypeLikelihoodsImpl(), myPair.first);
|
||||
Assert.assertEquals(1, call3.getNegLog10PError(), 0.0000001);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue