- take command line arguments
- output GFF lines to a file (specified by a command line argument) - improve the GFF output string git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@240 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
8d601a6a42
commit
ede52f7359
|
|
@ -172,13 +172,8 @@ public class AlleleFrequencyMetricsWalker extends LocusWalker<AlleleFrequencyEst
|
||||||
|
|
||||||
public String reduce(AlleleFrequencyEstimate alleleFreq, String sum)
|
public String reduce(AlleleFrequencyEstimate alleleFreq, String sum)
|
||||||
{
|
{
|
||||||
// Print RESULT data for confident calls
|
|
||||||
//if ((alleleFreq.lodVsRef >= 5) || (alleleFreq.lodVsRef <= -5)) { System.out.print(alleleFreq.asTabularString()); }
|
|
||||||
//out.print(alleleFreq.asTabularString());
|
|
||||||
if ((alleleFreq.lodVsRef >= 5) || (alleleFreq.lodVsRef <= -5)) { System.out.print(alleleFreq.asGFFString()); }
|
if ((alleleFreq.lodVsRef >= 5) || (alleleFreq.lodVsRef <= -5)) { System.out.print(alleleFreq.asGFFString()); }
|
||||||
|
|
||||||
if (this.num_loci_total % 1000 == 0) { printMetrics(); }
|
if (this.num_loci_total % 1000 == 0) { printMetrics(); }
|
||||||
|
|
||||||
return "null";
|
return "null";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,23 @@ import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||||
import org.broadinstitute.sting.gatk.refdata.rodDbSNP;
|
import org.broadinstitute.sting.gatk.refdata.rodDbSNP;
|
||||||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
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 net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
public class AlleleFrequencyWalker extends LocusWalker<AlleleFrequencyEstimate, Integer> {
|
public class AlleleFrequencyWalker extends LocusWalker<AlleleFrequencyEstimate, String>
|
||||||
|
{
|
||||||
|
|
||||||
int N=2;
|
@Argument public int N;
|
||||||
int DOWNSAMPLE = 0;
|
@Argument public int DOWNSAMPLE;
|
||||||
java.util.Random random;
|
@Argument public String GFF_OUTPUT_FILE;
|
||||||
|
|
||||||
|
Random random;
|
||||||
|
PrintStream output;
|
||||||
|
|
||||||
public AlleleFrequencyEstimate map(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context)
|
public AlleleFrequencyEstimate map(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context)
|
||||||
{
|
{
|
||||||
|
|
@ -347,14 +354,17 @@ public class AlleleFrequencyWalker extends LocusWalker<AlleleFrequencyEstimate,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String confident_interval_start = "";
|
||||||
|
private double confident_interval_min_LOD = 0;
|
||||||
|
private double confident_interval_max_LOD = 0;
|
||||||
|
private boolean inside_confident_interval = false;
|
||||||
|
|
||||||
public Integer reduceInit() { return 0; }
|
public String reduceInit() { return ""; }
|
||||||
|
public String reduce(AlleleFrequencyEstimate alleleFreq, String sum)
|
||||||
public Integer reduce(AlleleFrequencyEstimate alleleFreq, Integer sum)
|
|
||||||
{
|
{
|
||||||
// Print RESULT data for confident calls
|
// Print RESULT data for confident calls
|
||||||
if ((alleleFreq.lodVsRef >= 5) || (alleleFreq.lodVsRef <= -5)) { System.out.print(alleleFreq.asGFFString()); }
|
if ((alleleFreq.lodVsRef >= 5) || (alleleFreq.lodVsRef <= -5)) { this.output.print(alleleFreq.asGFFString()); }
|
||||||
return 0;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nuc2num[];
|
static int nuc2num[];
|
||||||
|
|
@ -376,16 +386,37 @@ public class AlleleFrequencyWalker extends LocusWalker<AlleleFrequencyEstimate,
|
||||||
num2nuc[2] = 'T';
|
num2nuc[2] = 'T';
|
||||||
num2nuc[3] = 'G';
|
num2nuc[3] = 'G';
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
this.random = new java.util.Random(0);
|
this.random = new java.util.Random(0);
|
||||||
|
this.output = new PrintStream(GFF_OUTPUT_FILE);
|
||||||
if (System.getenv("N") != null) { this.N = (new Integer(System.getenv("N"))).intValue(); }
|
}
|
||||||
else { this.N = 2; }
|
catch (Exception e)
|
||||||
|
{
|
||||||
if (System.getenv("DOWNSAMPLE") != null) { this.DOWNSAMPLE = (new Integer(System.getenv("DOWNSAMPLE"))).intValue(); }
|
e.printStackTrace();
|
||||||
else { this.DOWNSAMPLE = 0; }
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if (System.getenv("N") != null) { this.N = (new Integer(System.getenv("N"))).intValue(); }
|
||||||
|
//else { this.N = 2; }
|
||||||
|
//
|
||||||
|
//if (System.getenv("DOWNSAMPLE") != null) { this.DOWNSAMPLE = (new Integer(System.getenv("DOWNSAMPLE"))).intValue(); }
|
||||||
|
//else { this.DOWNSAMPLE = 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onTraversalDone(String result)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.output.flush();
|
||||||
|
this.output.close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void print_base_qual_matrix(double [][]quals) {
|
static void print_base_qual_matrix(double [][]quals) {
|
||||||
// Print quals for debugging
|
// Print quals for debugging
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public class AlleleFrequencyEstimate {
|
||||||
{
|
{
|
||||||
String[] tokens;
|
String[] tokens;
|
||||||
tokens = location.split(":");
|
tokens = location.split(":");
|
||||||
return String.format("%s\tCALLER\tVARIANT\t%s\t%s\t%f\t.\t.\tREF \"%c\"\t;\tALT \"%c\"\t;\tFREQ %f\n",
|
return String.format("%s\tCALLER\tVARIANT\t%s\t%s\t%f\t.\t.\tREF %c\t;\tALT %c\t;\tFREQ %f\n",
|
||||||
tokens[0],
|
tokens[0],
|
||||||
tokens[1],
|
tokens[1],
|
||||||
tokens[1],
|
tokens[1],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue