diff --git a/java/build.xml b/java/build.xml new file mode 100644 index 000000000..38496e0f6 --- /dev/null +++ b/java/build.xml @@ -0,0 +1,38 @@ + + + simple build file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/src/edu/mit/broad/sting/atk/AnalysisTK.java b/java/src/edu/mit/broad/sting/atk/AnalysisTK.java index bb3b9114c..bc662ca8a 100644 --- a/java/src/edu/mit/broad/sting/atk/AnalysisTK.java +++ b/java/src/edu/mit/broad/sting/atk/AnalysisTK.java @@ -25,7 +25,8 @@ public class AnalysisTK extends CommandLineProgram { @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 Analysis_Name = null; - + @Option(shortName="DBSNP", doc="DBSNP file", optional=true) public String DBSNP_FILE = null; + public static HashMap MODULES = new HashMap(); public static void addModule(final String name, final Object walker) { System.out.printf("* Adding module %s%n", name); @@ -60,6 +61,11 @@ public class AnalysisTK extends CommandLineProgram { //dbsnp.testMe(); rods = new ReferenceOrderedData[] { dbsnp }; // { gff, dbsnp }; } + else if ( DBSNP_FILE != null ) { + ReferenceOrderedData dbsnp = new ReferenceOrderedData(new File(DBSNP_FILE), rodDbSNP.class ); + //dbsnp.testMe(); + rods = new ReferenceOrderedData[] { dbsnp }; // { gff, dbsnp }; + } else { rods = new ReferenceOrderedData[] {}; // { gff, dbsnp }; } diff --git a/java/src/edu/mit/broad/sting/utils/ReferenceOrderedData.java b/java/src/edu/mit/broad/sting/utils/ReferenceOrderedData.java index eeb7c54b5..e71d0bd44 100644 --- a/java/src/edu/mit/broad/sting/utils/ReferenceOrderedData.java +++ b/java/src/edu/mit/broad/sting/utils/ReferenceOrderedData.java @@ -2,6 +2,7 @@ package edu.mit.broad.sting.utils; import java.io.File; import java.util.Iterator; +import edu.mit.broad.picard.util.TabbedTextFileParser; /** * Class for representing arbitrary reference ordered data sets @@ -30,9 +31,14 @@ public class ReferenceOrderedData implements // // ---------------------------------------------------------------------- public void testMe() { + ReferenceOrderedDatum last = null; for ( ReferenceOrderedDatum rec : this ) { - System.out.println(rec.toString()); + if ( last == null || ! last.getContig().equals(rec.getContig()) ) { + System.out.println(rec.toString()); + } + last = rec; } + System.exit(1); } // ---------------------------------------------------------------------- @@ -41,10 +47,11 @@ public class ReferenceOrderedData implements // // ---------------------------------------------------------------------- private class SimpleRODIterator implements Iterator { - private WhitespaceTextFileParser parser = null; + //private WhitespaceTextFileParser parser = null; + private TabbedTextFileParser parser = null; public SimpleRODIterator() { - parser = new WhitespaceTextFileParser(true, file); + parser = new TabbedTextFileParser(true, file); } public boolean hasNext() { @@ -81,9 +88,11 @@ public class ReferenceOrderedData implements // Otherwise we return the first object who's start is at pos // public ROD seekForward(final String contigName, final int pos) { + final boolean DEBUG = false; + ROD result = null; - //System.out.printf(" *** starting seek to %s %d %s%n", contigName, pos, prev); + if ( DEBUG ) System.out.printf(" *** starting seek to %s %d %s%n", contigName, pos, prev); while ( hasNext() ) { ROD current = next(); //System.out.printf(" -> Seeking to %s %d AT %s %d%n", contigName, pos, current.getContig(), current.getStart()); @@ -102,18 +111,20 @@ public class ReferenceOrderedData implements } } else if ( strCmp < 0 ) { + if ( DEBUG ) System.out.printf(" -> Jumping to contig %s%n", contigName); // We've gone past the desired contig, break break; } } - /* - if ( result == null ) - ; - //System.out.printf(" --- seek result to %s %d is NULL%n", contigName, pos); - else - System.out.printf(" ### Found %s %d%n", result.getContig(), result.getStart()); - */ + if ( DEBUG ) { + if ( result == null ) + ; + //System.out.printf(" --- seek result to %s %d is NULL%n", contigName, pos); + else + System.out.printf(" ### Found %s %d%n", result.getContig(), result.getStart()); + } + // we ran out of elements or found something return result;