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
|
// ignore places where we don't have a variant
|
||||||
if ( beagleR2Feature == null || beagleProbsFeature == null || beaglePhasedFeature == null)
|
if ( beagleR2Feature == null || beagleProbsFeature == null || beaglePhasedFeature == null)
|
||||||
{
|
{
|
||||||
vcfWriter.add(vc_input);
|
vcfWriter.add(vc_input);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -249,9 +249,9 @@ public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
|
||||||
Allele bglAlleleA, bglAlleleB;
|
Allele bglAlleleA, bglAlleleB;
|
||||||
|
|
||||||
if (alleleA.matches(refString))
|
if (alleleA.matches(refString))
|
||||||
bglAlleleA = Allele.create(alleleA,true);
|
bglAlleleA = Allele.create(alleleA,true);
|
||||||
else
|
else
|
||||||
bglAlleleA = Allele.create(alleleA,false);
|
bglAlleleA = Allele.create(alleleA,false);
|
||||||
|
|
||||||
if (alleleB.matches(refString))
|
if (alleleB.matches(refString))
|
||||||
bglAlleleB = Allele.create(alleleB,true);
|
bglAlleleB = Allele.create(alleleB,true);
|
||||||
|
|
|
||||||
|
|
@ -321,6 +321,11 @@ public abstract class AbstractVCFCodec implements FeatureCodec, NameAwareCodec {
|
||||||
final LazyGenotypesContext.LazyParser lazyParser = new LazyVCFGenotypesParser(alleles, chr, pos);
|
final LazyGenotypesContext.LazyParser lazyParser = new LazyVCFGenotypesParser(alleles, chr, pos);
|
||||||
final int nGenotypes = header.getGenotypeSamples().size();
|
final int nGenotypes = header.getGenotypeSamples().size();
|
||||||
LazyGenotypesContext lazy = new LazyGenotypesContext(lazyParser, parts[8], nGenotypes);
|
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);
|
builder.genotypesNoValidation(lazy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -332,9 +337,6 @@ public abstract class AbstractVCFCodec implements FeatureCodec, NameAwareCodec {
|
||||||
generateException(e.getMessage());
|
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;
|
return vc;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -177,4 +177,11 @@ public class LazyGenotypesContext extends GenotypesContext {
|
||||||
public Object getUnparsedGenotypeData() {
|
public Object getUnparsedGenotypeData() {
|
||||||
return unparsedGenotypeData;
|
return unparsedGenotypeData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force us to decode the genotypes
|
||||||
|
*/
|
||||||
|
public void decode() {
|
||||||
|
buildCache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue