From f19d7abba93e36c027a2ad01a1bf2b26abbfe62c Mon Sep 17 00:00:00 2001 From: depristo Date: Mon, 1 Jun 2009 14:32:12 +0000 Subject: [PATCH] Added geli compatibility mode to SingleSampleGenotyper, to enable easy linking to the geli2popsnps.py script git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@866 348d0f76-0448-11de-a6fe-93d51630548a --- .../gatk/walkers/SingleSampleGenotyper.java | 27 +++++++++++++++---- .../utils/AlleleFrequencyEstimate.java | 21 +++++++++++++++ 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/SingleSampleGenotyper.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/SingleSampleGenotyper.java index f3b87eb41..dccc7712e 100644 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/SingleSampleGenotyper.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/SingleSampleGenotyper.java @@ -36,6 +36,18 @@ public class SingleSampleGenotyper extends LocusWalker= 0 && altBaseIndex >= 0) { // Set the priors for the hom-ref, het, and non-hom ref (we don't evaluate the // possibility of a non-ref het). - double[] genotypePriors = { 0.999, 1e-3, 1e-5 }; + //double[] genotypePriors = { 0.999, 1e-3, 1e-5 }; + double[] genotypePriors = { REF_PRIOR, HETVAR_PRIOR, HOMVAR_PRIOR }; // I'm not sure what the difference between qhat and qstar is in AlleleMetrics, but // to make my life simpler, I evaluate the non-ref balances in genotypeBalances and @@ -373,8 +387,11 @@ public class SingleSampleGenotyper extends LocusWalker= lodThreshold ) { + String line = GeliOutputFormat ? alleleFreq.asGeliString() : alleleFreq.asTabularString(); + calls_file.println(line); + } + return ""; } public void onTraversalDone() diff --git a/java/src/org/broadinstitute/sting/playground/utils/AlleleFrequencyEstimate.java b/java/src/org/broadinstitute/sting/playground/utils/AlleleFrequencyEstimate.java index 3c86dedbb..407bdfba8 100755 --- a/java/src/org/broadinstitute/sting/playground/utils/AlleleFrequencyEstimate.java +++ b/java/src/org/broadinstitute/sting/playground/utils/AlleleFrequencyEstimate.java @@ -152,6 +152,27 @@ public class AlleleFrequencyEstimate { return "location sample_name ref alt genotype qhat qstar lodVsRef lodVsNextBest depth bases"; } + public static String geliHeaderString() { + return "#Sequence Position ReferenceBase NumberOfReads MaxMappingQuality BestGenotype BtrLod BtnbLod dbSNP AA AC AG AT CC CG CT GG GT TT"; + } + + public String asGeliString() + { + // #Sequence Position ReferenceBase NumberOfReads MaxMappingQuality BestGenotype BtrLod BtnbLod dbSNP AA AC AG AT CC CG CT GG GT TT + // chr1 7764136 A 48 99 CC 83.650421 9.18159 -92.83638 -18.367548 -96.91729 -96.614204 -9.185958 -23.33643 -23.033337 -101.282059 -101.583092 -101.279999 + + // chr pos ref Nreads maxMapQ genotype BtrLod BtnbLod dbSNP AA AC AG AT CC CG CT GG GT TT + return String.format("%s %16d %c %8d %d %s %.6f %.6f 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0", + location.getContig(), + location.getStart(), + ref, + depth, + -1, + genotype(), + lodVsRef, + lodVsNextBest); + } + public String asTabularString() { return String.format("%s %s %c %c %s %f %f %f %f %d %s",