Better organization of AnalysisTK modules
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@6 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
5e3adc76fc
commit
bb55947e2e
|
|
@ -86,7 +86,7 @@ public class FilteringIterator implements CloseableIterator<SAMRecord> {
|
|||
while (iterator.hasNext()) {
|
||||
SAMRecord record = iterator.next();
|
||||
if (!filter.filterOut(record)) {
|
||||
return next;
|
||||
return record;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class AnalysisTK extends CommandLineProgram {
|
|||
@Option(shortName="R", doc="Reference sequence file", optional=true) public File REF_FILE_ARG = null;
|
||||
@Option(shortName="B", doc="Debugging output", optional=true) public String DEBUGGING_STR = null;
|
||||
@Option(shortName="L", doc="Genome region to operation on: from chr:start-end", optional=true) public String REGION_STR = null;
|
||||
@Option(shortName="T", doc="Type of analysis to run") public String AnalysisName = null;
|
||||
@Option(shortName="T", doc="Type of analysis to run") public String Analysis_Name = null;
|
||||
|
||||
public static HashMap<String, Object> MODULES = new HashMap<String,Object>();
|
||||
public static void addModule(final String name, final Object walker) {
|
||||
|
|
@ -28,13 +28,13 @@ public class AnalysisTK extends CommandLineProgram {
|
|||
}
|
||||
|
||||
static {
|
||||
addModule("EmptyLocusWalker", new EmptyLocusWalker());
|
||||
addModule("PileupWalker", new PileupWalker());
|
||||
addModule("Empty_Locus_Walker", new EmptyLocusWalker());
|
||||
addModule("Pileup", new PileupWalker());
|
||||
addModule("Empty_Read_Walker", new EmptyReadWalker());
|
||||
addModule("Base_Quality_Histogram", new BaseQualityHistoWalker());
|
||||
}
|
||||
|
||||
private TraversalEngine engine = null;
|
||||
private int nSkippedIndels = 0;
|
||||
|
||||
public boolean DEBUGGING = false;
|
||||
|
||||
/** Required main method implementation. */
|
||||
|
|
@ -45,7 +45,7 @@ public class AnalysisTK extends CommandLineProgram {
|
|||
protected int doWork() {
|
||||
this.engine = new TraversalEngine(INPUT_FILE, REF_FILE_ARG);
|
||||
|
||||
ValidationStringency strictness = ValidationStringency.STRICT;
|
||||
ValidationStringency strictness;
|
||||
if ( STRICTNESS_ARG == null ) {
|
||||
strictness = ValidationStringency.STRICT;
|
||||
}
|
||||
|
|
@ -64,10 +64,17 @@ public class AnalysisTK extends CommandLineProgram {
|
|||
engine.setDebugging(! ( DEBUGGING_STR == null || DEBUGGING_STR.toLowerCase().equals("true")));
|
||||
engine.setMaxReads(Integer.parseInt(MAX_READS_ARG));
|
||||
|
||||
//LocusWalker<Integer,Integer> walker = new EmptyLocusWalker();
|
||||
LocusWalker<?, ?> walker = (LocusWalker<?, ?>)MODULES.get(AnalysisName);
|
||||
//LocusWalker<Integer,Integer> walker = new PileupWalker();
|
||||
engine.initialize();
|
||||
engine.traverseByLoci(walker);
|
||||
try {
|
||||
LocusWalker<?, ?> walker = (LocusWalker<?, ?>)MODULES.get(Analysis_Name);
|
||||
engine.traverseByLoci(walker);
|
||||
}
|
||||
catch ( java.lang.ClassCastException e ) {
|
||||
// I guess we're a read walker LOL
|
||||
ReadWalker<?, ?> walker = (ReadWalker<?, ?>)MODULES.get(Analysis_Name);
|
||||
engine.traverseByRead(walker);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import edu.mit.broad.sting.atk.LocusContext;
|
|||
* Time: 3:22:14 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class ReadWalkerTest implements ReadWalker<Integer, Integer> {
|
||||
public class BaseQualityHistoWalker implements ReadWalker<Integer, Integer> {
|
||||
long[] qualCounts = new long[100];
|
||||
|
||||
public void initialize() {
|
||||
|
|
@ -44,8 +44,16 @@ public class ReadWalkerTest implements ReadWalker<Integer, Integer> {
|
|||
}
|
||||
|
||||
public void onTraveralDone() {
|
||||
for ( int i = 0; i < this.qualCounts.length; i++ ) {
|
||||
int lastNonZero = -1;
|
||||
for ( int i = this.qualCounts.length-1; i >= 0; i-- ) {
|
||||
if ( this.qualCounts[i] > 0 ) {
|
||||
lastNonZero = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < lastNonZero+1; i++ ) {
|
||||
System.out.printf("%3d : %10d%n", i, this.qualCounts[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package edu.mit.broad.sting.atk.modules;
|
||||
|
||||
import edu.mit.broad.sam.SAMRecord;
|
||||
import edu.mit.broad.sting.atk.ReadWalker;
|
||||
import edu.mit.broad.sting.atk.LocusContext;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: mdepristo
|
||||
* Date: Feb 22, 2009
|
||||
* Time: 3:22:14 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class EmptyReadWalker implements ReadWalker<Integer, Integer> {
|
||||
|
||||
public void initialize() { }
|
||||
|
||||
public String walkerType() { return "ByRead"; }
|
||||
|
||||
// Do we actually want to operate on the context?
|
||||
public boolean filter(LocusContext context, SAMRecord read) {
|
||||
return true; // We are keeping all the reads
|
||||
}
|
||||
|
||||
// Map over the edu.mit.broad.sting.atk.LocusContext
|
||||
public Integer map(LocusContext context, SAMRecord read) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Given result of map function
|
||||
public Integer reduceInit() { return 0; }
|
||||
public Integer reduce(Integer value, Integer sum) {
|
||||
return value + sum;
|
||||
}
|
||||
|
||||
public void onTraveralDone() {
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
java -cp out/production/AnalysisTK:../../jars/broad.jar edu.mit.broad.sting.atk.AnalysisTK $*
|
||||
java -Xmx1024m -cp out/production/AnalysisTK:../../jars/broad.jar edu.mit.broad.sting.atk.AnalysisTK $*
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
java -agentlib:hprof=cpu=samples -cp out/production/AnalysisTK:../../jars/broad.jar edu.mit.broad.sting.atk.AnalysisTK $*
|
||||
java -Xmx1024m -agentlib:hprof=cpu=samples -cp out/production/AnalysisTK:../../jars/broad.jar edu.mit.broad.sting.atk.AnalysisTK $*
|
||||
|
|
|
|||
Loading…
Reference in New Issue