Simple improvements to allele caller
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@254 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
d952790258
commit
2cd9a1597f
|
|
@ -7,6 +7,7 @@ import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||||
import org.broadinstitute.sting.playground.utils.AlleleFrequencyEstimate;
|
import org.broadinstitute.sting.playground.utils.AlleleFrequencyEstimate;
|
||||||
import org.broadinstitute.sting.utils.cmdLine.Argument;
|
import org.broadinstitute.sting.utils.cmdLine.Argument;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -18,7 +19,11 @@ public class AlleleFrequencyWalker extends LocusWalker<AlleleFrequencyEstimate,
|
||||||
{
|
{
|
||||||
@Argument public int N;
|
@Argument public int N;
|
||||||
@Argument public int DOWNSAMPLE;
|
@Argument public int DOWNSAMPLE;
|
||||||
@Argument public String GFF_OUTPUT_FILE;
|
@Argument(required=false,defaultValue="")
|
||||||
|
public String GFF_OUTPUT_FILE;
|
||||||
|
|
||||||
|
|
||||||
|
protected static Logger logger = Logger.getLogger(AlleleFrequencyWalker.class);
|
||||||
|
|
||||||
Random random;
|
Random random;
|
||||||
PrintStream output;
|
PrintStream output;
|
||||||
|
|
@ -29,6 +34,8 @@ public class AlleleFrequencyWalker extends LocusWalker<AlleleFrequencyEstimate,
|
||||||
String bases = getBases(context);
|
String bases = getBases(context);
|
||||||
double quals[][] = getOneBaseQuals(context);
|
double quals[][] = getOneBaseQuals(context);
|
||||||
|
|
||||||
|
logger.debug(String.format("In alleleFrequnecy walker: N=%d, d=%d", N, DOWNSAMPLE));
|
||||||
|
|
||||||
if ((DOWNSAMPLE != 0) && (DOWNSAMPLE < bases.length()))
|
if ((DOWNSAMPLE != 0) && (DOWNSAMPLE < bases.length()))
|
||||||
{
|
{
|
||||||
String downsampled_bases = "";
|
String downsampled_bases = "";
|
||||||
|
|
@ -88,6 +95,9 @@ public class AlleleFrequencyWalker extends LocusWalker<AlleleFrequencyEstimate,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug(String.format(" => result is %s", alleleFreq));
|
||||||
|
|
||||||
return alleleFreq;
|
return alleleFreq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -447,6 +457,9 @@ public class AlleleFrequencyWalker extends LocusWalker<AlleleFrequencyEstimate,
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.random = new java.util.Random(0);
|
this.random = new java.util.Random(0);
|
||||||
|
if ( GFF_OUTPUT_FILE == null )
|
||||||
|
this.output = out;
|
||||||
|
else
|
||||||
this.output = new PrintStream(GFF_OUTPUT_FILE);
|
this.output = new PrintStream(GFF_OUTPUT_FILE);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
@ -467,6 +480,7 @@ public class AlleleFrequencyWalker extends LocusWalker<AlleleFrequencyEstimate,
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.output.flush();
|
this.output.flush();
|
||||||
|
if ( GFF_OUTPUT_FILE != null )
|
||||||
this.output.close();
|
this.output.close();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,8 @@ public class AlleleFrequencyEstimate {
|
||||||
notes);
|
notes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString() { return asTabularString(); }
|
||||||
|
|
||||||
public String asString() {
|
public String asString() {
|
||||||
// Print out the called bases
|
// Print out the called bases
|
||||||
// Notes: switched from qhat to qstar because qhat doesn't work at n=1 (1 observed base) where having a single non-ref
|
// Notes: switched from qhat to qstar because qhat doesn't work at n=1 (1 observed base) where having a single non-ref
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue