ReadBackedPhasing silently ignores sites with ploidy != 2

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4272 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
fromer 2010-09-13 21:14:17 +00:00
parent 528f6344af
commit 248cc308b2
1 changed files with 92 additions and 82 deletions

View File

@ -270,18 +270,26 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
TreeMap<String, PhaseCounts> samplePhaseStats = new TreeMap<String, PhaseCounts>(); TreeMap<String, PhaseCounts> samplePhaseStats = new TreeMap<String, PhaseCounts>();
for (Map.Entry<String, Genotype> sampGtEntry : sampGenotypes.entrySet()) { for (Map.Entry<String, Genotype> sampGtEntry : sampGenotypes.entrySet()) {
logger.debug("sample = " + sampGtEntry.getKey()); logger.debug("sample = " + sampGtEntry.getKey());
boolean genotypesArePhased = true; // phase by default boolean genotypesArePhased = false; // don't phase unless we determine the phase
String samp = sampGtEntry.getKey(); String samp = sampGtEntry.getKey();
Genotype gt = sampGtEntry.getValue(); Genotype gt = sampGtEntry.getValue();
Map<String, Object> gtAttribs = null;
List<Allele> gtAlleles = null;
if (gt.getPloidy() != 2) {
gtAttribs = gt.getAttributes();
gtAlleles = gt.getAlleles();
}
else {
gtAttribs = new HashMap<String, Object>(gt.getAttributes());
BialleleSNP biall = new BialleleSNP(gt); BialleleSNP biall = new BialleleSNP(gt);
HashMap<String, Object> gtAttribs = new HashMap<String, Object>(gt.getAttributes());
if (gt.isHet()) { if (gt.isHet()) {
VariantContext prevVc = prevVr.variant; VariantContext prevVc = prevVr.variant;
Genotype prevGenotype = prevVc.getGenotype(samp); Genotype prevGenotype = prevVc.getGenotype(samp);
if (prevGenotype.isHet()) { //otherwise, can trivially phase if (prevGenotype.isHet()) {
logger.debug("NON-TRIVIALLY CARE about TOP vs. BOTTOM for: " + "\n" + biall); logger.debug("Want to phase TOP vs. BOTTOM for: " + "\n" + biall);
List<VariantAndReads> sampleWindowVaList = new LinkedList<VariantAndReads>(); List<VariantAndReads> sampleWindowVaList = new LinkedList<VariantAndReads>();
int phasingSiteIndex = -1; int phasingSiteIndex = -1;
@ -355,8 +363,10 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
sampPhaseCounts.numPhased++; sampPhaseCounts.numPhased++;
} }
} }
List<Allele> phasedAll = biall.getAllelesAsList(); gtAlleles = biall.getAllelesAsList();
Genotype phasedGt = new Genotype(gt.getSampleName(), phasedAll, gt.getNegLog10PError(), gt.getFilters(), gtAttribs, genotypesArePhased); }
Genotype phasedGt = new Genotype(gt.getSampleName(), gtAlleles, gt.getNegLog10PError(), gt.getFilters(), gtAttribs, genotypesArePhased);
phasedGtMap.put(samp, phasedGt); phasedGtMap.put(samp, phasedGt);
} }
phaseStats.addIn(new PhasingStats(samplePhaseStats)); phaseStats.addIn(new PhasingStats(samplePhaseStats));