Tried to add a poor man's version of seeing all reference sites in an interval, and failed. However, I did add the command line argument and a few pieces of useful code.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@206 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2009-03-27 00:12:35 +00:00
parent f7097c8ee7
commit 3abaaa3cc3
4 changed files with 14 additions and 8 deletions

View File

@ -47,7 +47,7 @@ public class GenomeAnalysisTK extends CommandLineProgram {
public String pluginPathName = null; public String pluginPathName = null;
private TraversalEngine engine = null; private TraversalEngine engine = null;
public boolean DEBUGGING = false; public boolean DEBUGGING = false;
public boolean WALK_ALL_LOCI = false;
/** /**
* our log, which we want to capture anything from this class * our log, which we want to capture anything from this class
@ -61,7 +61,7 @@ public class GenomeAnalysisTK extends CommandLineProgram {
* Flags don't take an argument, the associated Boolean gets set to true if the flag appears on the command line. * Flags don't take an argument, the associated Boolean gets set to true if the flag appears on the command line.
*/ */
protected void setupArgs() { protected void setupArgs() {
m_parser.addRequiredArg("input_file", "I", "SAM or BAM file for validation", "INPUT_FILE"); m_parser.addRequiredArg("input_file", "I", "SAM or BAM file", "INPUT_FILE");
m_parser.addOptionalArg("maximum_reads", "M", "Maximum number of reads to process before exiting", "MAX_READS_ARG"); m_parser.addOptionalArg("maximum_reads", "M", "Maximum number of reads to process before exiting", "MAX_READS_ARG");
m_parser.addOptionalArg("validation_strictness", "S", "How strict should we be with validation", "STRICTNESS_ARG"); m_parser.addOptionalArg("validation_strictness", "S", "How strict should we be with validation", "STRICTNESS_ARG");
m_parser.addOptionalArg("reference_sequence", "R", "Reference sequence file", "REF_FILE_ARG"); m_parser.addOptionalArg("reference_sequence", "R", "Reference sequence file", "REF_FILE_ARG");
@ -73,6 +73,7 @@ public class GenomeAnalysisTK extends CommandLineProgram {
m_parser.addOptionalFlag("unsafe", "U", "If set, enables unsafe operations, nothing will be checked at runtime.", "UNSAFE"); m_parser.addOptionalFlag("unsafe", "U", "If set, enables unsafe operations, nothing will be checked at runtime.", "UNSAFE");
m_parser.addOptionalFlag("sort_on_the_fly", "F", "If set, enables on fly sorting of reads file.", "ENABLED_SORT_ON_FLY"); m_parser.addOptionalFlag("sort_on_the_fly", "F", "If set, enables on fly sorting of reads file.", "ENABLED_SORT_ON_FLY");
m_parser.addOptionalArg("intervals_file", "V", "File containing list of genomic intervals to operate on. line := <contig> <start> <end>", "INTERVALS_FILE"); m_parser.addOptionalArg("intervals_file", "V", "File containing list of genomic intervals to operate on. line := <contig> <start> <end>", "INTERVALS_FILE");
m_parser.addOptionalArg("all_loci", "A", "Should we process all loci, not just those covered by reads", "WALK_ALL_LOCI");
} }
/** /**
@ -177,6 +178,7 @@ public class GenomeAnalysisTK extends CommandLineProgram {
engine.setSafetyChecking(!UNSAFE); engine.setSafetyChecking(!UNSAFE);
engine.setSortOnFly(ENABLED_SORT_ON_FLY); engine.setSortOnFly(ENABLED_SORT_ON_FLY);
engine.setThreadedIO(ENABLED_THREADED_IO); engine.setThreadedIO(ENABLED_THREADED_IO);
engine.setWalkOverAllSites(WALK_ALL_LOCI);
engine.initialize(); engine.initialize();
Walker my_walker = null; Walker my_walker = null;

View File

@ -82,6 +82,7 @@ public class TraversalEngine {
public boolean beSafeP = true; public boolean beSafeP = true;
public boolean SORT_ON_FLY = false; public boolean SORT_ON_FLY = false;
public boolean FILTER_UNSORTED_READS = false; public boolean FILTER_UNSORTED_READS = false;
public boolean walkOverAllSites = false;
public int MAX_ON_FLY_SORTS = 100000; public int MAX_ON_FLY_SORTS = 100000;
public long N_RECORDS_TO_PRINT = 100000; public long N_RECORDS_TO_PRINT = 100000;
public boolean THREADED_IO = false; public boolean THREADED_IO = false;
@ -134,6 +135,10 @@ public class TraversalEngine {
this.THREADED_IO = threadedIO; this.THREADED_IO = threadedIO;
} }
public void setWalkOverAllSites(final boolean walkOverAllSites) {
this.walkOverAllSites = walkOverAllSites;
}
public void setDebugging(final boolean d) { public void setDebugging(final boolean d) {
DEBUGGING = d; DEBUGGING = d;
} }
@ -633,9 +638,7 @@ public class TraversalEngine {
//System.out.format("Working at %s\n", locus.getLocation().toString()); //System.out.format("Working at %s\n", locus.getLocation().toString());
// Jump forward in the reference to this locus location ReferenceIterator refSite = refIter.seekForward(locus.getLocation());
final ReferenceIterator refSite;
refSite = refIter.seekForward(locus.getLocation());
final char refBase = refSite.getBaseAsChar(); final char refBase = refSite.getBaseAsChar();
locus.setReferenceContig(refSite.getCurrentContig()); locus.setReferenceContig(refSite.getCurrentContig());

View File

@ -50,6 +50,7 @@ public class ReferenceIterator implements Iterator<ReferenceIterator> {
public char getBaseAsChar() { return getBaseAsString().charAt(0); } public char getBaseAsChar() { return getBaseAsString().charAt(0); }
public ReferenceSequence getCurrentContig() { return currentContig; } public ReferenceSequence getCurrentContig() { return currentContig; }
public long getPosition() { return offset + 1; } public long getPosition() { return offset + 1; }
public GenomeLoc getLocation() { return new GenomeLoc( getCurrentContig().getName(), getPosition() ); }
// -------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------
// //

View File

@ -54,9 +54,9 @@ public class PileupWalker extends LocusWalker<Integer, Integer> {
if ( rodString != "" ) if ( rodString != "" )
rodString = "[ROD: " + rodString + "]"; rodString = "[ROD: " + rodString + "]";
if ( context.getLocation().getStart() % 1 == 0 ) { //if ( context.getLocation().getStart() % 1 == 0 ) {
System.out.printf("%s: %s %s %s %s%n", context.getLocation(), ref, bases, quals, rodString); System.out.printf("%s: %s %s %s %s%n", context.getLocation(), ref, bases, quals, rodString);
} //}
return 1; return 1;
} }