Change interface to getNegLog10PError to getLog10PError
This commit is contained in:
parent
c7f2d5c7c7
commit
6cf315e17b
|
|
@ -9,7 +9,6 @@ import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
||||||
import org.broadinstitute.sting.utils.codecs.hapmap.RawHapMapFeature;
|
import org.broadinstitute.sting.utils.codecs.hapmap.RawHapMapFeature;
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
|
|
||||||
import org.broadinstitute.sting.utils.variantcontext.*;
|
import org.broadinstitute.sting.utils.variantcontext.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -193,9 +192,12 @@ public class VariantContextAdaptors {
|
||||||
return null; // we weren't given enough reference context to create the VariantContext
|
return null; // we weren't given enough reference context to create the VariantContext
|
||||||
Byte refBaseForIndel = new Byte(ref.getBases()[index]);
|
Byte refBaseForIndel = new Byte(ref.getBases()[index]);
|
||||||
|
|
||||||
GenotypesContext genotypes = null;
|
final VariantContextBuilder builder = new VariantContextBuilder();
|
||||||
VariantContext vc = new VariantContext(name, dbsnp.getRsID(), dbsnp.getChr(), dbsnp.getStart() - (sawNullAllele ? 1 : 0), dbsnp.getEnd() - (refAllele.isNull() ? 1 : 0), alleles, genotypes, VariantContext.NO_NEG_LOG_10PERROR, null, attributes, refBaseForIndel);
|
builder.source(name).id(dbsnp.getRsID());
|
||||||
return vc;
|
builder.loc(dbsnp.getChr(), dbsnp.getStart() - (sawNullAllele ? 1 : 0), dbsnp.getEnd() - (refAllele.isNull() ? 1 : 0));
|
||||||
|
builder.alleles(alleles);
|
||||||
|
builder.referenceBaseForIndel(refBaseForIndel);
|
||||||
|
return builder.make();
|
||||||
} else
|
} else
|
||||||
return null; // can't handle anything else
|
return null; // can't handle anything else
|
||||||
}
|
}
|
||||||
|
|
@ -255,7 +257,7 @@ public class VariantContextAdaptors {
|
||||||
genotypes.add(call);
|
genotypes.add(call);
|
||||||
alleles.add(refAllele);
|
alleles.add(refAllele);
|
||||||
GenomeLoc loc = ref.getGenomeLocParser().createGenomeLoc(geli.getChr(),geli.getStart());
|
GenomeLoc loc = ref.getGenomeLocParser().createGenomeLoc(geli.getChr(),geli.getStart());
|
||||||
return new VariantContextBuilder(name, loc.getContig(), loc.getStart(), loc.getStop(), alleles).genotypes(genotypes).negLog10PError(geli.getLODBestToReference()).attributes(attributes).make();
|
return new VariantContextBuilder(name, loc.getContig(), loc.getStart(), loc.getStop(), alleles).genotypes(genotypes).log10PError(-1 * geli.getLODBestToReference()).attributes(attributes).make();
|
||||||
} else
|
} else
|
||||||
return null; // can't handle anything else
|
return null; // can't handle anything else
|
||||||
}
|
}
|
||||||
|
|
@ -349,7 +351,7 @@ public class VariantContextAdaptors {
|
||||||
long end = hapmap.getEnd();
|
long end = hapmap.getEnd();
|
||||||
if ( deletionLength > 0 )
|
if ( deletionLength > 0 )
|
||||||
end += deletionLength;
|
end += deletionLength;
|
||||||
VariantContext vc = new VariantContext(name, hapmap.getName(), hapmap.getChr(), hapmap.getStart(), end, alleles, genotypes, VariantContext.NO_NEG_LOG_10PERROR, null, null, refBaseForIndel);
|
VariantContext vc = new VariantContextBuilder(name, hapmap.getChr(), hapmap.getStart(), end, alleles).id(hapmap.getName()).genotypes(genotypes).referenceBaseForIndel(refBaseForIndel).make();
|
||||||
return vc;
|
return vc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,8 +85,8 @@ public class AlleleBalance extends InfoFieldAnnotation {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// weight the allele balance by genotype quality so that e.g. mis-called homs don't affect the ratio too much
|
// weight the allele balance by genotype quality so that e.g. mis-called homs don't affect the ratio too much
|
||||||
ratio += genotype.getNegLog10PError() * ((double)refCount / (double)(refCount + altCount));
|
ratio += genotype.getLog10PError() * ((double)refCount / (double)(refCount + altCount));
|
||||||
totalWeights += genotype.getNegLog10PError();
|
totalWeights += genotype.getLog10PError();
|
||||||
} else if ( vc.isIndel() && context.hasExtendedEventPileup() ) {
|
} else if ( vc.isIndel() && context.hasExtendedEventPileup() ) {
|
||||||
final ReadBackedExtendedEventPileup indelPileup = context.getExtendedEventPileup();
|
final ReadBackedExtendedEventPileup indelPileup = context.getExtendedEventPileup();
|
||||||
if ( indelPileup == null ) {
|
if ( indelPileup == null ) {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public class HardyWeinberg extends InfoFieldAnnotation implements WorkInProgress
|
||||||
|
|
||||||
private static final int MIN_SAMPLES = 10;
|
private static final int MIN_SAMPLES = 10;
|
||||||
private static final int MIN_GENOTYPE_QUALITY = 10;
|
private static final int MIN_GENOTYPE_QUALITY = 10;
|
||||||
private static final int MIN_NEG_LOG10_PERROR = MIN_GENOTYPE_QUALITY / 10;
|
private static final int MIN_LOG10_PERROR = MIN_GENOTYPE_QUALITY / 10;
|
||||||
|
|
||||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, AnnotatorCompatibleWalker walker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
|
public Map<String, Object> annotate(RefMetaDataTracker tracker, AnnotatorCompatibleWalker walker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class HardyWeinberg extends InfoFieldAnnotation implements WorkInProgress
|
||||||
// Right now we just ignore genotypes that are not confident, but this throws off
|
// Right now we just ignore genotypes that are not confident, but this throws off
|
||||||
// our HW ratios. More analysis is needed to determine the right thing to do when
|
// our HW ratios. More analysis is needed to determine the right thing to do when
|
||||||
// the genotyper cannot decide whether a given sample is het or hom var.
|
// the genotyper cannot decide whether a given sample is het or hom var.
|
||||||
if ( g.getNegLog10PError() < MIN_NEG_LOG10_PERROR )
|
if ( g.getLog10PError() > MIN_LOG10_PERROR )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ( g.isHomRef() )
|
if ( g.isHomRef() )
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ public class QualByDepth extends InfoFieldAnnotation implements StandardAnnotati
|
||||||
if ( depth == 0 )
|
if ( depth == 0 )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
double QD = 10.0 * vc.getNegLog10PError() / (double)depth;
|
double QD = -10.0 * vc.getLog10PError() / (double)depth;
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put(getKeyNames().get(0), String.format("%.2f", QD));
|
map.put(getKeyNames().get(0), String.format("%.2f", QD));
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ public class VariantAnnotatorEngine {
|
||||||
if ( result != null )
|
if ( result != null )
|
||||||
genotypeAnnotations.putAll(result);
|
genotypeAnnotations.putAll(result);
|
||||||
}
|
}
|
||||||
genotypes.add(new Genotype(genotype.getSampleName(), genotype.getAlleles(), genotype.getNegLog10PError(), genotype.getFilters(), genotypeAnnotations, genotype.isPhased()));
|
genotypes.add(new Genotype(genotype.getSampleName(), genotype.getAlleles(), genotype.getLog10PError(), genotype.getFilters(), genotypeAnnotations, genotype.isPhased()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return genotypes;
|
return genotypes;
|
||||||
|
|
|
||||||
|
|
@ -331,18 +331,16 @@ public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
|
||||||
genotypes.add(imputedGenotype);
|
genotypes.add(imputedGenotype);
|
||||||
}
|
}
|
||||||
|
|
||||||
VariantContext filteredVC;
|
final VariantContextBuilder builder = new VariantContextBuilder(vc_input).source("outputvcf").genotypes(genotypes);
|
||||||
if ( beagleVarCounts > 0 || DONT_FILTER_MONOMORPHIC_SITES )
|
if ( ! ( beagleVarCounts > 0 || DONT_FILTER_MONOMORPHIC_SITES ) ) {
|
||||||
filteredVC = new VariantContext("outputvcf", vc_input.getID(), vc_input.getChr(), vc_input.getStart(), vc_input.getEnd(), vc_input.getAlleles(), genotypes, vc_input.getNegLog10PError(), vc_input.filtersWereApplied() ? vc_input.getFilters() : null, vc_input.getAttributes());
|
|
||||||
else {
|
|
||||||
Set<String> removedFilters = vc_input.filtersWereApplied() ? new HashSet<String>(vc_input.getFilters()) : new HashSet<String>(1);
|
Set<String> removedFilters = vc_input.filtersWereApplied() ? new HashSet<String>(vc_input.getFilters()) : new HashSet<String>(1);
|
||||||
removedFilters.add(String.format("BGL_RM_WAS_%s",vc_input.getAlternateAllele(0)));
|
removedFilters.add(String.format("BGL_RM_WAS_%s",vc_input.getAlternateAllele(0)));
|
||||||
filteredVC = new VariantContext("outputvcf", vc_input.getID(), vc_input.getChr(), vc_input.getStart(), vc_input.getEnd(), new HashSet<Allele>(Arrays.asList(vc_input.getReference())), genotypes, vc_input.getNegLog10PError(), removedFilters, vc_input.getAttributes());
|
builder.alleles(new HashSet<Allele>(Arrays.asList(vc_input.getReference()))).filters(removedFilters);
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap<String, Object> attributes = new HashMap<String, Object>(filteredVC.getAttributes());
|
HashMap<String, Object> attributes = new HashMap<String, Object>(vc_input.getAttributes());
|
||||||
// re-compute chromosome counts
|
// re-compute chromosome counts
|
||||||
VariantContextUtils.calculateChromosomeCounts(filteredVC, attributes, false);
|
VariantContextUtils.calculateChromosomeCounts(vc_input, attributes, false);
|
||||||
|
|
||||||
// Get Hapmap AC and AF
|
// Get Hapmap AC and AF
|
||||||
if (vc_comp != null) {
|
if (vc_comp != null) {
|
||||||
|
|
@ -356,13 +354,11 @@ public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
|
||||||
if( !beagleR2Feature.getR2value().equals(Double.NaN) ) {
|
if( !beagleR2Feature.getR2value().equals(Double.NaN) ) {
|
||||||
attributes.put("R2", beagleR2Feature.getR2value().toString() );
|
attributes.put("R2", beagleR2Feature.getR2value().toString() );
|
||||||
}
|
}
|
||||||
|
builder.attributes(attributes);
|
||||||
|
|
||||||
|
vcfWriter.add(builder.make());
|
||||||
vcfWriter.add(new VariantContextBuilder(filteredVC).attributes(attributes).make());
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer reduceInit() {
|
public Integer reduceInit() {
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ public class VCFDiffableReader implements DiffableReader {
|
||||||
vcRoot.add("ID", vc.getID());
|
vcRoot.add("ID", vc.getID());
|
||||||
vcRoot.add("REF", vc.getReference());
|
vcRoot.add("REF", vc.getReference());
|
||||||
vcRoot.add("ALT", vc.getAlternateAlleles());
|
vcRoot.add("ALT", vc.getAlternateAlleles());
|
||||||
vcRoot.add("QUAL", vc.hasNegLog10PError() ? vc.getNegLog10PError() * 10 : VCFConstants.MISSING_VALUE_v4);
|
vcRoot.add("QUAL", vc.hasLog10PError() ? vc.getLog10PError() * -10 : VCFConstants.MISSING_VALUE_v4);
|
||||||
vcRoot.add("FILTER", vc.getFilters());
|
vcRoot.add("FILTER", vc.getFilters());
|
||||||
|
|
||||||
// add info fields
|
// add info fields
|
||||||
|
|
@ -111,7 +111,7 @@ public class VCFDiffableReader implements DiffableReader {
|
||||||
for (Genotype g : vc.getGenotypes() ) {
|
for (Genotype g : vc.getGenotypes() ) {
|
||||||
DiffNode gRoot = DiffNode.empty(g.getSampleName(), vcRoot);
|
DiffNode gRoot = DiffNode.empty(g.getSampleName(), vcRoot);
|
||||||
gRoot.add("GT", g.getGenotypeString());
|
gRoot.add("GT", g.getGenotypeString());
|
||||||
gRoot.add("GQ", g.hasNegLog10PError() ? g.getNegLog10PError() * 10 : VCFConstants.MISSING_VALUE_v4 );
|
gRoot.add("GQ", g.hasLog10PError() ? g.getLog10PError() * -10 : VCFConstants.MISSING_VALUE_v4 );
|
||||||
|
|
||||||
for (Map.Entry<String, Object> attribute : g.getAttributes().entrySet()) {
|
for (Map.Entry<String, Object> attribute : g.getAttributes().entrySet()) {
|
||||||
if ( ! attribute.getKey().startsWith("_") )
|
if ( ! attribute.getKey().startsWith("_") )
|
||||||
|
|
|
||||||
|
|
@ -277,14 +277,12 @@ public class VariantFiltrationWalker extends RodWalker<Integer, Integer> {
|
||||||
if ( context == null )
|
if ( context == null )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VariantContext vc = context.getVariantContext();
|
final VariantContext vc = context.getVariantContext();
|
||||||
|
final VariantContextBuilder builder = new VariantContextBuilder(vc);
|
||||||
|
|
||||||
// make new Genotypes based on filters
|
// make new Genotypes based on filters
|
||||||
GenotypesContext genotypes;
|
if ( genotypeFilterExps.size() > 0 ) {
|
||||||
if ( genotypeFilterExps.size() == 0 ) {
|
GenotypesContext genotypes = GenotypesContext.create(vc.getGenotypes().size());
|
||||||
genotypes = null;
|
|
||||||
} else {
|
|
||||||
genotypes = GenotypesContext.create(vc.getGenotypes().size());
|
|
||||||
|
|
||||||
// for each genotype, check filters then create a new object
|
// for each genotype, check filters then create a new object
|
||||||
for ( final Genotype g : vc.getGenotypes() ) {
|
for ( final Genotype g : vc.getGenotypes() ) {
|
||||||
|
|
@ -295,11 +293,13 @@ public class VariantFiltrationWalker extends RodWalker<Integer, Integer> {
|
||||||
if ( VariantContextUtils.match(vc, g, exp) )
|
if ( VariantContextUtils.match(vc, g, exp) )
|
||||||
filters.add(exp.name);
|
filters.add(exp.name);
|
||||||
}
|
}
|
||||||
genotypes.add(new Genotype(g.getSampleName(), g.getAlleles(), g.getNegLog10PError(), filters, g.getAttributes(), g.isPhased()));
|
genotypes.add(new Genotype(g.getSampleName(), g.getAlleles(), g.getLog10PError(), filters, g.getAttributes(), g.isPhased()));
|
||||||
} else {
|
} else {
|
||||||
genotypes.add(g);
|
genotypes.add(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
builder.genotypes(genotypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make a new variant context based on filters
|
// make a new variant context based on filters
|
||||||
|
|
@ -319,14 +319,9 @@ public class VariantFiltrationWalker extends RodWalker<Integer, Integer> {
|
||||||
filters.add(exp.name);
|
filters.add(exp.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
builder.filters(filters);
|
||||||
|
|
||||||
VariantContext filteredVC;
|
writer.add(builder.make());
|
||||||
if ( genotypes == null )
|
|
||||||
filteredVC = new VariantContextBuilder(vc).filters(filters).make();
|
|
||||||
else
|
|
||||||
filteredVC = new VariantContext(vc.getSource(), vc.getID(), vc.getChr(), vc.getStart(), vc.getEnd(), vc.getAlleles(), genotypes, vc.getNegLog10PError(), filters, vc.getAttributes());
|
|
||||||
|
|
||||||
writer.add(filteredVC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer reduce(Integer value, Integer sum) {
|
public Integer reduce(Integer value, Integer sum) {
|
||||||
|
|
|
||||||
|
|
@ -431,7 +431,7 @@ public class ExactAFCalculationModel extends AlleleFrequencyCalculationModel {
|
||||||
|
|
||||||
ArrayList<Allele> myAlleles = new ArrayList<Allele>();
|
ArrayList<Allele> myAlleles = new ArrayList<Allele>();
|
||||||
|
|
||||||
double qual = Genotype.NO_NEG_LOG_10PERROR;
|
double qual = Genotype.NO_LOG10_PERROR;
|
||||||
myAlleles.add(Allele.NO_CALL);
|
myAlleles.add(Allele.NO_CALL);
|
||||||
myAlleles.add(Allele.NO_CALL);
|
myAlleles.add(Allele.NO_CALL);
|
||||||
//System.out.println(myAlleles.toString());
|
//System.out.println(myAlleles.toString());
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,8 @@ public class UGCallVariants extends RodWalker<VariantCallContext, Integer> {
|
||||||
VariantContext vc = VCs.get(0);
|
VariantContext vc = VCs.get(0);
|
||||||
throw new UserException("There is no ALT allele in any of the VCF records passed in at " + vc.getChr() + ":" + vc.getStart());
|
throw new UserException("There is no ALT allele in any of the VCF records passed in at " + vc.getChr() + ":" + vc.getStart());
|
||||||
}
|
}
|
||||||
return new VariantContext("VCwithGLs", VCFConstants.EMPTY_ID_FIELD, variantVC.getChr(), variantVC.getStart(), variantVC.getEnd(), variantVC.getAlleles(), genotypes, VariantContext.NO_NEG_LOG_10PERROR, null, null);
|
|
||||||
|
return new VariantContextBuilder(variantVC).source("VCwithGLs").genotypes(genotypes).make();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GenotypesContext getGenotypesWithGLs(GenotypesContext genotypes) {
|
private static GenotypesContext getGenotypesWithGLs(GenotypesContext genotypes) {
|
||||||
|
|
|
||||||
|
|
@ -280,22 +280,13 @@ public class UnifiedGenotyperEngine {
|
||||||
attributes.put(VCFConstants.DEPTH_KEY, GL.getDepth());
|
attributes.put(VCFConstants.DEPTH_KEY, GL.getDepth());
|
||||||
attributes.put(VCFConstants.PHRED_GENOTYPE_LIKELIHOODS_KEY, likelihoods);
|
attributes.put(VCFConstants.PHRED_GENOTYPE_LIKELIHOODS_KEY, likelihoods);
|
||||||
|
|
||||||
genotypes.add(new Genotype(GL.getSample(), noCall, Genotype.NO_NEG_LOG_10PERROR, null, attributes, false));
|
genotypes.add(new Genotype(GL.getSample(), noCall, Genotype.NO_LOG10_PERROR, null, attributes, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
GenomeLoc loc = refContext.getLocus();
|
GenomeLoc loc = refContext.getLocus();
|
||||||
int endLoc = calculateEndPos(alleles, refAllele, loc);
|
int endLoc = calculateEndPos(alleles, refAllele, loc);
|
||||||
|
|
||||||
return new VariantContext("UG_call",
|
return new VariantContextBuilder("UG_call", loc.getContig(), loc.getStart(), endLoc, alleles).genotypes(genotypes).referenceBaseForIndel(refContext.getBase()).make();
|
||||||
VCFConstants.EMPTY_ID_FIELD, loc.getContig(),
|
|
||||||
loc.getStart(),
|
|
||||||
endLoc,
|
|
||||||
alleles,
|
|
||||||
genotypes,
|
|
||||||
VariantContext.NO_NEG_LOG_10PERROR,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
refContext.getBase());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private method called by both UnifiedGenotyper and UGCallVariants entry points into the engine
|
// private method called by both UnifiedGenotyper and UGCallVariants entry points into the engine
|
||||||
|
|
@ -419,8 +410,14 @@ public class UnifiedGenotyperEngine {
|
||||||
myAlleles = new HashSet<Allele>(1);
|
myAlleles = new HashSet<Allele>(1);
|
||||||
myAlleles.add(vc.getReference());
|
myAlleles.add(vc.getReference());
|
||||||
}
|
}
|
||||||
VariantContext vcCall = new VariantContext("UG_call", VCFConstants.EMPTY_ID_FIELD, loc.getContig(), loc.getStart(), endLoc,
|
|
||||||
myAlleles, genotypes, phredScaledConfidence/10.0, passesCallThreshold(phredScaledConfidence) ? null : filter, attributes, refContext.getBase());
|
VariantContextBuilder builder = new VariantContextBuilder("UG_call", loc.getContig(), loc.getStart(), endLoc, myAlleles);
|
||||||
|
builder.genotypes(genotypes);
|
||||||
|
builder.log10PError(phredScaledConfidence/-10.0);
|
||||||
|
if ( ! passesCallThreshold(phredScaledConfidence) ) builder.filters(filter);
|
||||||
|
builder.attributes(attributes);
|
||||||
|
builder.referenceBaseForIndel(refContext.getBase());
|
||||||
|
VariantContext vcCall = builder.make();
|
||||||
|
|
||||||
if ( annotationEngine != null ) {
|
if ( annotationEngine != null ) {
|
||||||
// Note: we want to use the *unfiltered* and *unBAQed* context for the annotations
|
// Note: we want to use the *unfiltered* and *unBAQed* context for the annotations
|
||||||
|
|
@ -503,10 +500,15 @@ public class UnifiedGenotyperEngine {
|
||||||
myAlleles = new HashSet<Allele>(1);
|
myAlleles = new HashSet<Allele>(1);
|
||||||
myAlleles.add(vc.getReference());
|
myAlleles.add(vc.getReference());
|
||||||
}
|
}
|
||||||
VariantContext vcCall = new VariantContext("UG_call", VCFConstants.EMPTY_ID_FIELD, loc.getContig(), loc.getStart(), endLoc,
|
|
||||||
myAlleles, genotypes, phredScaledConfidence/10.0, passesCallThreshold(phredScaledConfidence) ? null : filter, attributes, vc.getReferenceBaseForIndel());
|
|
||||||
|
|
||||||
return new VariantCallContext(vcCall, confidentlyCalled(phredScaledConfidence, PofF));
|
VariantContextBuilder builder = new VariantContextBuilder("UG_call", loc.getContig(), loc.getStart(), endLoc, myAlleles);
|
||||||
|
builder.genotypes(genotypes);
|
||||||
|
builder.log10PError(phredScaledConfidence/-10.0);
|
||||||
|
if ( ! passesCallThreshold(phredScaledConfidence) ) builder.filters(filter);
|
||||||
|
builder.attributes(attributes);
|
||||||
|
builder.referenceBaseForIndel(vc.getReferenceBaseForIndel());
|
||||||
|
|
||||||
|
return new VariantCallContext(builder.make(), confidentlyCalled(phredScaledConfidence, PofF));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int calculateEndPos(Collection<Allele> alleles, Allele refAllele, GenomeLoc loc) {
|
private int calculateEndPos(Collection<Allele> alleles, Allele refAllele, GenomeLoc loc) {
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,7 @@ import org.broadinstitute.sting.utils.interval.IntervalUtils;
|
||||||
import org.broadinstitute.sting.utils.interval.OverlappingIntervalIterator;
|
import org.broadinstitute.sting.utils.interval.OverlappingIntervalIterator;
|
||||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
import org.broadinstitute.sting.utils.variantcontext.*;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
|
||||||
import org.broadinstitute.sting.utils.variantcontext.GenotypesContext;
|
|
||||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -1064,9 +1061,9 @@ public class SomaticIndelDetectorWalker extends ReadWalker<Integer,Integer> {
|
||||||
Map<String,Object> attrs = call.makeStatsAttributes(null);
|
Map<String,Object> attrs = call.makeStatsAttributes(null);
|
||||||
|
|
||||||
if ( call.isCall() ) // we made a call - put actual het genotype here:
|
if ( call.isCall() ) // we made a call - put actual het genotype here:
|
||||||
genotypes.add(new Genotype(sample,alleles,Genotype.NO_NEG_LOG_10PERROR,null,attrs,false));
|
genotypes.add(new Genotype(sample,alleles,Genotype.NO_LOG10_PERROR,null,attrs,false));
|
||||||
else // no call: genotype is ref/ref (but alleles still contain the alt if we observed anything at all)
|
else // no call: genotype is ref/ref (but alleles still contain the alt if we observed anything at all)
|
||||||
genotypes.add(new Genotype(sample, homref_alleles,Genotype.NO_NEG_LOG_10PERROR,null,attrs,false));
|
genotypes.add(new Genotype(sample, homref_alleles,Genotype.NO_LOG10_PERROR,null,attrs,false));
|
||||||
|
|
||||||
}
|
}
|
||||||
Set<String> filters = null;
|
Set<String> filters = null;
|
||||||
|
|
@ -1074,8 +1071,8 @@ public class SomaticIndelDetectorWalker extends ReadWalker<Integer,Integer> {
|
||||||
filters = new HashSet<String>();
|
filters = new HashSet<String>();
|
||||||
filters.add("NoCall");
|
filters.add("NoCall");
|
||||||
}
|
}
|
||||||
VariantContext vc = new VariantContext("IGv2_Indel_call", VCFConstants.EMPTY_ID_FIELD, refName, start, stop, alleles, genotypes,
|
VariantContext vc = new VariantContextBuilder("IGv2_Indel_call", refName, start, stop, alleles)
|
||||||
-1.0 /* log error */, filters, null, refBases[(int)start-1]);
|
.genotypes(genotypes).filters(filters).referenceBaseForIndel(refBases[(int)start-1]).make();
|
||||||
vcf.add(vc);
|
vcf.add(vc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1150,11 +1147,11 @@ public class SomaticIndelDetectorWalker extends ReadWalker<Integer,Integer> {
|
||||||
GenotypesContext genotypes = GenotypesContext.create();
|
GenotypesContext genotypes = GenotypesContext.create();
|
||||||
|
|
||||||
for ( String sample : normalSamples ) {
|
for ( String sample : normalSamples ) {
|
||||||
genotypes.add(new Genotype(sample, homRefN ? homRefAlleles : alleles,Genotype.NO_NEG_LOG_10PERROR,null,attrsNormal,false));
|
genotypes.add(new Genotype(sample, homRefN ? homRefAlleles : alleles,Genotype.NO_LOG10_PERROR,null,attrsNormal,false));
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( String sample : tumorSamples ) {
|
for ( String sample : tumorSamples ) {
|
||||||
genotypes.add(new Genotype(sample, homRefT ? homRefAlleles : alleles,Genotype.NO_NEG_LOG_10PERROR,null,attrsTumor,false) );
|
genotypes.add(new Genotype(sample, homRefT ? homRefAlleles : alleles,Genotype.NO_LOG10_PERROR,null,attrsTumor,false) );
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> filters = null;
|
Set<String> filters = null;
|
||||||
|
|
@ -1171,8 +1168,8 @@ public class SomaticIndelDetectorWalker extends ReadWalker<Integer,Integer> {
|
||||||
filters.add("TCov");
|
filters.add("TCov");
|
||||||
}
|
}
|
||||||
|
|
||||||
VariantContext vc = new VariantContext("IGv2_Indel_call", VCFConstants.EMPTY_ID_FIELD, refName, start, stop, alleles, genotypes,
|
VariantContext vc = new VariantContextBuilder("IGv2_Indel_call", refName, start, stop, alleles)
|
||||||
-1.0 /* log error */, filters, attrs, refBases[(int)start-1]);
|
.genotypes(genotypes).filters(filters).attributes(attrs).referenceBaseForIndel(refBases[(int)start-1]).make();
|
||||||
vcf.add(vc);
|
vcf.add(vc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -132,17 +132,17 @@ public class PhaseByTransmission extends RodWalker<Integer, Integer> {
|
||||||
List<Allele> homRefAlleles = new ArrayList<Allele>();
|
List<Allele> homRefAlleles = new ArrayList<Allele>();
|
||||||
homRefAlleles.add(refAllele);
|
homRefAlleles.add(refAllele);
|
||||||
homRefAlleles.add(refAllele);
|
homRefAlleles.add(refAllele);
|
||||||
Genotype homRef = new Genotype(g.getSampleName(), homRefAlleles, g.getNegLog10PError(), null, g.getAttributes(), false);
|
Genotype homRef = new Genotype(g.getSampleName(), homRefAlleles, g.getLog10PError(), null, g.getAttributes(), false);
|
||||||
|
|
||||||
List<Allele> hetAlleles = new ArrayList<Allele>();
|
List<Allele> hetAlleles = new ArrayList<Allele>();
|
||||||
hetAlleles.add(refAllele);
|
hetAlleles.add(refAllele);
|
||||||
hetAlleles.add(altAllele);
|
hetAlleles.add(altAllele);
|
||||||
Genotype het = new Genotype(g.getSampleName(), hetAlleles, g.getNegLog10PError(), null, g.getAttributes(), false);
|
Genotype het = new Genotype(g.getSampleName(), hetAlleles, g.getLog10PError(), null, g.getAttributes(), false);
|
||||||
|
|
||||||
List<Allele> homVarAlleles = new ArrayList<Allele>();
|
List<Allele> homVarAlleles = new ArrayList<Allele>();
|
||||||
homVarAlleles.add(altAllele);
|
homVarAlleles.add(altAllele);
|
||||||
homVarAlleles.add(altAllele);
|
homVarAlleles.add(altAllele);
|
||||||
Genotype homVar = new Genotype(g.getSampleName(), homVarAlleles, g.getNegLog10PError(), null, g.getAttributes(), false);
|
Genotype homVar = new Genotype(g.getSampleName(), homVarAlleles, g.getLog10PError(), null, g.getAttributes(), false);
|
||||||
|
|
||||||
ArrayList<Genotype> genotypes = new ArrayList<Genotype>();
|
ArrayList<Genotype> genotypes = new ArrayList<Genotype>();
|
||||||
genotypes.add(homRef);
|
genotypes.add(homRef);
|
||||||
|
|
@ -187,7 +187,7 @@ public class PhaseByTransmission extends RodWalker<Integer, Integer> {
|
||||||
possiblePhasedChildAlleles.add(momAllele);
|
possiblePhasedChildAlleles.add(momAllele);
|
||||||
possiblePhasedChildAlleles.add(dadAllele);
|
possiblePhasedChildAlleles.add(dadAllele);
|
||||||
|
|
||||||
Genotype possiblePhasedChildGenotype = new Genotype(child.getSampleName(), possiblePhasedChildAlleles, child.getNegLog10PError(), child.getFilters(), child.getAttributes(), true);
|
Genotype possiblePhasedChildGenotype = new Genotype(child.getSampleName(), possiblePhasedChildAlleles, child.getLog10PError(), child.getFilters(), child.getAttributes(), true);
|
||||||
|
|
||||||
possiblePhasedChildGenotypes.add(possiblePhasedChildGenotype);
|
possiblePhasedChildGenotypes.add(possiblePhasedChildGenotype);
|
||||||
}
|
}
|
||||||
|
|
@ -204,7 +204,7 @@ public class PhaseByTransmission extends RodWalker<Integer, Integer> {
|
||||||
phasedMomAlleles.add(momTransmittedAllele);
|
phasedMomAlleles.add(momTransmittedAllele);
|
||||||
phasedMomAlleles.add(momUntransmittedAllele);
|
phasedMomAlleles.add(momUntransmittedAllele);
|
||||||
|
|
||||||
Genotype phasedMomGenotype = new Genotype(mom.getSampleName(), phasedMomAlleles, mom.getNegLog10PError(), mom.getFilters(), mom.getAttributes(), true);
|
Genotype phasedMomGenotype = new Genotype(mom.getSampleName(), phasedMomAlleles, mom.getLog10PError(), mom.getFilters(), mom.getAttributes(), true);
|
||||||
|
|
||||||
Allele dadTransmittedAllele = phasedChildGenotype.getAllele(1);
|
Allele dadTransmittedAllele = phasedChildGenotype.getAllele(1);
|
||||||
Allele dadUntransmittedAllele = dad.getAllele(0) != dadTransmittedAllele ? dad.getAllele(0) : dad.getAllele(1);
|
Allele dadUntransmittedAllele = dad.getAllele(0) != dadTransmittedAllele ? dad.getAllele(0) : dad.getAllele(1);
|
||||||
|
|
@ -213,7 +213,7 @@ public class PhaseByTransmission extends RodWalker<Integer, Integer> {
|
||||||
phasedDadAlleles.add(dadTransmittedAllele);
|
phasedDadAlleles.add(dadTransmittedAllele);
|
||||||
phasedDadAlleles.add(dadUntransmittedAllele);
|
phasedDadAlleles.add(dadUntransmittedAllele);
|
||||||
|
|
||||||
Genotype phasedDadGenotype = new Genotype(dad.getSampleName(), phasedDadAlleles, dad.getNegLog10PError(), dad.getFilters(), dad.getAttributes(), true);
|
Genotype phasedDadGenotype = new Genotype(dad.getSampleName(), phasedDadAlleles, dad.getLog10PError(), dad.getFilters(), dad.getAttributes(), true);
|
||||||
|
|
||||||
finalGenotypes.add(phasedMomGenotype);
|
finalGenotypes.add(phasedMomGenotype);
|
||||||
finalGenotypes.add(phasedDadGenotype);
|
finalGenotypes.add(phasedDadGenotype);
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ class PhasingUtils {
|
||||||
mergedAllelesForSample.add(mergedAllele);
|
mergedAllelesForSample.add(mergedAllele);
|
||||||
}
|
}
|
||||||
|
|
||||||
double mergedGQ = Math.max(gt1.getNegLog10PError(), gt2.getNegLog10PError());
|
double mergedGQ = Math.max(gt1.getLog10PError(), gt2.getLog10PError());
|
||||||
Set<String> mergedGtFilters = new HashSet<String>(); // Since gt1 and gt2 were unfiltered, the Genotype remains unfiltered
|
Set<String> mergedGtFilters = new HashSet<String>(); // Since gt1 and gt2 were unfiltered, the Genotype remains unfiltered
|
||||||
|
|
||||||
Map<String, Object> mergedGtAttribs = new HashMap<String, Object>();
|
Map<String, Object> mergedGtAttribs = new HashMap<String, Object>();
|
||||||
|
|
@ -121,7 +121,7 @@ class PhasingUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
String mergedName = mergeVariantContextNames(vc1.getSource(), vc2.getSource());
|
String mergedName = mergeVariantContextNames(vc1.getSource(), vc2.getSource());
|
||||||
double mergedNegLog10PError = Math.max(vc1.getNegLog10PError(), vc2.getNegLog10PError());
|
double mergedLog10PError = Math.min(vc1.getLog10PError(), vc2.getLog10PError());
|
||||||
Set<String> mergedFilters = new HashSet<String>(); // Since vc1 and vc2 were unfiltered, the merged record remains unfiltered
|
Set<String> mergedFilters = new HashSet<String>(); // Since vc1 and vc2 were unfiltered, the merged record remains unfiltered
|
||||||
Map<String, Object> mergedAttribs = mergeVariantContextAttributes(vc1, vc2);
|
Map<String, Object> mergedAttribs = mergeVariantContextAttributes(vc1, vc2);
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ class PhasingUtils {
|
||||||
if ( vc2.hasID() ) mergedIDs.add(vc2.getID());
|
if ( vc2.hasID() ) mergedIDs.add(vc2.getID());
|
||||||
String mergedID = mergedIDs.isEmpty() ? VCFConstants.EMPTY_ID_FIELD : Utils.join(VCFConstants.ID_FIELD_SEPARATOR, mergedIDs);
|
String mergedID = mergedIDs.isEmpty() ? VCFConstants.EMPTY_ID_FIELD : Utils.join(VCFConstants.ID_FIELD_SEPARATOR, mergedIDs);
|
||||||
|
|
||||||
VariantContext mergedVc = new VariantContext(mergedName, mergedID, vc1.getChr(), vc1.getStart(), vc2.getEnd(), mergeData.getAllMergedAlleles(), mergedGenotypes, mergedNegLog10PError, mergedFilters, mergedAttribs);
|
VariantContext mergedVc = new VariantContextBuilder(mergedName, vc1.getChr(), vc1.getStart(), vc2.getEnd(), mergeData.getAllMergedAlleles()).id(mergedID).genotypes(mergedGenotypes).log10PError(mergedLog10PError).filters(mergedFilters).attributes(mergedAttribs).make();
|
||||||
|
|
||||||
mergedAttribs = new HashMap<String, Object>(mergedVc.getAttributes());
|
mergedAttribs = new HashMap<String, Object>(mergedVc.getAttributes());
|
||||||
VariantContextUtils.calculateChromosomeCounts(mergedVc, mergedAttribs, true);
|
VariantContextUtils.calculateChromosomeCounts(mergedVc, mergedAttribs, true);
|
||||||
|
|
|
||||||
|
|
@ -361,7 +361,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
||||||
if (isUnfilteredCalledDiploidGenotype(gt)) {
|
if (isUnfilteredCalledDiploidGenotype(gt)) {
|
||||||
if (gt.isHom()) { // Note that this Genotype may be replaced later to contain the PQ of a downstream het site that was phased relative to a het site lying upstream of this hom site:
|
if (gt.isHom()) { // Note that this Genotype may be replaced later to contain the PQ of a downstream het site that was phased relative to a het site lying upstream of this hom site:
|
||||||
// true <-> can trivially phase a hom site relative to ANY previous site:
|
// true <-> can trivially phase a hom site relative to ANY previous site:
|
||||||
Genotype phasedGt = new Genotype(gt.getSampleName(), gt.getAlleles(), gt.getNegLog10PError(), gt.getFilters(), gt.getAttributes(), true);
|
Genotype phasedGt = new Genotype(gt.getSampleName(), gt.getAlleles(), gt.getLog10PError(), gt.getFilters(), gt.getAttributes(), true);
|
||||||
uvc.setGenotype(samp, phasedGt);
|
uvc.setGenotype(samp, phasedGt);
|
||||||
}
|
}
|
||||||
else if (gt.isHet()) { // Attempt to phase this het genotype relative to the previous het genotype
|
else if (gt.isHet()) { // Attempt to phase this het genotype relative to the previous het genotype
|
||||||
|
|
@ -397,7 +397,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
||||||
ensurePhasing(allelePair, prevAllelePair, pr.haplotype);
|
ensurePhasing(allelePair, prevAllelePair, pr.haplotype);
|
||||||
Map<String, Object> gtAttribs = new HashMap<String, Object>(gt.getAttributes());
|
Map<String, Object> gtAttribs = new HashMap<String, Object>(gt.getAttributes());
|
||||||
gtAttribs.put(PQ_KEY, pr.phaseQuality);
|
gtAttribs.put(PQ_KEY, pr.phaseQuality);
|
||||||
Genotype phasedGt = new Genotype(gt.getSampleName(), allelePair.getAllelesAsList(), gt.getNegLog10PError(), gt.getFilters(), gtAttribs, genotypesArePhased);
|
Genotype phasedGt = new Genotype(gt.getSampleName(), allelePair.getAllelesAsList(), gt.getLog10PError(), gt.getFilters(), gtAttribs, genotypesArePhased);
|
||||||
uvc.setGenotype(samp, phasedGt);
|
uvc.setGenotype(samp, phasedGt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -417,7 +417,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
||||||
if (genotypesArePhased) {
|
if (genotypesArePhased) {
|
||||||
Map<String, Object> handledGtAttribs = new HashMap<String, Object>(handledGt.getAttributes());
|
Map<String, Object> handledGtAttribs = new HashMap<String, Object>(handledGt.getAttributes());
|
||||||
handledGtAttribs.put(PQ_KEY, pr.phaseQuality);
|
handledGtAttribs.put(PQ_KEY, pr.phaseQuality);
|
||||||
Genotype phasedHomGt = new Genotype(handledGt.getSampleName(), handledGt.getAlleles(), handledGt.getNegLog10PError(), handledGt.getFilters(), handledGtAttribs, genotypesArePhased);
|
Genotype phasedHomGt = new Genotype(handledGt.getSampleName(), handledGt.getAlleles(), handledGt.getLog10PError(), handledGt.getFilters(), handledGtAttribs, genotypesArePhased);
|
||||||
interiorUvc.setGenotype(samp, phasedHomGt);
|
interiorUvc.setGenotype(samp, phasedHomGt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1123,7 +1123,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
||||||
private int stop;
|
private int stop;
|
||||||
private Collection<Allele> alleles;
|
private Collection<Allele> alleles;
|
||||||
private GenotypesContext genotypes;
|
private GenotypesContext genotypes;
|
||||||
private double negLog10PError;
|
private double log10PError;
|
||||||
private Set<String> filters;
|
private Set<String> filters;
|
||||||
private Map<String, Object> attributes;
|
private Map<String, Object> attributes;
|
||||||
private String id;
|
private String id;
|
||||||
|
|
@ -1136,13 +1136,14 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
||||||
this.stop = vc.getEnd();
|
this.stop = vc.getEnd();
|
||||||
this.alleles = vc.getAlleles();
|
this.alleles = vc.getAlleles();
|
||||||
this.genotypes = GenotypesContext.copy(vc.getGenotypes()); // since vc.getGenotypes() is unmodifiable
|
this.genotypes = GenotypesContext.copy(vc.getGenotypes()); // since vc.getGenotypes() is unmodifiable
|
||||||
this.negLog10PError = vc.getNegLog10PError();
|
this.log10PError = vc.getLog10PError();
|
||||||
this.filters = vc.filtersWereApplied() ? vc.getFilters() : null;
|
this.filters = vc.filtersWereApplied() ? vc.getFilters() : null;
|
||||||
this.attributes = new HashMap<String, Object>(vc.getAttributes());
|
this.attributes = new HashMap<String, Object>(vc.getAttributes());
|
||||||
}
|
}
|
||||||
|
|
||||||
public VariantContext toVariantContext() {
|
public VariantContext toVariantContext() {
|
||||||
return new VariantContext(name, id, contig, start, stop, alleles, genotypes, negLog10PError, filters, attributes);
|
return new VariantContextBuilder(name, contig, start, stop, alleles).id(id)
|
||||||
|
.genotypes(genotypes).log10PError(log10PError).filters(filters).attributes(attributes).make();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenomeLoc getLocation() {
|
public GenomeLoc getLocation() {
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ public class MendelianViolationEvaluator extends VariantEvaluator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean includeGenotype(Genotype g) {
|
private boolean includeGenotype(Genotype g) {
|
||||||
return g.getNegLog10PError() > getQThreshold() && g.isCalled();
|
return g.getLog10PError() > getQThreshold() && g.isCalled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isViolation(VariantContext vc, Genotype momG, Genotype dadG, Genotype childG) {
|
public static boolean isViolation(VariantContext vc, Genotype momG, Genotype dadG, Genotype childG) {
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,6 @@ public class LeftAlignVariants extends RodWalker<Integer, Integer> {
|
||||||
newGenotypes.add(Genotype.modifyAlleles(genotype, newAlleles));
|
newGenotypes.add(Genotype.modifyAlleles(genotype, newAlleles));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new VariantContext(vc.getSource(), vc.getID(), vc.getChr(), vc.getStart(), vc.getEnd(), alleleMap.values(), newGenotypes, vc.getNegLog10PError(), vc.filtersWereApplied() ? vc.getFilters() : null, vc.getAttributes(), refBaseForIndel);
|
return new VariantContextBuilder(vc).alleles(alleleMap.values()).genotypes(newGenotypes).referenceBaseForIndel(refBaseForIndel).make();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ public class VariantsToTable extends RodWalker<Integer, Integer> {
|
||||||
getters.put("NCALLED", new Getter() { public String get(VariantContext vc) { return Integer.toString(vc.getNSamples() - vc.getNoCallCount()); } });
|
getters.put("NCALLED", new Getter() { public String get(VariantContext vc) { return Integer.toString(vc.getNSamples() - vc.getNoCallCount()); } });
|
||||||
getters.put("GQ", new Getter() { public String get(VariantContext vc) {
|
getters.put("GQ", new Getter() { public String get(VariantContext vc) {
|
||||||
if ( vc.getNSamples() > 1 ) throw new UserException("Cannot get GQ values for multi-sample VCF");
|
if ( vc.getNSamples() > 1 ) throw new UserException("Cannot get GQ values for multi-sample VCF");
|
||||||
return String.format("%.2f", 10 * vc.getGenotype(0).getNegLog10PError());
|
return String.format("%.2f", -10 * vc.getGenotype(0).getLog10PError());
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,7 @@ public abstract class AbstractVCFCodec implements FeatureCodec, NameAwareCodec,
|
||||||
|
|
||||||
String ref = getCachedString(parts[3].toUpperCase());
|
String ref = getCachedString(parts[3].toUpperCase());
|
||||||
String alts = getCachedString(parts[4].toUpperCase());
|
String alts = getCachedString(parts[4].toUpperCase());
|
||||||
builder.negLog10PError(parseQual(parts[5]));
|
builder.log10PError(parseQual(parts[5]));
|
||||||
builder.filters(parseFilters(getCachedString(parts[6])));
|
builder.filters(parseFilters(getCachedString(parts[6])));
|
||||||
builder.attributes(parseInfo(parts[7]));
|
builder.attributes(parseInfo(parts[7]));
|
||||||
|
|
||||||
|
|
@ -448,16 +448,16 @@ public abstract class AbstractVCFCodec implements FeatureCodec, NameAwareCodec,
|
||||||
protected static Double parseQual(String qualString) {
|
protected static Double parseQual(String qualString) {
|
||||||
// if we're the VCF 4 missing char, return immediately
|
// if we're the VCF 4 missing char, return immediately
|
||||||
if ( qualString.equals(VCFConstants.MISSING_VALUE_v4))
|
if ( qualString.equals(VCFConstants.MISSING_VALUE_v4))
|
||||||
return VariantContext.NO_NEG_LOG_10PERROR;
|
return VariantContext.NO_LOG10_PERROR;
|
||||||
|
|
||||||
Double val = Double.valueOf(qualString);
|
Double val = Double.valueOf(qualString);
|
||||||
|
|
||||||
// check to see if they encoded the missing qual score in VCF 3 style, with either the -1 or -1.0. check for val < 0 to save some CPU cycles
|
// check to see if they encoded the missing qual score in VCF 3 style, with either the -1 or -1.0. check for val < 0 to save some CPU cycles
|
||||||
if ((val < 0) && (Math.abs(val - VCFConstants.MISSING_QUALITY_v3_DOUBLE) < VCFConstants.VCF_ENCODING_EPSILON))
|
if ((val < 0) && (Math.abs(val - VCFConstants.MISSING_QUALITY_v3_DOUBLE) < VCFConstants.VCF_ENCODING_EPSILON))
|
||||||
return VariantContext.NO_NEG_LOG_10PERROR;
|
return VariantContext.NO_LOG10_PERROR;
|
||||||
|
|
||||||
// scale and return the value
|
// scale and return the value
|
||||||
return val / 10.0;
|
return val / -10.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ public class StandardVCFWriter extends IndexingVCFWriter {
|
||||||
mWriter.write(VCFConstants.FIELD_SEPARATOR);
|
mWriter.write(VCFConstants.FIELD_SEPARATOR);
|
||||||
|
|
||||||
// QUAL
|
// QUAL
|
||||||
if ( !vc.hasNegLog10PError() )
|
if ( !vc.hasLog10PError() )
|
||||||
mWriter.write(VCFConstants.MISSING_VALUE_v4);
|
mWriter.write(VCFConstants.MISSING_VALUE_v4);
|
||||||
else
|
else
|
||||||
mWriter.write(getQualValue(vc.getPhredScaledQual()));
|
mWriter.write(getQualValue(vc.getPhredScaledQual()));
|
||||||
|
|
@ -353,7 +353,7 @@ public class StandardVCFWriter extends IndexingVCFWriter {
|
||||||
|
|
||||||
// some exceptions
|
// some exceptions
|
||||||
if ( key.equals(VCFConstants.GENOTYPE_QUALITY_KEY) ) {
|
if ( key.equals(VCFConstants.GENOTYPE_QUALITY_KEY) ) {
|
||||||
if ( Math.abs(g.getNegLog10PError() - Genotype.NO_NEG_LOG_10PERROR) < 1e-6)
|
if ( Math.abs(g.getLog10PError() + Genotype.NO_LOG10_PERROR) < 1e-6)
|
||||||
val = VCFConstants.MISSING_VALUE_v4;
|
val = VCFConstants.MISSING_VALUE_v4;
|
||||||
else {
|
else {
|
||||||
val = getQualValue(Math.min(g.getPhredScaledQual(), VCFConstants.MAX_GENOTYPE_QUAL));
|
val = getQualValue(Math.min(g.getPhredScaledQual(), VCFConstants.MAX_GENOTYPE_QUAL));
|
||||||
|
|
@ -447,7 +447,7 @@ public class StandardVCFWriter extends IndexingVCFWriter {
|
||||||
keys.addAll(g.getAttributes().keySet());
|
keys.addAll(g.getAttributes().keySet());
|
||||||
if ( g.isAvailable() )
|
if ( g.isAvailable() )
|
||||||
sawGoodGT = true;
|
sawGoodGT = true;
|
||||||
if ( g.hasNegLog10PError() )
|
if ( g.hasLog10PError() )
|
||||||
sawGoodQual = true;
|
sawGoodQual = true;
|
||||||
if (g.isFiltered() && g.isCalled())
|
if (g.isFiltered() && g.isCalled())
|
||||||
sawGenotypeFilter = true;
|
sawGenotypeFilter = true;
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ public class VCF3Codec extends AbstractVCFCodec {
|
||||||
for (int genotypeOffset = 1; genotypeOffset < nParts; genotypeOffset++) {
|
for (int genotypeOffset = 1; genotypeOffset < nParts; genotypeOffset++) {
|
||||||
int GTValueSplitSize = ParsingUtils.split(genotypeParts[genotypeOffset], GTValueArray, VCFConstants.GENOTYPE_FIELD_SEPARATOR_CHAR);
|
int GTValueSplitSize = ParsingUtils.split(genotypeParts[genotypeOffset], GTValueArray, VCFConstants.GENOTYPE_FIELD_SEPARATOR_CHAR);
|
||||||
|
|
||||||
double GTQual = VariantContext.NO_NEG_LOG_10PERROR;
|
double GTQual = VariantContext.NO_LOG10_PERROR;
|
||||||
Set<String> genotypeFilters = null;
|
Set<String> genotypeFilters = null;
|
||||||
Map<String, Object> gtAttributes = null;
|
Map<String, Object> gtAttributes = null;
|
||||||
String sampleName = sampleNameIterator.next();
|
String sampleName = sampleNameIterator.next();
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ public class VCFCodec extends AbstractVCFCodec {
|
||||||
for (int genotypeOffset = 1; genotypeOffset < nParts; genotypeOffset++) {
|
for (int genotypeOffset = 1; genotypeOffset < nParts; genotypeOffset++) {
|
||||||
int GTValueSplitSize = ParsingUtils.split(genotypeParts[genotypeOffset], GTValueArray, VCFConstants.GENOTYPE_FIELD_SEPARATOR_CHAR);
|
int GTValueSplitSize = ParsingUtils.split(genotypeParts[genotypeOffset], GTValueArray, VCFConstants.GENOTYPE_FIELD_SEPARATOR_CHAR);
|
||||||
|
|
||||||
double GTQual = VariantContext.NO_NEG_LOG_10PERROR;
|
double GTQual = VariantContext.NO_LOG10_PERROR;
|
||||||
Set<String> genotypeFilters = null;
|
Set<String> genotypeFilters = null;
|
||||||
Map<String, Object> gtAttributes = null;
|
Map<String, Object> gtAttributes = null;
|
||||||
String sampleName = sampleNameIterator.next();
|
String sampleName = sampleNameIterator.next();
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,7 @@ package org.broadinstitute.sting.utils.gcf;
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.StandardVCFWriter;
|
import org.broadinstitute.sting.utils.codecs.vcf.StandardVCFWriter;
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
|
import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
import org.broadinstitute.sting.utils.variantcontext.*;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
|
||||||
import org.broadinstitute.sting.utils.variantcontext.GenotypesContext;
|
|
||||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -72,7 +69,7 @@ public class GCF {
|
||||||
alleleOffsets[i+1] = GCFHeaderBuilder.encodeAllele(vc.getAlternateAllele(i));
|
alleleOffsets[i+1] = GCFHeaderBuilder.encodeAllele(vc.getAlternateAllele(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
qual = (float)vc.getNegLog10PError(); //qualToByte(vc.getPhredScaledQual());
|
qual = (float)vc.getLog10PError(); //qualToByte(vc.getPhredScaledQual());
|
||||||
info = infoFieldString(vc, GCFHeaderBuilder);
|
info = infoFieldString(vc, GCFHeaderBuilder);
|
||||||
filterOffset = GCFHeaderBuilder.encodeString(StandardVCFWriter.getFilterString(vc));
|
filterOffset = GCFHeaderBuilder.encodeString(StandardVCFWriter.getFilterString(vc));
|
||||||
|
|
||||||
|
|
@ -142,14 +139,14 @@ public class GCF {
|
||||||
public VariantContext decode(final String source, final GCFHeader header) {
|
public VariantContext decode(final String source, final GCFHeader header) {
|
||||||
final String contig = header.getString(chromOffset);
|
final String contig = header.getString(chromOffset);
|
||||||
alleleMap = header.getAlleles(alleleOffsets);
|
alleleMap = header.getAlleles(alleleOffsets);
|
||||||
double negLog10PError = qual; // QualityUtils.qualToErrorProb(qual);
|
|
||||||
Set<String> filters = header.getFilters(filterOffset);
|
|
||||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
|
||||||
attributes.put("INFO", info);
|
|
||||||
Byte refPadByte = refPad == 0 ? null : refPad;
|
|
||||||
GenotypesContext genotypes = decodeGenotypes(header);
|
|
||||||
|
|
||||||
return new VariantContext(source, VCFConstants.EMPTY_ID_FIELD, contig, start, stop, alleleMap, genotypes, negLog10PError, filters, attributes, refPadByte);
|
VariantContextBuilder builder = new VariantContextBuilder(source, contig, start, stop, alleleMap);
|
||||||
|
builder.genotypes(decodeGenotypes(header));
|
||||||
|
builder.log10PError(qual);
|
||||||
|
builder.filters(header.getFilters(filterOffset));
|
||||||
|
builder.attribute("INFO", info);
|
||||||
|
builder.referenceBaseForIndel(refPad == 0 ? null : refPad);
|
||||||
|
return builder.make();
|
||||||
}
|
}
|
||||||
|
|
||||||
private GenotypesContext decodeGenotypes(final GCFHeader header) {
|
private GenotypesContext decodeGenotypes(final GCFHeader header) {
|
||||||
|
|
|
||||||
|
|
@ -84,14 +84,14 @@ public class GCFGenotype {
|
||||||
|
|
||||||
public Genotype decode(final String sampleName, final GCFHeader header, GCF GCF, List<Allele> alleleIndex) {
|
public Genotype decode(final String sampleName, final GCFHeader header, GCF GCF, List<Allele> alleleIndex) {
|
||||||
final List<Allele> alleles = decodeAlleles(gt, alleleIndex);
|
final List<Allele> alleles = decodeAlleles(gt, alleleIndex);
|
||||||
final double negLog10PError = gq / 10.0;
|
final double log10PError = gq / -10.0;
|
||||||
final Set<String> filters = Collections.emptySet();
|
final Set<String> filters = Collections.emptySet();
|
||||||
final Map<String, Object> attributes = new HashMap<String, Object>();
|
final Map<String, Object> attributes = new HashMap<String, Object>();
|
||||||
attributes.put("DP", dp);
|
attributes.put("DP", dp);
|
||||||
attributes.put("AD", ad);
|
attributes.put("AD", ad);
|
||||||
attributes.put("PL", pl);
|
attributes.put("PL", pl);
|
||||||
|
|
||||||
return new Genotype(sampleName, alleles, negLog10PError, filters, attributes, false);
|
return new Genotype(sampleName, alleles, log10PError, filters, attributes, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int encodeAlleles(List<Allele> gtList, List<Allele> allAlleles) {
|
private static int encodeAlleles(List<Allele> gtList, List<Allele> allAlleles) {
|
||||||
|
|
|
||||||
|
|
@ -12,19 +12,19 @@ import java.util.*;
|
||||||
* @author depristo
|
* @author depristo
|
||||||
*/
|
*/
|
||||||
final class CommonInfo {
|
final class CommonInfo {
|
||||||
public static final double NO_NEG_LOG_10PERROR = -1.0;
|
public static final double NO_LOG10_PERROR = 1.0;
|
||||||
|
|
||||||
private static Set<String> NO_FILTERS = Collections.emptySet();
|
private static Set<String> NO_FILTERS = Collections.emptySet();
|
||||||
private static Map<String, Object> NO_ATTRIBUTES = Collections.unmodifiableMap(new HashMap<String, Object>());
|
private static Map<String, Object> NO_ATTRIBUTES = Collections.unmodifiableMap(new HashMap<String, Object>());
|
||||||
|
|
||||||
private double negLog10PError = NO_NEG_LOG_10PERROR;
|
private double log10PError = NO_LOG10_PERROR;
|
||||||
private String name = null;
|
private String name = null;
|
||||||
private Set<String> filters = null;
|
private Set<String> filters = null;
|
||||||
private Map<String, Object> attributes = NO_ATTRIBUTES;
|
private Map<String, Object> attributes = NO_ATTRIBUTES;
|
||||||
|
|
||||||
public CommonInfo(String name, double negLog10PError, Set<String> filters, Map<String, Object> attributes) {
|
public CommonInfo(String name, double log10PError, Set<String> filters, Map<String, Object> attributes) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
setNegLog10PError(negLog10PError);
|
setLog10PError(log10PError);
|
||||||
if ( filters != null && ! filters.isEmpty() )
|
if ( filters != null && ! filters.isEmpty() )
|
||||||
this.filters = filters;
|
this.filters = filters;
|
||||||
if ( attributes != null && ! attributes.isEmpty() ) {
|
if ( attributes != null && ! attributes.isEmpty() ) {
|
||||||
|
|
@ -97,22 +97,21 @@ final class CommonInfo {
|
||||||
//
|
//
|
||||||
// ---------------------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
public boolean hasNegLog10PError() {
|
public boolean hasLog10PError() {
|
||||||
return getNegLog10PError() != NO_NEG_LOG_10PERROR;
|
return getLog10PError() != NO_LOG10_PERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the -1 * log10-based error estimate
|
* @return the -1 * log10-based error estimate
|
||||||
*/
|
*/
|
||||||
public double getNegLog10PError() { return negLog10PError; }
|
public double getLog10PError() { return log10PError; }
|
||||||
public double getPhredScaledQual() { return getNegLog10PError() * 10; }
|
public double getPhredScaledQual() { return getLog10PError() * -10; }
|
||||||
|
|
||||||
public void setNegLog10PError(double negLog10PError) {
|
public void setLog10PError(double log10PError) {
|
||||||
if ( negLog10PError < 0 && negLog10PError != NO_NEG_LOG_10PERROR ) throw new IllegalArgumentException("BUG: negLog10PError cannot be < than 0 : " + negLog10PError);
|
if ( this.log10PError > 0 && this.log10PError != NO_LOG10_PERROR) throw new IllegalArgumentException("BUG: log10PError cannot be > 0 : " + this.log10PError);
|
||||||
if ( Double.isInfinite(negLog10PError) ) throw new IllegalArgumentException("BUG: negLog10PError should not be Infinity");
|
if ( Double.isInfinite(this.log10PError) ) throw new IllegalArgumentException("BUG: log10PError should not be Infinity");
|
||||||
if ( Double.isNaN(negLog10PError) ) throw new IllegalArgumentException("BUG: negLog10PError should not be NaN");
|
if ( Double.isNaN(this.log10PError) ) throw new IllegalArgumentException("BUG: log10PError should not be NaN");
|
||||||
|
this.log10PError = log10PError;
|
||||||
this.negLog10PError = negLog10PError;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -18,20 +18,20 @@ public class Genotype {
|
||||||
public final static String UNPHASED_ALLELE_SEPARATOR = "/";
|
public final static String UNPHASED_ALLELE_SEPARATOR = "/";
|
||||||
|
|
||||||
protected CommonInfo commonInfo;
|
protected CommonInfo commonInfo;
|
||||||
public final static double NO_NEG_LOG_10PERROR = CommonInfo.NO_NEG_LOG_10PERROR;
|
public final static double NO_LOG10_PERROR = CommonInfo.NO_LOG10_PERROR;
|
||||||
protected List<Allele> alleles = null; // new ArrayList<Allele>();
|
protected List<Allele> alleles = null; // new ArrayList<Allele>();
|
||||||
protected Type type = null;
|
protected Type type = null;
|
||||||
|
|
||||||
protected boolean isPhased = false;
|
protected boolean isPhased = false;
|
||||||
|
|
||||||
public Genotype(String sampleName, List<Allele> alleles, double negLog10PError, Set<String> filters, Map<String, Object> attributes, boolean isPhased) {
|
public Genotype(String sampleName, List<Allele> alleles, double log10PError, Set<String> filters, Map<String, Object> attributes, boolean isPhased) {
|
||||||
this(sampleName, alleles, negLog10PError, filters, attributes, isPhased, null);
|
this(sampleName, alleles, log10PError, filters, attributes, isPhased, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Genotype(String sampleName, List<Allele> alleles, double negLog10PError, Set<String> filters, Map<String, Object> attributes, boolean isPhased, double[] log10Likelihoods) {
|
public Genotype(String sampleName, List<Allele> alleles, double log10PError, Set<String> filters, Map<String, Object> attributes, boolean isPhased, double[] log10Likelihoods) {
|
||||||
if ( alleles != null )
|
if ( alleles != null )
|
||||||
this.alleles = Collections.unmodifiableList(alleles);
|
this.alleles = Collections.unmodifiableList(alleles);
|
||||||
commonInfo = new CommonInfo(sampleName, negLog10PError, filters, attributes);
|
commonInfo = new CommonInfo(sampleName, log10PError, filters, attributes);
|
||||||
if ( log10Likelihoods != null )
|
if ( log10Likelihoods != null )
|
||||||
commonInfo.putAttribute(VCFConstants.PHRED_GENOTYPE_LIKELIHOODS_KEY, GenotypeLikelihoods.fromLog10Likelihoods(log10Likelihoods));
|
commonInfo.putAttribute(VCFConstants.PHRED_GENOTYPE_LIKELIHOODS_KEY, GenotypeLikelihoods.fromLog10Likelihoods(log10Likelihoods));
|
||||||
this.isPhased = isPhased;
|
this.isPhased = isPhased;
|
||||||
|
|
@ -42,23 +42,23 @@ public class Genotype {
|
||||||
* Creates a new Genotype for sampleName with genotype according to alleles.
|
* Creates a new Genotype for sampleName with genotype according to alleles.
|
||||||
* @param sampleName
|
* @param sampleName
|
||||||
* @param alleles
|
* @param alleles
|
||||||
* @param negLog10PError the confidence in these alleles
|
* @param log10PError the confidence in these alleles
|
||||||
* @param log10Likelihoods a log10 likelihoods for each of the genotype combinations possible for alleles, in the standard VCF ordering, or null if not known
|
* @param log10Likelihoods a log10 likelihoods for each of the genotype combinations possible for alleles, in the standard VCF ordering, or null if not known
|
||||||
*/
|
*/
|
||||||
public Genotype(String sampleName, List<Allele> alleles, double negLog10PError, double[] log10Likelihoods) {
|
public Genotype(String sampleName, List<Allele> alleles, double log10PError, double[] log10Likelihoods) {
|
||||||
this(sampleName, alleles, negLog10PError, null, null, false, log10Likelihoods);
|
this(sampleName, alleles, log10PError, null, null, false, log10Likelihoods);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Genotype(String sampleName, List<Allele> alleles, double negLog10PError) {
|
public Genotype(String sampleName, List<Allele> alleles, double log10PError) {
|
||||||
this(sampleName, alleles, negLog10PError, null, null, false);
|
this(sampleName, alleles, log10PError, null, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Genotype(String sampleName, List<Allele> alleles) {
|
public Genotype(String sampleName, List<Allele> alleles) {
|
||||||
this(sampleName, alleles, NO_NEG_LOG_10PERROR, null, null, false);
|
this(sampleName, alleles, NO_LOG10_PERROR, null, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Genotype(String sampleName, Genotype parent) {
|
public Genotype(String sampleName, Genotype parent) {
|
||||||
this(sampleName, parent.getAlleles(), parent.getNegLog10PError(), parent.getFilters(), parent.getAttributes(), parent.isPhased());
|
this(sampleName, parent.getAlleles(), parent.getLog10PError(), parent.getFilters(), parent.getAttributes(), parent.isPhased());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -70,15 +70,15 @@ public class Genotype {
|
||||||
// ---------------------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
public static Genotype modifyName(Genotype g, String name) {
|
public static Genotype modifyName(Genotype g, String name) {
|
||||||
return new Genotype(name, g.getAlleles(), g.getNegLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, g.getAttributes(), g.isPhased());
|
return new Genotype(name, g.getAlleles(), g.getLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, g.getAttributes(), g.isPhased());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Genotype modifyAttributes(Genotype g, Map<String, Object> attributes) {
|
public static Genotype modifyAttributes(Genotype g, Map<String, Object> attributes) {
|
||||||
return new Genotype(g.getSampleName(), g.getAlleles(), g.getNegLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, attributes, g.isPhased());
|
return new Genotype(g.getSampleName(), g.getAlleles(), g.getLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, attributes, g.isPhased());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Genotype modifyAlleles(Genotype g, List<Allele> alleles) {
|
public static Genotype modifyAlleles(Genotype g, List<Allele> alleles) {
|
||||||
return new Genotype(g.getSampleName(), alleles, g.getNegLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, g.getAttributes(), g.isPhased());
|
return new Genotype(g.getSampleName(), alleles, g.getLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, g.getAttributes(), g.isPhased());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -335,8 +335,8 @@ public class Genotype {
|
||||||
public boolean isFiltered() { return commonInfo.isFiltered(); }
|
public boolean isFiltered() { return commonInfo.isFiltered(); }
|
||||||
public boolean isNotFiltered() { return commonInfo.isNotFiltered(); }
|
public boolean isNotFiltered() { return commonInfo.isNotFiltered(); }
|
||||||
public boolean filtersWereApplied() { return commonInfo.filtersWereApplied(); }
|
public boolean filtersWereApplied() { return commonInfo.filtersWereApplied(); }
|
||||||
public boolean hasNegLog10PError() { return commonInfo.hasNegLog10PError(); }
|
public boolean hasLog10PError() { return commonInfo.hasLog10PError(); }
|
||||||
public double getNegLog10PError() { return commonInfo.getNegLog10PError(); }
|
public double getLog10PError() { return commonInfo.getLog10PError(); }
|
||||||
public double getPhredScaledQual() { return commonInfo.getPhredScaledQual(); }
|
public double getPhredScaledQual() { return commonInfo.getPhredScaledQual(); }
|
||||||
|
|
||||||
public Map<String, Object> getAttributes() { return commonInfo.getAttributes(); }
|
public Map<String, Object> getAttributes() { return commonInfo.getAttributes(); }
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ import java.util.*;
|
||||||
*/
|
*/
|
||||||
public class VariantContext implements Feature { // to enable tribble intergration
|
public class VariantContext implements Feature { // to enable tribble intergration
|
||||||
protected CommonInfo commonInfo = null;
|
protected CommonInfo commonInfo = null;
|
||||||
public final static double NO_NEG_LOG_10PERROR = CommonInfo.NO_NEG_LOG_10PERROR;
|
public final static double NO_LOG10_PERROR = CommonInfo.NO_LOG10_PERROR;
|
||||||
public final static String UNPARSED_GENOTYPE_MAP_KEY = "_UNPARSED_GENOTYPE_MAP_";
|
public final static String UNPARSED_GENOTYPE_MAP_KEY = "_UNPARSED_GENOTYPE_MAP_";
|
||||||
public final static String UNPARSED_GENOTYPE_PARSER_KEY = "_UNPARSED_GENOTYPE_PARSER_";
|
public final static String UNPARSED_GENOTYPE_PARSER_KEY = "_UNPARSED_GENOTYPE_PARSER_";
|
||||||
|
|
||||||
|
|
@ -235,7 +235,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
||||||
* @param stop the stop reference base (one based)
|
* @param stop the stop reference base (one based)
|
||||||
* @param alleles alleles
|
* @param alleles alleles
|
||||||
* @param genotypes genotypes map
|
* @param genotypes genotypes map
|
||||||
* @param negLog10PError qual
|
* @param log10PError qual
|
||||||
* @param filters filters: use null for unfiltered and empty set for passes filters
|
* @param filters filters: use null for unfiltered and empty set for passes filters
|
||||||
* @param attributes attributes
|
* @param attributes attributes
|
||||||
* @param referenceBaseForIndel padded reference base
|
* @param referenceBaseForIndel padded reference base
|
||||||
|
|
@ -243,29 +243,8 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
||||||
* @deprecated replaced by {@link VariantContextBuilder}
|
* @deprecated replaced by {@link VariantContextBuilder}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public VariantContext(String source, String ID, String contig, long start, long stop, Collection<Allele> alleles, GenotypesContext genotypes, double negLog10PError, Set<String> filters, Map<String, Object> attributes, Byte referenceBaseForIndel) {
|
protected VariantContext(String source, String ID, String contig, long start, long stop, Collection<Allele> alleles, GenotypesContext genotypes, double log10PError, Set<String> filters, Map<String, Object> attributes, Byte referenceBaseForIndel) {
|
||||||
this(source, ID, contig, start, stop, alleles, genotypes, negLog10PError, filters, attributes, referenceBaseForIndel, false, ALL_VALIDATION);
|
this(source, ID, contig, start, stop, alleles, genotypes, log10PError, filters, attributes, referenceBaseForIndel, false, ALL_VALIDATION);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the complete constructor. Makes a complete VariantContext from its arguments
|
|
||||||
*
|
|
||||||
* @param source source
|
|
||||||
* @param contig the contig
|
|
||||||
* @param start the start base (one based)
|
|
||||||
* @param stop the stop reference base (one based)
|
|
||||||
* @param alleles alleles
|
|
||||||
* @param genotypes genotypes map
|
|
||||||
* @param negLog10PError qual
|
|
||||||
* @param filters filters: use null for unfiltered and empty set for passes filters
|
|
||||||
* @param attributes attributes
|
|
||||||
*
|
|
||||||
* @deprecated replaced by {@link VariantContextBuilder}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public VariantContext(String source, String ID, String contig, long start, long stop, Collection<Allele> alleles, GenotypesContext genotypes, double negLog10PError, Set<String> filters, Map<String, Object> attributes) {
|
|
||||||
this(source, ID, contig, start, stop, alleles, genotypes, negLog10PError, filters, attributes, null, false, ALL_VALIDATION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -281,7 +260,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public VariantContext(String source, String ID, String contig, long start, long stop, Collection<Allele> alleles) {
|
public VariantContext(String source, String ID, String contig, long start, long stop, Collection<Allele> alleles) {
|
||||||
this(source, ID, contig, start, stop, alleles, NO_GENOTYPES, CommonInfo.NO_NEG_LOG_10PERROR, null, null, null, false, ALL_VALIDATION);
|
this(source, ID, contig, start, stop, alleles, NO_GENOTYPES, CommonInfo.NO_LOG10_PERROR, null, null, null, false, ALL_VALIDATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -290,7 +269,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
||||||
* @param other the VariantContext to copy
|
* @param other the VariantContext to copy
|
||||||
*/
|
*/
|
||||||
protected VariantContext(VariantContext other) {
|
protected VariantContext(VariantContext other) {
|
||||||
this(other.getSource(), other.getID(), other.getChr(), other.getStart(), other.getEnd() , other.getAlleles(), other.getGenotypes(), other.getNegLog10PError(), other.filtersWereApplied() ? other.getFilters() : null, other.getAttributes(), other.REFERENCE_BASE_FOR_INDEL, false, NO_VALIDATION);
|
this(other.getSource(), other.getID(), other.getChr(), other.getStart(), other.getEnd() , other.getAlleles(), other.getGenotypes(), other.getLog10PError(), other.filtersWereApplied() ? other.getFilters() : null, other.getAttributes(), other.REFERENCE_BASE_FOR_INDEL, false, NO_VALIDATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -302,7 +281,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
||||||
* @param stop the stop reference base (one based)
|
* @param stop the stop reference base (one based)
|
||||||
* @param alleles alleles
|
* @param alleles alleles
|
||||||
* @param genotypes genotypes map
|
* @param genotypes genotypes map
|
||||||
* @param negLog10PError qual
|
* @param log10PError qual
|
||||||
* @param filters filters: use null for unfiltered and empty set for passes filters
|
* @param filters filters: use null for unfiltered and empty set for passes filters
|
||||||
* @param attributes attributes
|
* @param attributes attributes
|
||||||
* @param referenceBaseForIndel padded reference base
|
* @param referenceBaseForIndel padded reference base
|
||||||
|
|
@ -312,7 +291,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
||||||
protected VariantContext(String source, String ID,
|
protected VariantContext(String source, String ID,
|
||||||
String contig, long start, long stop,
|
String contig, long start, long stop,
|
||||||
Collection<Allele> alleles, GenotypesContext genotypes,
|
Collection<Allele> alleles, GenotypesContext genotypes,
|
||||||
double negLog10PError, Set<String> filters, Map<String, Object> attributes,
|
double log10PError, Set<String> filters, Map<String, Object> attributes,
|
||||||
Byte referenceBaseForIndel, boolean genotypesAreUnparsed,
|
Byte referenceBaseForIndel, boolean genotypesAreUnparsed,
|
||||||
EnumSet<Validation> validationToPerform ) {
|
EnumSet<Validation> validationToPerform ) {
|
||||||
if ( contig == null ) { throw new IllegalArgumentException("Contig cannot be null"); }
|
if ( contig == null ) { throw new IllegalArgumentException("Contig cannot be null"); }
|
||||||
|
|
@ -335,7 +314,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.commonInfo = new CommonInfo(source, negLog10PError, filters, attributes);
|
this.commonInfo = new CommonInfo(source, log10PError, filters, attributes);
|
||||||
REFERENCE_BASE_FOR_INDEL = referenceBaseForIndel;
|
REFERENCE_BASE_FOR_INDEL = referenceBaseForIndel;
|
||||||
|
|
||||||
// todo -- remove me when this check is no longer necessary
|
// todo -- remove me when this check is no longer necessary
|
||||||
|
|
@ -600,8 +579,8 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
||||||
public boolean isFiltered() { return commonInfo.isFiltered(); }
|
public boolean isFiltered() { return commonInfo.isFiltered(); }
|
||||||
public boolean isNotFiltered() { return commonInfo.isNotFiltered(); }
|
public boolean isNotFiltered() { return commonInfo.isNotFiltered(); }
|
||||||
public boolean filtersWereApplied() { return commonInfo.filtersWereApplied(); }
|
public boolean filtersWereApplied() { return commonInfo.filtersWereApplied(); }
|
||||||
public boolean hasNegLog10PError() { return commonInfo.hasNegLog10PError(); }
|
public boolean hasLog10PError() { return commonInfo.hasLog10PError(); }
|
||||||
public double getNegLog10PError() { return commonInfo.getNegLog10PError(); }
|
public double getLog10PError() { return commonInfo.getLog10PError(); }
|
||||||
public double getPhredScaledQual() { return commonInfo.getPhredScaledQual(); }
|
public double getPhredScaledQual() { return commonInfo.getPhredScaledQual(); }
|
||||||
|
|
||||||
public Map<String, Object> getAttributes() { return commonInfo.getAttributes(); }
|
public Map<String, Object> getAttributes() { return commonInfo.getAttributes(); }
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,6 @@ import org.broad.tribble.Feature;
|
||||||
import org.broad.tribble.TribbleException;
|
import org.broad.tribble.TribbleException;
|
||||||
import org.broad.tribble.util.ParsingUtils;
|
import org.broad.tribble.util.ParsingUtils;
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
|
import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFParser;
|
|
||||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
@ -69,7 +67,7 @@ public class VariantContextBuilder {
|
||||||
// optional -> these are set to the appropriate default value
|
// optional -> these are set to the appropriate default value
|
||||||
private String ID = VCFConstants.EMPTY_ID_FIELD;
|
private String ID = VCFConstants.EMPTY_ID_FIELD;
|
||||||
private GenotypesContext genotypes = GenotypesContext.NO_GENOTYPES;
|
private GenotypesContext genotypes = GenotypesContext.NO_GENOTYPES;
|
||||||
private double negLog10PError = VariantContext.NO_NEG_LOG_10PERROR;
|
private double log10PError = VariantContext.NO_LOG10_PERROR;
|
||||||
private Set<String> filters = null;
|
private Set<String> filters = null;
|
||||||
private Map<String, Object> attributes = null;
|
private Map<String, Object> attributes = null;
|
||||||
private boolean attributesCanBeModified = false;
|
private boolean attributesCanBeModified = false;
|
||||||
|
|
@ -116,7 +114,7 @@ public class VariantContextBuilder {
|
||||||
this.genotypes = parent.genotypes;
|
this.genotypes = parent.genotypes;
|
||||||
this.genotypesAreUnparsed = parent.hasAttribute(VariantContext.UNPARSED_GENOTYPE_MAP_KEY);
|
this.genotypesAreUnparsed = parent.hasAttribute(VariantContext.UNPARSED_GENOTYPE_MAP_KEY);
|
||||||
this.ID = parent.getID();
|
this.ID = parent.getID();
|
||||||
this.negLog10PError = parent.getNegLog10PError();
|
this.log10PError = parent.getLog10PError();
|
||||||
this.referenceBaseForIndel = parent.getReferenceBaseForIndel();
|
this.referenceBaseForIndel = parent.getReferenceBaseForIndel();
|
||||||
this.source = parent.getSource();
|
this.source = parent.getSource();
|
||||||
this.start = parent.getStart();
|
this.start = parent.getStart();
|
||||||
|
|
@ -279,13 +277,13 @@ public class VariantContextBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells us that the resulting VariantContext should have negLog10PError
|
* Tells us that the resulting VariantContext should have log10PError
|
||||||
* @param negLog10PError
|
* @param log10PError
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Requires("negLog10PError >= 0 || negLog10PError == VariantContext.NO_NEG_LOG_10PERROR")
|
@Requires("log10PError <= 0 || log10PError == VariantContext.NO_LOG10_PERROR")
|
||||||
public VariantContextBuilder negLog10PError(final double negLog10PError) {
|
public VariantContextBuilder log10PError(final double log10PError) {
|
||||||
this.negLog10PError = negLog10PError;
|
this.log10PError = log10PError;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -374,7 +372,7 @@ public class VariantContextBuilder {
|
||||||
*/
|
*/
|
||||||
public VariantContext make() {
|
public VariantContext make() {
|
||||||
return new VariantContext(source, ID, contig, start, stop, alleles,
|
return new VariantContext(source, ID, contig, start, stop, alleles,
|
||||||
genotypes, negLog10PError, filters, attributes,
|
genotypes, log10PError, filters, attributes,
|
||||||
referenceBaseForIndel, genotypesAreUnparsed, toValidate);
|
referenceBaseForIndel, genotypesAreUnparsed, toValidate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ public class VariantContextUtils {
|
||||||
Map<String, Object> attrs = new HashMap<String, Object>(g.getAttributes());
|
Map<String, Object> attrs = new HashMap<String, Object>(g.getAttributes());
|
||||||
attrs.remove(VCFConstants.PHRED_GENOTYPE_LIKELIHOODS_KEY);
|
attrs.remove(VCFConstants.PHRED_GENOTYPE_LIKELIHOODS_KEY);
|
||||||
attrs.remove(VCFConstants.GENOTYPE_LIKELIHOODS_KEY);
|
attrs.remove(VCFConstants.GENOTYPE_LIKELIHOODS_KEY);
|
||||||
return new Genotype(g.getSampleName(), g.getAlleles(), g.getNegLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, attrs, g.isPhased());
|
return new Genotype(g.getSampleName(), g.getAlleles(), g.getLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, attrs, g.isPhased());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VariantContext createVariantContextWithPaddedAlleles(VariantContext inputVC, boolean refBaseShouldBeAppliedToEndOfAlleles) {
|
public static VariantContext createVariantContextWithPaddedAlleles(VariantContext inputVC, boolean refBaseShouldBeAppliedToEndOfAlleles) {
|
||||||
|
|
@ -178,14 +178,12 @@ public class VariantContextUtils {
|
||||||
newGenotypeAlleles.add(Allele.NO_CALL);
|
newGenotypeAlleles.add(Allele.NO_CALL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
genotypes.add(new Genotype(g.getSampleName(), newGenotypeAlleles, g.getNegLog10PError(),
|
genotypes.add(new Genotype(g.getSampleName(), newGenotypeAlleles, g.getLog10PError(),
|
||||||
g.getFilters(), g.getAttributes(), g.isPhased()));
|
g.getFilters(), g.getAttributes(), g.isPhased()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not change the filter state if filters were not applied to this context
|
return new VariantContextBuilder(inputVC).alleles(alleles).genotypes(genotypes).make();
|
||||||
Set<String> inputVCFilters = inputVC.getFiltersMaybeNull();
|
|
||||||
return new VariantContext(inputVC.getSource(), inputVC.getID(), inputVC.getChr(), inputVC.getStart(), inputVC.getEnd(), alleles, genotypes, inputVC.getNegLog10PError(), inputVCFilters, inputVC.getAttributes(),refByte);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return inputVC;
|
return inputVC;
|
||||||
|
|
@ -373,12 +371,12 @@ public class VariantContextUtils {
|
||||||
final GenotypesContext genotypes = GenotypesContext.create(vc.getNSamples());
|
final GenotypesContext genotypes = GenotypesContext.create(vc.getNSamples());
|
||||||
for ( final Genotype g : vc.getGenotypes() ) {
|
for ( final Genotype g : vc.getGenotypes() ) {
|
||||||
Map<String, Object> genotypeAttributes = subsetAttributes(g.commonInfo, keysToPreserve);
|
Map<String, Object> genotypeAttributes = subsetAttributes(g.commonInfo, keysToPreserve);
|
||||||
genotypes.add(new Genotype(g.getSampleName(), g.getAlleles(), g.getNegLog10PError(), g.getFilters(),
|
genotypes.add(new Genotype(g.getSampleName(), g.getAlleles(), g.getLog10PError(), g.getFilters(),
|
||||||
genotypeAttributes, g.isPhased()));
|
genotypeAttributes, g.isPhased()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new VariantContext(vc.getSource(), vc.getID(), vc.getChr(), vc.getStart(), vc.getEnd(),
|
return new VariantContext(vc.getSource(), vc.getID(), vc.getChr(), vc.getStart(), vc.getEnd(),
|
||||||
vc.getAlleles(), genotypes, vc.getNegLog10PError(), vc.getFilters(), attributes, vc.getReferenceBaseForIndel());
|
vc.getAlleles(), genotypes, vc.getLog10PError(), vc.getFilters(), attributes, vc.getReferenceBaseForIndel());
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum GenotypeMergeType {
|
public enum GenotypeMergeType {
|
||||||
|
|
@ -475,7 +473,7 @@ public class VariantContextUtils {
|
||||||
int depth = 0;
|
int depth = 0;
|
||||||
int maxAC = -1;
|
int maxAC = -1;
|
||||||
final Map<String, Object> attributesWithMaxAC = new TreeMap<String, Object>();
|
final Map<String, Object> attributesWithMaxAC = new TreeMap<String, Object>();
|
||||||
double negLog10PError = -1;
|
double log10PError = 1;
|
||||||
VariantContext vcWithMaxAC = null;
|
VariantContext vcWithMaxAC = null;
|
||||||
Set<String> addedSamples = new HashSet<String>(first.getNSamples());
|
Set<String> addedSamples = new HashSet<String>(first.getNSamples());
|
||||||
GenotypesContext genotypes = GenotypesContext.create();
|
GenotypesContext genotypes = GenotypesContext.create();
|
||||||
|
|
@ -504,7 +502,7 @@ public class VariantContextUtils {
|
||||||
|
|
||||||
mergeGenotypes(genotypes, addedSamples, vc, alleleMapping, genotypeMergeOptions == GenotypeMergeType.UNIQUIFY);
|
mergeGenotypes(genotypes, addedSamples, vc, alleleMapping, genotypeMergeOptions == GenotypeMergeType.UNIQUIFY);
|
||||||
|
|
||||||
negLog10PError = Math.max(negLog10PError, vc.isVariant() ? vc.getNegLog10PError() : -1);
|
log10PError = Math.min(log10PError, vc.isVariant() ? vc.getLog10PError() : 1);
|
||||||
|
|
||||||
filters.addAll(vc.getFilters());
|
filters.addAll(vc.getFilters());
|
||||||
|
|
||||||
|
|
@ -610,10 +608,15 @@ public class VariantContextUtils {
|
||||||
|
|
||||||
final String ID = rsIDs.isEmpty() ? VCFConstants.EMPTY_ID_FIELD : Utils.join(",", rsIDs);
|
final String ID = rsIDs.isEmpty() ? VCFConstants.EMPTY_ID_FIELD : Utils.join(",", rsIDs);
|
||||||
|
|
||||||
VariantContext merged = new VariantContext(name, ID, loc.getContig(), loc.getStart(), loc.getStop(), alleles, genotypes, negLog10PError, filters, (mergeInfoWithMaxAC ? attributesWithMaxAC : attributes) );
|
final VariantContextBuilder builder = new VariantContextBuilder().source(name).id(ID);
|
||||||
// Trim the padded bases of all alleles if necessary
|
builder.loc(loc.getContig(), loc.getStart(), loc.getStop());
|
||||||
merged = createVariantContextWithTrimmedAlleles(merged);
|
builder.alleles(alleles);
|
||||||
|
builder.genotypes(genotypes);
|
||||||
|
builder.log10PError(log10PError);
|
||||||
|
builder.filters(filters).attributes(mergeInfoWithMaxAC ? attributesWithMaxAC : attributes);
|
||||||
|
|
||||||
|
// Trim the padded bases of all alleles if necessary
|
||||||
|
VariantContext merged = createVariantContextWithTrimmedAlleles(builder.make());
|
||||||
if ( printMessages && remapped ) System.out.printf("Remapped => %s%n", merged);
|
if ( printMessages && remapped ) System.out.printf("Remapped => %s%n", merged);
|
||||||
return merged;
|
return merged;
|
||||||
}
|
}
|
||||||
|
|
@ -648,6 +651,7 @@ public class VariantContextUtils {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VariantContext createVariantContextWithTrimmedAlleles(VariantContext inputVC) {
|
public static VariantContext createVariantContextWithTrimmedAlleles(VariantContext inputVC) {
|
||||||
// see if we need to trim common reference base from all alleles
|
// see if we need to trim common reference base from all alleles
|
||||||
boolean trimVC;
|
boolean trimVC;
|
||||||
|
|
@ -713,8 +717,9 @@ public class VariantContextUtils {
|
||||||
genotypes.add(Genotype.modifyAlleles(genotype, trimmedAlleles));
|
genotypes.add(Genotype.modifyAlleles(genotype, trimmedAlleles));
|
||||||
|
|
||||||
}
|
}
|
||||||
return new VariantContext(inputVC.getSource(), inputVC.getID(), inputVC.getChr(), inputVC.getStart(), inputVC.getEnd(), alleles, genotypes, inputVC.getNegLog10PError(), inputVC.filtersWereApplied() ? inputVC.getFilters() : null, attributes, new Byte(inputVC.getReference().getBases()[0]));
|
|
||||||
|
|
||||||
|
final VariantContextBuilder builder = new VariantContextBuilder(inputVC);
|
||||||
|
return builder.alleles(alleles).genotypes(genotypes).attributes(attributes).referenceBaseForIndel(new Byte(inputVC.getReference().getBases()[0])).make();
|
||||||
}
|
}
|
||||||
|
|
||||||
return inputVC;
|
return inputVC;
|
||||||
|
|
@ -910,7 +915,7 @@ public class VariantContextUtils {
|
||||||
|
|
||||||
if ( uniqifySamples || alleleMapping.needsRemapping() ) {
|
if ( uniqifySamples || alleleMapping.needsRemapping() ) {
|
||||||
final List<Allele> alleles = alleleMapping.needsRemapping() ? alleleMapping.remap(g.getAlleles()) : g.getAlleles();
|
final List<Allele> alleles = alleleMapping.needsRemapping() ? alleleMapping.remap(g.getAlleles()) : g.getAlleles();
|
||||||
newG = new Genotype(name, alleles, g.getNegLog10PError(), g.getFilters(), g.getAttributes(), g.isPhased());
|
newG = new Genotype(name, alleles, g.getLog10PError(), g.getFilters(), g.getAttributes(), g.isPhased());
|
||||||
}
|
}
|
||||||
|
|
||||||
mergedGenotypes.add(newG);
|
mergedGenotypes.add(newG);
|
||||||
|
|
@ -954,8 +959,7 @@ public class VariantContextUtils {
|
||||||
newGenotypes.add(Genotype.modifyAlleles(genotype, newAlleles));
|
newGenotypes.add(Genotype.modifyAlleles(genotype, newAlleles));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new VariantContext(vc.getSource(), vc.getID(), vc.getChr(), vc.getStart(), vc.getEnd(), alleleMap.values(), newGenotypes, vc.getNegLog10PError(), vc.filtersWereApplied() ? vc.getFilters() : null, vc.getAttributes());
|
return new VariantContextBuilder(vc).alleles(alleleMap.values()).genotypes(newGenotypes).make();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VariantContext purgeUnallowedGenotypeAttributes(VariantContext vc, Set<String> allowedAttributes) {
|
public static VariantContext purgeUnallowedGenotypeAttributes(VariantContext vc, Set<String> allowedAttributes) {
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class VariantJEXLContext implements JexlContext {
|
||||||
x.put("CHROM", new AttributeGetter() { public Object get(VariantContext vc) { return vc.getChr(); }});
|
x.put("CHROM", new AttributeGetter() { public Object get(VariantContext vc) { return vc.getChr(); }});
|
||||||
x.put("POS", new AttributeGetter() { public Object get(VariantContext vc) { return vc.getStart(); }});
|
x.put("POS", new AttributeGetter() { public Object get(VariantContext vc) { return vc.getStart(); }});
|
||||||
x.put("TYPE", new AttributeGetter() { public Object get(VariantContext vc) { return vc.getType().toString(); }});
|
x.put("TYPE", new AttributeGetter() { public Object get(VariantContext vc) { return vc.getType().toString(); }});
|
||||||
x.put("QUAL", new AttributeGetter() { public Object get(VariantContext vc) { return 10 * vc.getNegLog10PError(); }});
|
x.put("QUAL", new AttributeGetter() { public Object get(VariantContext vc) { return -10 * vc.getLog10PError(); }});
|
||||||
x.put("ALLELES", new AttributeGetter() { public Object get(VariantContext vc) { return vc.getAlleles(); }});
|
x.put("ALLELES", new AttributeGetter() { public Object get(VariantContext vc) { return vc.getAlleles(); }});
|
||||||
x.put("N_ALLELES", new AttributeGetter() { public Object get(VariantContext vc) { return vc.getNAlleles(); }});
|
x.put("N_ALLELES", new AttributeGetter() { public Object get(VariantContext vc) { return vc.getNAlleles(); }});
|
||||||
x.put("FILTER", new AttributeGetter() { public Object get(VariantContext vc) { return vc.isFiltered() ? "1" : "0"; }});
|
x.put("FILTER", new AttributeGetter() { public Object get(VariantContext vc) { return vc.isFiltered() ? "1" : "0"; }});
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,7 @@ package org.broadinstitute.sting.utils.genotype.vcf;
|
||||||
|
|
||||||
import org.broad.tribble.Tribble;
|
import org.broad.tribble.Tribble;
|
||||||
import org.broad.tribble.readers.AsciiLineReader;
|
import org.broad.tribble.readers.AsciiLineReader;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
import org.broadinstitute.sting.utils.variantcontext.*;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
|
||||||
import org.broadinstitute.sting.utils.variantcontext.GenotypesContext;
|
|
||||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
|
|
@ -136,9 +133,8 @@ public class VCFWriterUnitTest extends BaseTest {
|
||||||
genotypes.add(gt);
|
genotypes.add(gt);
|
||||||
|
|
||||||
}
|
}
|
||||||
return new VariantContext("RANDOM", VCFConstants.EMPTY_ID_FIELD, loc.getContig(), loc.getStart(), loc.getStop(), alleles, genotypes, 0, filters, attributes, (byte)'A');
|
return new VariantContextBuilder("RANDOM", loc.getContig(), loc.getStart(), loc.getStop(), alleles)
|
||||||
|
.genotypes(genotypes).attributes(attributes).referenceBaseForIndel((byte)'A').make();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ public class GenotypeUnitTest extends BaseTest {
|
||||||
// public boolean sameGenotype(Genotype other)
|
// public boolean sameGenotype(Genotype other)
|
||||||
// public boolean sameGenotype(Genotype other, boolean ignorePhase)
|
// public boolean sameGenotype(Genotype other, boolean ignorePhase)
|
||||||
// public String getSampleName()
|
// public String getSampleName()
|
||||||
// public boolean hasNegLog10PError()
|
// public boolean hasLog10PError()
|
||||||
// public double getNegLog10PError()
|
// public double getLog10PError()
|
||||||
// public double getPhredScaledQual()
|
// public double getPhredScaledQual()
|
||||||
// public boolean hasAttribute(String key)
|
// public boolean hasAttribute(String key)
|
||||||
// public Object getAttribute(String key)
|
// public Object getAttribute(String key)
|
||||||
|
|
|
||||||
|
|
@ -356,7 +356,7 @@ public class VariantContextBenchmark extends SimpleBenchmark {
|
||||||
// for ( final org.broadinstitute.sting.utils.variantcontext.v13.Genotype g : vc.getGenotypes().values() ) {
|
// for ( final org.broadinstitute.sting.utils.variantcontext.v13.Genotype g : vc.getGenotypes().values() ) {
|
||||||
// String name = g.getSampleName()+"_"+i;
|
// String name = g.getSampleName()+"_"+i;
|
||||||
// gc.put(name, new org.broadinstitute.sting.utils.variantcontext.v13.Genotype(name,
|
// gc.put(name, new org.broadinstitute.sting.utils.variantcontext.v13.Genotype(name,
|
||||||
// g.getAlleles(), g.getNegLog10PError(), g.getFilters(), g.getAttributes(), g.isPhased(), g.getLikelihoods().getAsVector()));
|
// g.getAlleles(), g.getLog10PError(), g.getFilters(), g.getAttributes(), g.isPhased(), g.getLikelihoods().getAsVector()));
|
||||||
// toMerge.add(org.broadinstitute.sting.utils.variantcontext.v13.VariantContext.modifyGenotypes(vc, gc));
|
// toMerge.add(org.broadinstitute.sting.utils.variantcontext.v13.VariantContext.modifyGenotypes(vc, gc));
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
|
||||||
|
|
@ -91,45 +91,45 @@ public class VariantContextUnitTest extends BaseTest {
|
||||||
|
|
||||||
// test INDELs
|
// test INDELs
|
||||||
alleles = Arrays.asList(Aref, ATC);
|
alleles = Arrays.asList(Aref, ATC);
|
||||||
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop, alleles, null, CommonInfo.NO_NEG_LOG_10PERROR, null, null, (byte)'A');
|
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop, alleles, null, CommonInfo.NO_LOG10_PERROR, null, null, (byte)'A');
|
||||||
Assert.assertEquals(vc.getType(), VariantContext.Type.INDEL);
|
Assert.assertEquals(vc.getType(), VariantContext.Type.INDEL);
|
||||||
|
|
||||||
alleles = Arrays.asList(ATCref, A);
|
alleles = Arrays.asList(ATCref, A);
|
||||||
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop+2, alleles, null, CommonInfo.NO_NEG_LOG_10PERROR, null, null, (byte)'A');
|
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop+2, alleles, null, CommonInfo.NO_LOG10_PERROR, null, null, (byte)'A');
|
||||||
Assert.assertEquals(vc.getType(), VariantContext.Type.INDEL);
|
Assert.assertEquals(vc.getType(), VariantContext.Type.INDEL);
|
||||||
|
|
||||||
alleles = Arrays.asList(Tref, TA, TC);
|
alleles = Arrays.asList(Tref, TA, TC);
|
||||||
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop, alleles, null, CommonInfo.NO_NEG_LOG_10PERROR, null, null, (byte)'A');
|
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop, alleles, null, CommonInfo.NO_LOG10_PERROR, null, null, (byte)'A');
|
||||||
Assert.assertEquals(vc.getType(), VariantContext.Type.INDEL);
|
Assert.assertEquals(vc.getType(), VariantContext.Type.INDEL);
|
||||||
|
|
||||||
alleles = Arrays.asList(ATCref, A, AC);
|
alleles = Arrays.asList(ATCref, A, AC);
|
||||||
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop+2, alleles, null, CommonInfo.NO_NEG_LOG_10PERROR, null, null, (byte)'A');
|
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop+2, alleles, null, CommonInfo.NO_LOG10_PERROR, null, null, (byte)'A');
|
||||||
Assert.assertEquals(vc.getType(), VariantContext.Type.INDEL);
|
Assert.assertEquals(vc.getType(), VariantContext.Type.INDEL);
|
||||||
|
|
||||||
alleles = Arrays.asList(ATCref, A, Allele.create("ATCTC"));
|
alleles = Arrays.asList(ATCref, A, Allele.create("ATCTC"));
|
||||||
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop+2, alleles, null, CommonInfo.NO_NEG_LOG_10PERROR, null, null, (byte)'A');
|
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop+2, alleles, null, CommonInfo.NO_LOG10_PERROR, null, null, (byte)'A');
|
||||||
Assert.assertEquals(vc.getType(), VariantContext.Type.INDEL);
|
Assert.assertEquals(vc.getType(), VariantContext.Type.INDEL);
|
||||||
|
|
||||||
// test MIXED
|
// test MIXED
|
||||||
alleles = Arrays.asList(TAref, T, TC);
|
alleles = Arrays.asList(TAref, T, TC);
|
||||||
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop+1, alleles, null, CommonInfo.NO_NEG_LOG_10PERROR, null, null, (byte)'A');
|
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop+1, alleles, null, CommonInfo.NO_LOG10_PERROR, null, null, (byte)'A');
|
||||||
Assert.assertEquals(vc.getType(), VariantContext.Type.MIXED);
|
Assert.assertEquals(vc.getType(), VariantContext.Type.MIXED);
|
||||||
|
|
||||||
alleles = Arrays.asList(TAref, T, AC);
|
alleles = Arrays.asList(TAref, T, AC);
|
||||||
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop+1, alleles, null, CommonInfo.NO_NEG_LOG_10PERROR, null, null, (byte)'A');
|
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop+1, alleles, null, CommonInfo.NO_LOG10_PERROR, null, null, (byte)'A');
|
||||||
Assert.assertEquals(vc.getType(), VariantContext.Type.MIXED);
|
Assert.assertEquals(vc.getType(), VariantContext.Type.MIXED);
|
||||||
|
|
||||||
alleles = Arrays.asList(ACref, ATC, AT);
|
alleles = Arrays.asList(ACref, ATC, AT);
|
||||||
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop+1, alleles, null, CommonInfo.NO_NEG_LOG_10PERROR, null, null, (byte)'A');
|
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop+1, alleles, null, CommonInfo.NO_LOG10_PERROR, null, null, (byte)'A');
|
||||||
Assert.assertEquals(vc.getType(), VariantContext.Type.MIXED);
|
Assert.assertEquals(vc.getType(), VariantContext.Type.MIXED);
|
||||||
|
|
||||||
alleles = Arrays.asList(Aref, T, symbolic);
|
alleles = Arrays.asList(Aref, T, symbolic);
|
||||||
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop, alleles, null, CommonInfo.NO_NEG_LOG_10PERROR, null, null, (byte)'A');
|
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop, alleles, null, CommonInfo.NO_LOG10_PERROR, null, null, (byte)'A');
|
||||||
Assert.assertEquals(vc.getType(), VariantContext.Type.MIXED);
|
Assert.assertEquals(vc.getType(), VariantContext.Type.MIXED);
|
||||||
|
|
||||||
// test SYMBOLIC
|
// test SYMBOLIC
|
||||||
alleles = Arrays.asList(Tref, symbolic);
|
alleles = Arrays.asList(Tref, symbolic);
|
||||||
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop, alleles, null, CommonInfo.NO_NEG_LOG_10PERROR, null, null, (byte)'A');
|
vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc,snpLocStart, snpLocStop, alleles, null, CommonInfo.NO_LOG10_PERROR, null, null, (byte)'A');
|
||||||
Assert.assertEquals(vc.getType(), VariantContext.Type.SYMBOLIC);
|
Assert.assertEquals(vc.getType(), VariantContext.Type.SYMBOLIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -200,7 +200,7 @@ public class VariantContextUnitTest extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCreatingDeletionVariantContext() {
|
public void testCreatingDeletionVariantContext() {
|
||||||
List<Allele> alleles = Arrays.asList(ATCref, del);
|
List<Allele> alleles = Arrays.asList(ATCref, del);
|
||||||
VariantContext vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, delLoc, delLocStart, delLocStop, alleles, null, CommonInfo.NO_NEG_LOG_10PERROR, null, null, (byte)'A');
|
VariantContext vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, delLoc, delLocStart, delLocStop, alleles, null, CommonInfo.NO_LOG10_PERROR, null, null, (byte)'A');
|
||||||
|
|
||||||
Assert.assertEquals(vc.getChr(), delLoc);
|
Assert.assertEquals(vc.getChr(), delLoc);
|
||||||
Assert.assertEquals(vc.getStart(), delLocStart);
|
Assert.assertEquals(vc.getStart(), delLocStart);
|
||||||
|
|
@ -227,7 +227,7 @@ public class VariantContextUnitTest extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCreatingInsertionVariantContext() {
|
public void testCreatingInsertionVariantContext() {
|
||||||
List<Allele> alleles = Arrays.asList(delRef, ATC);
|
List<Allele> alleles = Arrays.asList(delRef, ATC);
|
||||||
VariantContext vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, insLoc, insLocStart, insLocStop, alleles, null, CommonInfo.NO_NEG_LOG_10PERROR, null, null, (byte)'A');
|
VariantContext vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, insLoc, insLocStart, insLocStop, alleles, null, CommonInfo.NO_LOG10_PERROR, null, null, (byte)'A');
|
||||||
|
|
||||||
Assert.assertEquals(vc.getChr(), insLoc);
|
Assert.assertEquals(vc.getChr(), insLoc);
|
||||||
Assert.assertEquals(vc.getStart(), insLocStart);
|
Assert.assertEquals(vc.getStart(), insLocStart);
|
||||||
|
|
@ -550,7 +550,7 @@ public class VariantContextUnitTest extends BaseTest {
|
||||||
@Test(dataProvider = "getAlleles")
|
@Test(dataProvider = "getAlleles")
|
||||||
public void testMergeAlleles(GetAllelesTest cfg) {
|
public void testMergeAlleles(GetAllelesTest cfg) {
|
||||||
final List<Allele> altAlleles = cfg.alleles.subList(1, cfg.alleles.size());
|
final List<Allele> altAlleles = cfg.alleles.subList(1, cfg.alleles.size());
|
||||||
final VariantContext vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc, snpLocStart, snpLocStop, cfg.alleles, null, CommonInfo.NO_NEG_LOG_10PERROR, null, null, (byte)'A');
|
final VariantContext vc = new VariantContext("test", VCFConstants.EMPTY_ID_FIELD, snpLoc, snpLocStart, snpLocStop, cfg.alleles, null, CommonInfo.NO_LOG10_PERROR, null, null, (byte)'A');
|
||||||
|
|
||||||
Assert.assertEquals(vc.getAlleles(), cfg.alleles, "VC alleles not the same as input alleles");
|
Assert.assertEquals(vc.getAlleles(), cfg.alleles, "VC alleles not the same as input alleles");
|
||||||
Assert.assertEquals(vc.getNAlleles(), cfg.alleles.size(), "VC getNAlleles not the same as input alleles size");
|
Assert.assertEquals(vc.getNAlleles(), cfg.alleles.size(), "VC getNAlleles not the same as input alleles size");
|
||||||
|
|
@ -653,7 +653,7 @@ public class VariantContextUnitTest extends BaseTest {
|
||||||
Assert.assertEquals(cfg.vc.getAttributes(), cfg.copy.getAttributes());
|
Assert.assertEquals(cfg.vc.getAttributes(), cfg.copy.getAttributes());
|
||||||
Assert.assertEquals(cfg.vc.getID(), cfg.copy.getID());
|
Assert.assertEquals(cfg.vc.getID(), cfg.copy.getID());
|
||||||
Assert.assertEquals(cfg.vc.getGenotypes(), cfg.copy.getGenotypes());
|
Assert.assertEquals(cfg.vc.getGenotypes(), cfg.copy.getGenotypes());
|
||||||
Assert.assertEquals(cfg.vc.getNegLog10PError(), cfg.copy.getNegLog10PError());
|
Assert.assertEquals(cfg.vc.getLog10PError(), cfg.copy.getLog10PError());
|
||||||
Assert.assertEquals(cfg.vc.getFilters(), cfg.copy.getFilters());
|
Assert.assertEquals(cfg.vc.getFilters(), cfg.copy.getFilters());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -705,7 +705,7 @@ public class VariantContextUnitTest extends BaseTest {
|
||||||
Assert.assertEquals(sub.getChr(), vc.getChr());
|
Assert.assertEquals(sub.getChr(), vc.getChr());
|
||||||
Assert.assertEquals(sub.getStart(), vc.getStart());
|
Assert.assertEquals(sub.getStart(), vc.getStart());
|
||||||
Assert.assertEquals(sub.getEnd(), vc.getEnd());
|
Assert.assertEquals(sub.getEnd(), vc.getEnd());
|
||||||
Assert.assertEquals(sub.getNegLog10PError(), vc.getNegLog10PError());
|
Assert.assertEquals(sub.getLog10PError(), vc.getLog10PError());
|
||||||
Assert.assertEquals(sub.getFilters(), vc.getFilters());
|
Assert.assertEquals(sub.getFilters(), vc.getFilters());
|
||||||
Assert.assertEquals(sub.getID(), vc.getID());
|
Assert.assertEquals(sub.getID(), vc.getID());
|
||||||
Assert.assertEquals(sub.getReferenceBaseForIndel(), vc.getReferenceBaseForIndel());
|
Assert.assertEquals(sub.getReferenceBaseForIndel(), vc.getReferenceBaseForIndel());
|
||||||
|
|
|
||||||
|
|
@ -525,7 +525,7 @@ public class VariantContextUtilsUnitTest extends BaseTest {
|
||||||
Genotype expectedValue = expected.get(value.getSampleName());
|
Genotype expectedValue = expected.get(value.getSampleName());
|
||||||
|
|
||||||
Assert.assertEquals(value.alleles, expectedValue.alleles, "Alleles in Genotype aren't equal");
|
Assert.assertEquals(value.alleles, expectedValue.alleles, "Alleles in Genotype aren't equal");
|
||||||
Assert.assertEquals(value.getNegLog10PError(), expectedValue.getNegLog10PError(), "GQ values aren't equal");
|
Assert.assertEquals(value.getLog10PError(), expectedValue.getLog10PError(), "GQ values aren't equal");
|
||||||
Assert.assertEquals(value.hasLikelihoods(), expectedValue.hasLikelihoods(), "Either both have likelihoods or both not");
|
Assert.assertEquals(value.hasLikelihoods(), expectedValue.hasLikelihoods(), "Either both have likelihoods or both not");
|
||||||
if ( value.hasLikelihoods() )
|
if ( value.hasLikelihoods() )
|
||||||
Assert.assertEquals(value.getLikelihoods().getAsVector(), expectedValue.getLikelihoods().getAsVector(), "Genotype likelihoods aren't equal");
|
Assert.assertEquals(value.getLikelihoods().getAsVector(), expectedValue.getLikelihoods().getAsVector(), "Genotype likelihoods aren't equal");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue