Added decode method to LazyGenotypesContext
-- AbstractVCFCodec calls this if the samples are not sorted. Previously called getGenotypes() which didn't actually trigger the decode
This commit is contained in:
parent
ab2efe3bd3
commit
9ea7b70a02
|
|
@ -178,8 +178,8 @@ public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
|
|||
// ignore places where we don't have a variant
|
||||
if ( beagleR2Feature == null || beagleProbsFeature == null || beaglePhasedFeature == null)
|
||||
{
|
||||
vcfWriter.add(vc_input);
|
||||
return 1;
|
||||
vcfWriter.add(vc_input);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -249,9 +249,9 @@ public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
|
|||
Allele bglAlleleA, bglAlleleB;
|
||||
|
||||
if (alleleA.matches(refString))
|
||||
bglAlleleA = Allele.create(alleleA,true);
|
||||
bglAlleleA = Allele.create(alleleA,true);
|
||||
else
|
||||
bglAlleleA = Allele.create(alleleA,false);
|
||||
bglAlleleA = Allele.create(alleleA,false);
|
||||
|
||||
if (alleleB.matches(refString))
|
||||
bglAlleleB = Allele.create(alleleB,true);
|
||||
|
|
@ -280,7 +280,7 @@ public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
|
|||
// deal with numerical errors coming from limited formatting value on Beagle output files
|
||||
if (probWrongGenotype > 1 - MIN_PROB_ERROR)
|
||||
probWrongGenotype = 1 - MIN_PROB_ERROR;
|
||||
|
||||
|
||||
if (1-probWrongGenotype < noCallThreshold) {
|
||||
// quality is bad: don't call genotype
|
||||
alleles.clear();
|
||||
|
|
|
|||
|
|
@ -321,6 +321,11 @@ public abstract class AbstractVCFCodec implements FeatureCodec, NameAwareCodec {
|
|||
final LazyGenotypesContext.LazyParser lazyParser = new LazyVCFGenotypesParser(alleles, chr, pos);
|
||||
final int nGenotypes = header.getGenotypeSamples().size();
|
||||
LazyGenotypesContext lazy = new LazyGenotypesContext(lazyParser, parts[8], nGenotypes);
|
||||
|
||||
// did we resort the sample names? If so, we need to load the genotype data
|
||||
if ( !header.samplesWereAlreadySorted() )
|
||||
lazy.decode();
|
||||
|
||||
builder.genotypesNoValidation(lazy);
|
||||
}
|
||||
|
||||
|
|
@ -332,9 +337,6 @@ public abstract class AbstractVCFCodec implements FeatureCodec, NameAwareCodec {
|
|||
generateException(e.getMessage());
|
||||
}
|
||||
|
||||
// did we resort the sample names? If so, we need to load the genotype data
|
||||
if ( !header.samplesWereAlreadySorted() )
|
||||
vc.getGenotypes();
|
||||
|
||||
return vc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,4 +177,11 @@ public class LazyGenotypesContext extends GenotypesContext {
|
|||
public Object getUnparsedGenotypeData() {
|
||||
return unparsedGenotypeData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Force us to decode the genotypes
|
||||
*/
|
||||
public void decode() {
|
||||
buildCache();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue