Renaming of ATK to GATK, the genome analysis TK.
Also added several more layers of error checking git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@53 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
a38a038204
commit
c9cb7a3596
|
|
@ -61,7 +61,7 @@
|
||||||
<jar jarfile="${dist}/AnalysisTK.jar" basedir="${build}">
|
<jar jarfile="${dist}/AnalysisTK.jar" basedir="${build}">
|
||||||
<manifest>
|
<manifest>
|
||||||
<attribute name="Class-Path" value="${jar.classpath}" />
|
<attribute name="Class-Path" value="${jar.classpath}" />
|
||||||
<attribute name="Main-Class" value="org.broadinstitute.sting.atk.AnalysisTK" />
|
<attribute name="Main-Class" value="org.broadinstitute.sting.gatkk.GenomeAnalysisTK" />
|
||||||
</manifest>
|
</manifest>
|
||||||
</jar>
|
</jar>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
package org.broadinstitute.sting.atk;
|
package org.broadinstitute.sting.gatk;
|
||||||
|
|
||||||
import net.sf.samtools.SAMFileReader.ValidationStringency;
|
import net.sf.samtools.SAMFileReader.ValidationStringency;
|
||||||
import edu.mit.broad.picard.cmdline.CommandLineProgram;
|
import edu.mit.broad.picard.cmdline.CommandLineProgram;
|
||||||
import edu.mit.broad.picard.cmdline.Usage;
|
import edu.mit.broad.picard.cmdline.Usage;
|
||||||
import edu.mit.broad.picard.cmdline.Option;
|
import edu.mit.broad.picard.cmdline.Option;
|
||||||
|
|
||||||
import org.broadinstitute.sting.atk.modules.*;
|
import org.broadinstitute.sting.gatk.walkers.*;
|
||||||
import org.broadinstitute.sting.utils.ReferenceOrderedData;
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedData;
|
||||||
import org.broadinstitute.sting.utils.rodGFF;
|
import org.broadinstitute.sting.gatk.refdata.rodDbSNP;
|
||||||
import org.broadinstitute.sting.utils.rodDbSNP;
|
import org.broadinstitute.sting.gatk.refdata.rodGFF;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class AnalysisTK extends CommandLineProgram {
|
public class GenomeAnalysisTK extends CommandLineProgram {
|
||||||
// Usage and parameters
|
// Usage and parameters
|
||||||
@Usage(programVersion="0.1") public String USAGE = "SAM Validator\n";
|
@Usage(programVersion="0.1") public String USAGE = "SAM Validator\n";
|
||||||
@Option(shortName="I", doc="SAM or BAM file for validation") public File INPUT_FILE;
|
@Option(shortName="I", doc="SAM or BAM file for validation") public File INPUT_FILE;
|
||||||
|
|
@ -49,7 +49,7 @@ public class AnalysisTK extends CommandLineProgram {
|
||||||
|
|
||||||
/** Required main method implementation. */
|
/** Required main method implementation. */
|
||||||
public static void main(String[] argv) {
|
public static void main(String[] argv) {
|
||||||
System.exit(new AnalysisTK().instanceMain(argv));
|
System.exit(new GenomeAnalysisTK().instanceMain(argv));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int doWork() {
|
protected int doWork() {
|
||||||
|
|
@ -75,7 +75,6 @@ public class AnalysisTK extends CommandLineProgram {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.engine = new TraversalEngine(INPUT_FILE, REF_FILE_ARG, rods);
|
this.engine = new TraversalEngine(INPUT_FILE, REF_FILE_ARG, rods);
|
||||||
//engine.testReference();
|
|
||||||
|
|
||||||
ValidationStringency strictness;
|
ValidationStringency strictness;
|
||||||
if ( STRICTNESS_ARG == null ) {
|
if ( STRICTNESS_ARG == null ) {
|
||||||
|
|
@ -96,12 +95,13 @@ public class AnalysisTK extends CommandLineProgram {
|
||||||
engine.setDebugging(! ( DEBUGGING_STR == null || DEBUGGING_STR.toLowerCase().equals("true")));
|
engine.setDebugging(! ( DEBUGGING_STR == null || DEBUGGING_STR.toLowerCase().equals("true")));
|
||||||
engine.setMaxReads(Integer.parseInt(MAX_READS_ARG));
|
engine.setMaxReads(Integer.parseInt(MAX_READS_ARG));
|
||||||
|
|
||||||
engine.initialize(ENABLED_THREADED_IO.toLowerCase().equals("true"));
|
|
||||||
|
|
||||||
if ( REGION_STR != null ) {
|
if ( REGION_STR != null ) {
|
||||||
engine.setLocation(REGION_STR);
|
engine.setLocation(REGION_STR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
engine.initialize(ENABLED_THREADED_IO.toLowerCase().equals("true"));
|
||||||
|
//engine.testReference();
|
||||||
|
|
||||||
//LocusWalker<Integer,Integer> walker = new PileupWalker();
|
//LocusWalker<Integer,Integer> walker = new PileupWalker();
|
||||||
|
|
||||||
// Try to get the module specified
|
// Try to get the module specified
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.broadinstitute.sting.atk;
|
package org.broadinstitute.sting.gatk;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
|
|
||||||
|
|
@ -1,16 +1,17 @@
|
||||||
package org.broadinstitute.sting.atk;
|
package org.broadinstitute.sting.gatk;
|
||||||
|
|
||||||
import net.sf.samtools.SAMFileReader.ValidationStringency;
|
|
||||||
import net.sf.samtools.SAMSequenceRecord;
|
import net.sf.samtools.SAMSequenceRecord;
|
||||||
import edu.mit.broad.picard.cmdline.CommandLineProgram;
|
import edu.mit.broad.picard.cmdline.CommandLineProgram;
|
||||||
import edu.mit.broad.picard.cmdline.Usage;
|
import edu.mit.broad.picard.cmdline.Usage;
|
||||||
import edu.mit.broad.picard.cmdline.Option;
|
import edu.mit.broad.picard.cmdline.Option;
|
||||||
import edu.mit.broad.picard.reference.ReferenceSequenceFileFactory;
|
import edu.mit.broad.picard.reference.ReferenceSequenceFileFactory;
|
||||||
import edu.mit.broad.picard.reference.ReferenceSequence;
|
|
||||||
import edu.mit.broad.picard.reference.ReferenceSequenceFile;
|
import edu.mit.broad.picard.reference.ReferenceSequenceFile;
|
||||||
|
|
||||||
import org.broadinstitute.sting.atk.modules.*;
|
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedData;
|
||||||
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||||
|
import org.broadinstitute.sting.gatk.refdata.rodDbSNP;
|
||||||
|
import org.broadinstitute.sting.gatk.refdata.rodGFF;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
package org.broadinstitute.sting.atk;
|
package org.broadinstitute.sting.gatk;
|
||||||
|
|
||||||
import net.sf.samtools.*;
|
import net.sf.samtools.*;
|
||||||
import net.sf.samtools.SAMFileReader.ValidationStringency;
|
import net.sf.samtools.SAMFileReader.ValidationStringency;
|
||||||
import net.sf.samtools.util.CloseableIterator;
|
|
||||||
import net.sf.samtools.util.RuntimeIOException;
|
import net.sf.samtools.util.RuntimeIOException;
|
||||||
import edu.mit.broad.picard.filter.SamRecordFilter;
|
import edu.mit.broad.picard.filter.SamRecordFilter;
|
||||||
import edu.mit.broad.picard.filter.FilteringIterator;
|
import edu.mit.broad.picard.filter.FilteringIterator;
|
||||||
|
|
@ -10,6 +9,11 @@ import edu.mit.broad.picard.reference.ReferenceSequenceFile;
|
||||||
import edu.mit.broad.picard.reference.ReferenceSequenceFileFactory;
|
import edu.mit.broad.picard.reference.ReferenceSequenceFileFactory;
|
||||||
import edu.mit.broad.picard.reference.ReferenceSequence;
|
import edu.mit.broad.picard.reference.ReferenceSequence;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
|
import org.broadinstitute.sting.gatk.iterators.*;
|
||||||
|
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||||
|
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedData;
|
||||||
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -22,8 +26,11 @@ import net.sf.functionalj.Functions;
|
||||||
import net.sf.functionalj.util.Operators;
|
import net.sf.functionalj.util.Operators;
|
||||||
|
|
||||||
public class TraversalEngine {
|
public class TraversalEngine {
|
||||||
// Usage and parameters
|
// list of reference ordered data objects
|
||||||
private List<ReferenceOrderedData> rods = null; // list of reference ordered data objects
|
private List<ReferenceOrderedData> rods = null;
|
||||||
|
|
||||||
|
// Iterator over rods
|
||||||
|
List<ReferenceOrderedData.RODIterator> rodIters;
|
||||||
|
|
||||||
//private String regionStr = null; // String dec
|
//private String regionStr = null; // String dec
|
||||||
//private String traversalType = null; // String describing this traversal type
|
//private String traversalType = null; // String describing this traversal type
|
||||||
|
|
@ -262,9 +269,17 @@ public class TraversalEngine {
|
||||||
*/
|
*/
|
||||||
public boolean initialize(final boolean THREADED_IO) {
|
public boolean initialize(final boolean THREADED_IO) {
|
||||||
lastProgressPrintTime = startTime = System.currentTimeMillis();
|
lastProgressPrintTime = startTime = System.currentTimeMillis();
|
||||||
loadReference();
|
initializeReference();
|
||||||
|
initializeReads(THREADED_IO);
|
||||||
|
// Initial the reference ordered data iterators
|
||||||
|
initializeRODs();
|
||||||
|
|
||||||
//testReference();
|
//testReference();
|
||||||
//loadReference();
|
//loadReference();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeReads(final boolean THREADED_IO) {
|
||||||
try {
|
try {
|
||||||
final FileInputStream samFileStream = new FileInputStream(readsFile);
|
final FileInputStream samFileStream = new FileInputStream(readsFile);
|
||||||
final InputStream bufferedStream= new BufferedInputStream(samFileStream);
|
final InputStream bufferedStream= new BufferedInputStream(samFileStream);
|
||||||
|
|
@ -276,7 +291,7 @@ public class TraversalEngine {
|
||||||
System.err.println("Sort order is: " + header.getSortOrder());
|
System.err.println("Sort order is: " + header.getSortOrder());
|
||||||
|
|
||||||
samReadingTracker = new FileProgressTracker<SAMRecord>( readsFile, samReader.iterator(), samFileStream.getChannel(), 1000 );
|
samReadingTracker = new FileProgressTracker<SAMRecord>( readsFile, samReader.iterator(), samFileStream.getChannel(), 1000 );
|
||||||
samReadIter = samReadingTracker;
|
samReadIter = new VerifyingSamIterator(samReadingTracker);
|
||||||
|
|
||||||
if ( THREADED_IO ) {
|
if ( THREADED_IO ) {
|
||||||
System.out.printf("Enabling threaded I/O with buffer of %d reads%n", THREADED_IO_BUFFER_SIZE);
|
System.out.printf("Enabling threaded I/O with buffer of %d reads%n", THREADED_IO_BUFFER_SIZE);
|
||||||
|
|
@ -287,8 +302,6 @@ public class TraversalEngine {
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
throw new RuntimeIOException(e);
|
throw new RuntimeIOException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -296,11 +309,14 @@ public class TraversalEngine {
|
||||||
* Prepare the reference for stream processing
|
* Prepare the reference for stream processing
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void loadReference() {
|
protected void initializeReference() {
|
||||||
if ( refFileName!= null ) {
|
if ( refFileName!= null ) {
|
||||||
this.refFile = ReferenceSequenceFileFactory.getReferenceSequenceFile(refFileName);
|
this.refFile = ReferenceSequenceFileFactory.getReferenceSequenceFile(refFileName);
|
||||||
this.refIter = new ReferenceIterator(this.refFile);
|
this.refIter = new ReferenceIterator(this.refFile);
|
||||||
Utils.setupRefContigOrdering(this.refFile);
|
if ( ! Utils.setupRefContigOrdering(this.refFile) ) {
|
||||||
|
// We couldn't process the reference contig ordering, fail since we need it
|
||||||
|
throw new RuntimeException("We couldn't load the contig dictionary associated with %s. At the current time we require this dictionary file to efficiently access the FASTA file. In the near future this program will automatically construct the dictionary for you and save it down.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -311,7 +327,7 @@ public class TraversalEngine {
|
||||||
*/
|
*/
|
||||||
protected List<ReferenceOrderedData.RODIterator> initializeRODs() {
|
protected List<ReferenceOrderedData.RODIterator> initializeRODs() {
|
||||||
// set up reference ordered data
|
// set up reference ordered data
|
||||||
List<ReferenceOrderedData.RODIterator> rodIters = new ArrayList<ReferenceOrderedData.RODIterator>();
|
rodIters = new ArrayList<ReferenceOrderedData.RODIterator>();
|
||||||
for ( ReferenceOrderedData data : rods ) {
|
for ( ReferenceOrderedData data : rods ) {
|
||||||
rodIters.add(data.iterator());
|
rodIters.add(data.iterator());
|
||||||
}
|
}
|
||||||
|
|
@ -413,14 +429,12 @@ public class TraversalEngine {
|
||||||
//LocusIterator iter = new SingleLocusIterator(filterIter);
|
//LocusIterator iter = new SingleLocusIterator(filterIter);
|
||||||
LocusIterator iter = new LocusIteratorByHanger(filterIter);
|
LocusIterator iter = new LocusIteratorByHanger(filterIter);
|
||||||
|
|
||||||
// Initial the reference ordered data iterators
|
|
||||||
List<ReferenceOrderedData.RODIterator> rodIters = initializeRODs();
|
|
||||||
|
|
||||||
// initialize the walker object
|
// initialize the walker object
|
||||||
walker.initialize();
|
walker.initialize();
|
||||||
// Initialize the T sum using the walker
|
// Initialize the T sum using the walker
|
||||||
T sum = walker.reduceInit();
|
T sum = walker.reduceInit();
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
|
GenomeLoc prevLoc = null;
|
||||||
|
|
||||||
while ( iter.hasNext() && ! done ) {
|
while ( iter.hasNext() && ! done ) {
|
||||||
this.nRecords++;
|
this.nRecords++;
|
||||||
|
|
@ -429,7 +443,10 @@ public class TraversalEngine {
|
||||||
final LocusContext locus = iter.next();
|
final LocusContext locus = iter.next();
|
||||||
|
|
||||||
// Poor man's version of index LOL
|
// Poor man's version of index LOL
|
||||||
if ( inLocations(locus.getLocation()) ) {
|
GenomeLoc curLoc = locus.getLocation();
|
||||||
|
if ( inLocations(curLoc) ) {
|
||||||
|
if ( prevLoc != null && curLoc.compareContigs(prevLoc) != 0 )
|
||||||
|
System.out.printf("Traversing to next chromosome...%n");
|
||||||
|
|
||||||
// Jump forward in the reference to this locus location
|
// Jump forward in the reference to this locus location
|
||||||
final ReferenceIterator refSite = refIter.seekForward(locus.getLocation());
|
final ReferenceIterator refSite = refIter.seekForward(locus.getLocation());
|
||||||
|
|
@ -522,3 +539,4 @@ public class TraversalEngine {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,16 +1,11 @@
|
||||||
package org.broadinstitute.sting.atk;
|
package org.broadinstitute.sting.gatk.iterators;
|
||||||
|
|
||||||
import net.sf.samtools.util.CloseableIterator;
|
import net.sf.samtools.util.CloseableIterator;
|
||||||
import net.sf.samtools.SAMRecord;
|
|
||||||
import org.broadinstitute.sting.utils.PushbackIterator;
|
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
|
||||||
import org.broadinstitute.sting.utils.Predicate;
|
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterator that traverses a SAM File, accumulating information on a per-locus basis
|
* Iterator that traverses a SAM File, accumulating information on a per-locus basis
|
||||||
*/
|
*/
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.broadinstitute.sting.atk;
|
package org.broadinstitute.sting.gatk.iterators;
|
||||||
|
|
||||||
import net.sf.samtools.util.CloseableIterator;
|
import net.sf.samtools.util.CloseableIterator;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
|
|
@ -9,6 +9,9 @@ import java.util.List;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.RefHanger;
|
import org.broadinstitute.sting.utils.RefHanger;
|
||||||
|
import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
||||||
|
import org.broadinstitute.sting.gatk.iterators.LocusIterator;
|
||||||
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterator that traverses a SAM File, accumulating information on a per-locus basis
|
* Iterator that traverses a SAM File, accumulating information on a per-locus basis
|
||||||
|
|
@ -27,7 +30,7 @@ public class LocusIteratorByHanger extends LocusIterator {
|
||||||
final int INCREMENT_SIZE = 100;
|
final int INCREMENT_SIZE = 100;
|
||||||
final boolean DEBUG = false;
|
final boolean DEBUG = false;
|
||||||
|
|
||||||
/**
|
/** sy
|
||||||
* Useful class for forwarding on locusContext data from this iterator
|
* Useful class for forwarding on locusContext data from this iterator
|
||||||
*/
|
*/
|
||||||
public class MyLocusContext implements LocusContext {
|
public class MyLocusContext implements LocusContext {
|
||||||
|
|
@ -145,15 +148,23 @@ public class LocusIteratorByHanger extends LocusIterator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private final boolean currentPositionIsFullyCovered() {
|
private final boolean currentPositionIsFullyCovered() {
|
||||||
final SAMRecord read = it.next();
|
if ( ! it.hasNext() ) // if there are no more reads, we are fully covered
|
||||||
GenomeLoc readLoc = new GenomeLoc(read.getReferenceName(), read.getAlignmentStart());
|
return true;
|
||||||
final boolean coveredP = currentPositionIsFullyCovered(readLoc);
|
else {
|
||||||
if ( coveredP )
|
final SAMRecord read = it.peek();
|
||||||
it.pushback(read);
|
GenomeLoc readLoc = Utils.genomicLocationOf(read);
|
||||||
return coveredP;
|
final boolean coveredP = currentPositionIsFullyCovered(readLoc);
|
||||||
|
//System.out.printf("CoverP = %s => %b%n", readLoc, coveredP);
|
||||||
|
return coveredP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void expandWindow(final int incrementSize) {
|
private final void expandWindow(final int incrementSize) {
|
||||||
|
if ( DEBUG ) {
|
||||||
|
System.out.printf("entering expandWindow..., hasNext=%b%n", it.hasNext());
|
||||||
|
printState();
|
||||||
|
}
|
||||||
|
|
||||||
while ( it.hasNext() ) {
|
while ( it.hasNext() ) {
|
||||||
if ( DEBUG ) {
|
if ( DEBUG ) {
|
||||||
System.out.printf("Expanding window%n");
|
System.out.printf("Expanding window%n");
|
||||||
|
|
@ -162,7 +173,7 @@ public class LocusIteratorByHanger extends LocusIterator {
|
||||||
|
|
||||||
SAMRecord read = it.next();
|
SAMRecord read = it.next();
|
||||||
|
|
||||||
GenomeLoc readLoc = new GenomeLoc(read.getReferenceName(), read.getAlignmentStart());
|
GenomeLoc readLoc = Utils.genomicLocationOf(read);
|
||||||
if ( DEBUG ) {
|
if ( DEBUG ) {
|
||||||
System.out.printf(" Expanding window sizes %d with %d : left=%s, right=%s, readLoc = %s, cmp=%d%n",
|
System.out.printf(" Expanding window sizes %d with %d : left=%s, right=%s, readLoc = %s, cmp=%d%n",
|
||||||
readHanger.size(), incrementSize,
|
readHanger.size(), incrementSize,
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
* This software is supplied without any warranty or guaranteed support whatsoever. Neither
|
* This software is supplied without any warranty or guaranteed support whatsoever. Neither
|
||||||
* the Broad Institute nor MIT can be responsible for its use, misuse, or functionality.
|
* the Broad Institute nor MIT can be responsible for its use, misuse, or functionality.
|
||||||
*/
|
*/
|
||||||
package org.broadinstitute.sting.utils;
|
package org.broadinstitute.sting.gatk.iterators;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
|
@ -23,16 +23,25 @@ public class PushbackIterator<T> implements Iterator<T> {
|
||||||
return pushedElement != null || underlyingIterator.hasNext();
|
return pushedElement != null || underlyingIterator.hasNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public T peek() {
|
||||||
|
T x = next();
|
||||||
|
pushback(x);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
public T next() {
|
public T next() {
|
||||||
if (pushedElement != null) {
|
if (pushedElement != null) {
|
||||||
final T ret = pushedElement;
|
final T ret = pushedElement;
|
||||||
pushedElement = null;
|
pushedElement = null;
|
||||||
return ret;
|
return ret;
|
||||||
|
} else {
|
||||||
|
return underlyingIterator.next();
|
||||||
}
|
}
|
||||||
return underlyingIterator.next();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pushback(T elt) {
|
public void pushback(T elt) {
|
||||||
|
assert(pushedElement == null);
|
||||||
|
|
||||||
pushedElement = elt;
|
pushedElement = elt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.broadinstitute.sting.utils;
|
package org.broadinstitute.sting.gatk.iterators;
|
||||||
|
|
||||||
import edu.mit.broad.picard.reference.ReferenceSequenceFile;
|
import edu.mit.broad.picard.reference.ReferenceSequenceFile;
|
||||||
import edu.mit.broad.picard.reference.ReferenceSequence;
|
import edu.mit.broad.picard.reference.ReferenceSequence;
|
||||||
|
|
@ -7,6 +7,8 @@ import net.sf.samtools.util.StringUtil;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Created by IntelliJ IDEA.
|
||||||
* User: depristo
|
* User: depristo
|
||||||
|
|
@ -119,6 +121,8 @@ public class ReferenceIterator implements Iterator<ReferenceIterator> {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
//System.out.printf("Seeking to contig %s, cur=%s, next=%s%n", contigName, currentContig.getName(),
|
||||||
|
// nextContig != null ? nextContig.getName() : "not loaded yet");
|
||||||
// go searching through the reference
|
// go searching through the reference
|
||||||
if ( ! loadNextContig() ) {
|
if ( ! loadNextContig() ) {
|
||||||
// never found anything
|
// never found anything
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
package org.broadinstitute.sting.atk;
|
package org.broadinstitute.sting.gatk.iterators;
|
||||||
|
|
||||||
import net.sf.samtools.util.CloseableIterator;
|
import net.sf.samtools.util.CloseableIterator;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import org.broadinstitute.sting.utils.PushbackIterator;
|
import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
||||||
|
import org.broadinstitute.sting.gatk.iterators.LocusIterator;
|
||||||
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import org.broadinstitute.sting.utils.Predicate;
|
import org.broadinstitute.sting.utils.Predicate;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.broadinstitute.sting.utils;
|
package org.broadinstitute.sting.gatk.iterators;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
package org.broadinstitute.sting.gatk.iterators;
|
||||||
|
|
||||||
|
import net.sf.samtools.SAMRecord;
|
||||||
|
import net.sf.samtools.util.RuntimeIOException;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by IntelliJ IDEA.
|
||||||
|
* User: mdepristo
|
||||||
|
* Date: Mar 15, 2009
|
||||||
|
* Time: 6:02:31 PM
|
||||||
|
* To change this template use File | Settings | File Templates.
|
||||||
|
*/
|
||||||
|
public class VerifyingSamIterator implements Iterator<SAMRecord> {
|
||||||
|
Iterator<SAMRecord> it;
|
||||||
|
SAMRecord last = null;
|
||||||
|
boolean checkOrderP = true;
|
||||||
|
|
||||||
|
public VerifyingSamIterator(Iterator<SAMRecord> it) {
|
||||||
|
this.it = it;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasNext() { return this.it.hasNext(); }
|
||||||
|
public SAMRecord next() {
|
||||||
|
|
||||||
|
SAMRecord cur = it.next();
|
||||||
|
if ( last != null )
|
||||||
|
verifyRecord(last, cur);
|
||||||
|
last = cur;
|
||||||
|
return cur;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void verifyRecord( final SAMRecord last, final SAMRecord cur ) {
|
||||||
|
if ( checkOrderP ) {
|
||||||
|
GenomeLoc lastLoc = Utils.genomicLocationOf( last );
|
||||||
|
GenomeLoc curLoc = Utils.genomicLocationOf( cur );
|
||||||
|
|
||||||
|
//System.out.printf("VerifyingRecords %s %s%n", lastLoc, curLoc );
|
||||||
|
|
||||||
|
if ( curLoc.compareTo(lastLoc) == -1 )
|
||||||
|
throw new RuntimeIOException(String.format("Reads are out of order:%nlast:%n%s%ncurrent%n%s%n", last.format(), cur.format()) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void remove() {
|
||||||
|
throw new UnsupportedOperationException("Can not remove records from a SAM file via an iterator!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package org.broadinstitute.sting.utils;
|
package org.broadinstitute.sting.gatk.refdata;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
@ -9,6 +8,8 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import edu.mit.broad.picard.util.TabbedTextFileParser;
|
import edu.mit.broad.picard.util.TabbedTextFileParser;
|
||||||
|
import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
||||||
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for representing arbitrary reference ordered data sets
|
* Class for representing arbitrary reference ordered data sets
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
package org.broadinstitute.sting.utils;
|
package org.broadinstitute.sting.gatk.refdata;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Created by IntelliJ IDEA.
|
||||||
|
|
@ -1,16 +1,13 @@
|
||||||
package org.broadinstitute.sting.utils;
|
package org.broadinstitute.sting.gatk.refdata;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
|
||||||
import net.sf.samtools.util.CloseableIterator;
|
|
||||||
import edu.mit.broad.picard.util.TabbedTextFileParser;
|
|
||||||
import edu.mit.broad.picard.util.SequenceUtil;
|
import edu.mit.broad.picard.util.SequenceUtil;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.BufferedInputStream;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||||
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Example format:
|
* Example format:
|
||||||
* 585 chr1 433 433 rs56289060 0 + - - -/C genomic insertion unknown 0 0 unknown between 1
|
* 585 chr1 433 433 rs56289060 0 + - - -/C genomic insertion unknown 0 0 unknown between 1
|
||||||
|
|
@ -1,16 +1,10 @@
|
||||||
package org.broadinstitute.sting.utils;
|
package org.broadinstitute.sting.gatk.refdata;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
|
||||||
import net.sf.samtools.util.CloseableIterator;
|
|
||||||
import edu.mit.broad.picard.util.TabbedTextFileParser;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.BufferedInputStream;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||||
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for representing arbitrary reference ordered data sets
|
* Class for representing arbitrary reference ordered data sets
|
||||||
*
|
*
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
package org.broadinstitute.sting.atk.modules;
|
package org.broadinstitute.sting.gatk.walkers;
|
||||||
|
|
||||||
import org.broadinstitute.sting.atk.LocusIterator;
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
import org.broadinstitute.sting.atk.LocusContext;
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||||
import org.broadinstitute.sting.utils.ReferenceOrderedDatum;
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package org.broadinstitute.sting.atk.modules;
|
package org.broadinstitute.sting.gatk.walkers;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import org.broadinstitute.sting.atk.ReadWalker;
|
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
import org.broadinstitute.sting.atk.LocusContext;
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Created by IntelliJ IDEA.
|
||||||
|
|
@ -27,7 +27,7 @@ public class BaseQualityHistoWalker implements ReadWalker<Integer, Integer> {
|
||||||
return true; // We are keeping all the reads
|
return true; // We are keeping all the reads
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map over the org.broadinstitute.sting.atk.LocusContext
|
// Map over the org.broadinstitute.sting.gatk.LocusContext
|
||||||
public Integer map(LocusContext context, SAMRecord read) {
|
public Integer map(LocusContext context, SAMRecord read) {
|
||||||
for ( byte qual : read.getBaseQualities() ) {
|
for ( byte qual : read.getBaseQualities() ) {
|
||||||
//System.out.println(qual);
|
//System.out.println(qual);
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
package org.broadinstitute.sting.atk.modules;
|
package org.broadinstitute.sting.gatk.walkers;
|
||||||
|
|
||||||
import org.broadinstitute.sting.atk.LocusWalker;
|
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||||
import org.broadinstitute.sting.atk.LocusIterator;
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
import org.broadinstitute.sting.atk.LocusContext;
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||||
import org.broadinstitute.sting.utils.ReferenceOrderedDatum;
|
|
||||||
import net.sf.samtools.SAMRecord;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -27,7 +25,8 @@ public abstract class BasicLociWalker<MapType, ReduceType> implements LocusWalke
|
||||||
return true; // We are keeping all the reads
|
return true; // We are keeping all the reads
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTraveralDone() {
|
public void onTraversalDone() {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
// These three capabilities must be overidden
|
// These three capabilities must be overidden
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package org.broadinstitute.sting.atk.modules;
|
package org.broadinstitute.sting.gatk.walkers;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import org.broadinstitute.sting.atk.LocusContext;
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
import org.broadinstitute.sting.atk.ReadWalker;
|
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Created by IntelliJ IDEA.
|
||||||
|
|
@ -20,8 +20,8 @@ public abstract class BasicReadWalker<MapType, ReduceType> implements ReadWalker
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTraveralDone() {
|
public void onTraversalDone() {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Three basic abstract function that *must* be overridden
|
// Three basic abstract function that *must* be overridden
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package org.broadinstitute.sting.atk.modules;
|
package org.broadinstitute.sting.gatk.walkers;
|
||||||
|
|
||||||
import org.broadinstitute.sting.atk.LocusContext;
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
import org.broadinstitute.sting.utils.ReferenceOrderedDatum;
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package org.broadinstitute.sting.atk.modules;
|
package org.broadinstitute.sting.gatk.walkers;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import org.broadinstitute.sting.atk.LocusContext;
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
|
|
||||||
public class CountReadsWalker extends BasicReadWalker<Integer, Integer> {
|
public class CountReadsWalker extends BasicReadWalker<Integer, Integer> {
|
||||||
public Integer map(LocusContext context, SAMRecord read) {
|
public Integer map(LocusContext context, SAMRecord read) {
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
package org.broadinstitute.sting.atk.modules;
|
package org.broadinstitute.sting.gatk.walkers;
|
||||||
|
|
||||||
import org.broadinstitute.sting.atk.LocusContext;
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
import org.broadinstitute.sting.utils.ReferenceOrderedDatum;
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Created by IntelliJ IDEA.
|
||||||
* User: mdepristo
|
* User: mdepristo
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package org.broadinstitute.sting.atk;
|
package org.broadinstitute.sting.gatk.walkers;
|
||||||
|
|
||||||
import org.broadinstitute.sting.atk.LocusIterator;
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||||
import org.broadinstitute.sting.utils.ReferenceOrderedDatum;
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ public interface LocusWalker<MapType, ReduceType> {
|
||||||
// Do we actually want to operate on the context?
|
// Do we actually want to operate on the context?
|
||||||
boolean filter(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context);
|
boolean filter(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context);
|
||||||
|
|
||||||
// Map over the org.broadinstitute.sting.atk.LocusContext
|
// Map over the org.broadinstitute.sting.gatk.LocusContext
|
||||||
MapType map(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context);
|
MapType map(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context);
|
||||||
|
|
||||||
// Given result of map function
|
// Given result of map function
|
||||||
|
|
@ -1,12 +1,8 @@
|
||||||
package org.broadinstitute.sting.atk.modules;
|
package org.broadinstitute.sting.gatk.walkers;
|
||||||
|
|
||||||
import org.broadinstitute.sting.atk.LocusWalker;
|
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||||
import org.broadinstitute.sting.atk.LocusIterator;
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
import org.broadinstitute.sting.atk.LocusContext;
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||||
import org.broadinstitute.sting.utils.ReferenceOrderedDatum;
|
|
||||||
import org.broadinstitute.sting.utils.rodDbSNP;
|
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
|
||||||
import net.sf.samtools.SAMRecord;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -24,7 +20,7 @@ public class NullWalker implements LocusWalker<Integer, Integer> {
|
||||||
return true; // We are keeping all the reads
|
return true; // We are keeping all the reads
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map over the org.broadinstitute.sting.atk.LocusContext
|
// Map over the org.broadinstitute.sting.gatk.LocusContext
|
||||||
public Integer map(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context)
|
public Integer map(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -40,6 +36,6 @@ public class NullWalker implements LocusWalker<Integer, Integer> {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTraveralDone() {
|
public void onTraversalDone() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
package org.broadinstitute.sting.atk.modules;
|
package org.broadinstitute.sting.gatk.walkers;
|
||||||
|
|
||||||
import org.broadinstitute.sting.atk.LocusWalker;
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
import org.broadinstitute.sting.atk.LocusIterator;
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||||
import org.broadinstitute.sting.atk.LocusContext;
|
import org.broadinstitute.sting.gatk.refdata.rodDbSNP;
|
||||||
import org.broadinstitute.sting.utils.ReferenceOrderedDatum;
|
|
||||||
import org.broadinstitute.sting.utils.rodDbSNP;
|
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -17,7 +14,7 @@ import java.util.List;
|
||||||
* Time: 3:22:14 PM
|
* Time: 3:22:14 PM
|
||||||
* To change this template use File | Settings | File Templates.
|
* To change this template use File | Settings | File Templates.
|
||||||
*/
|
*/
|
||||||
public class PileupWalker implements LocusWalker<Integer, Integer> {
|
public class PileupWalker extends BasicLociWalker<Integer, Integer> {
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -28,7 +25,7 @@ public class PileupWalker implements LocusWalker<Integer, Integer> {
|
||||||
return true; // We are keeping all the reads
|
return true; // We are keeping all the reads
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map over the org.broadinstitute.sting.atk.LocusContext
|
// Map over the org.broadinstitute.sting.gatk.LocusContext
|
||||||
public Integer map(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context) {
|
public Integer map(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context) {
|
||||||
//System.out.printf("Reads %s:%d %d%n", context.getContig(), context.getPosition(), context.getReads().size());
|
//System.out.printf("Reads %s:%d %d%n", context.getContig(), context.getPosition(), context.getReads().size());
|
||||||
//for ( SAMRecord read : context.getReads() ) {
|
//for ( SAMRecord read : context.getReads() ) {
|
||||||
|
|
@ -84,7 +81,4 @@ public class PileupWalker implements LocusWalker<Integer, Integer> {
|
||||||
public Integer reduce(Integer value, Integer sum) {
|
public Integer reduce(Integer value, Integer sum) {
|
||||||
return value + sum;
|
return value + sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTraveralDone() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package org.broadinstitute.sting.atk.modules;
|
package org.broadinstitute.sting.gatk.walkers;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import org.broadinstitute.sting.atk.LocusContext;
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
|
|
||||||
public class PrintReadsWalker extends BasicReadWalker<Integer, Integer> {
|
public class PrintReadsWalker extends BasicReadWalker<Integer, Integer> {
|
||||||
public Integer map(LocusContext context, SAMRecord read) {
|
public Integer map(LocusContext context, SAMRecord read) {
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package org.broadinstitute.sting.atk;
|
package org.broadinstitute.sting.gatk.walkers;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import org.broadinstitute.sting.atk.LocusContext;
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Created by IntelliJ IDEA.
|
||||||
|
|
@ -17,7 +17,7 @@ public interface ReadWalker<MapType, ReduceType> {
|
||||||
// Do we actually want to operate on the context?
|
// Do we actually want to operate on the context?
|
||||||
boolean filter(LocusContext context, SAMRecord read);
|
boolean filter(LocusContext context, SAMRecord read);
|
||||||
|
|
||||||
// Map over the org.broadinstitute.sting.atk.LocusContext
|
// Map over the org.broadinstitute.sting.gatk.LocusContext
|
||||||
MapType map(LocusContext context, SAMRecord read);
|
MapType map(LocusContext context, SAMRecord read);
|
||||||
|
|
||||||
// Given result of map function
|
// Given result of map function
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
package org.broadinstitute.sting.atk.modules;
|
package org.broadinstitute.sting.gatk.walkers;
|
||||||
|
|
||||||
import org.broadinstitute.sting.atk.LocusWalker;
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
import org.broadinstitute.sting.atk.LocusIterator;
|
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||||
import org.broadinstitute.sting.atk.LocusContext;
|
import org.broadinstitute.sting.gatk.refdata.rodDbSNP;
|
||||||
import org.broadinstitute.sting.utils.ReferenceOrderedDatum;
|
|
||||||
import org.broadinstitute.sting.utils.rodDbSNP;
|
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
|
|
||||||
|
|
@ -13,13 +11,7 @@ import java.util.List;
|
||||||
// Draft single sample genotyper
|
// Draft single sample genotyper
|
||||||
// j.maguire 3-7-2009
|
// j.maguire 3-7-2009
|
||||||
|
|
||||||
public class SingleSampleGenotyper implements LocusWalker<Integer, Integer> {
|
public class SingleSampleGenotyper extends BasicLociWalker<Integer, Integer> {
|
||||||
public void initialize() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String walkerType() { return "ByLocus"; }
|
|
||||||
|
|
||||||
// Do we actually want to operate on the context?
|
|
||||||
public boolean filter(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context) {
|
public boolean filter(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context) {
|
||||||
return true; // We are keeping all the reads
|
return true; // We are keeping all the reads
|
||||||
}
|
}
|
||||||
|
|
@ -86,7 +78,7 @@ public class SingleSampleGenotyper implements LocusWalker<Integer, Integer> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map over the org.broadinstitute.sting.atk.LocusContext
|
// Map over the org.broadinstitute.sting.gatk.LocusContext
|
||||||
public Integer map(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context) {
|
public Integer map(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context) {
|
||||||
//System.out.printf("Reads %s:%d %d%n", context.getContig(), context.getPosition(), context.getReads().size());
|
//System.out.printf("Reads %s:%d %d%n", context.getContig(), context.getPosition(), context.getReads().size());
|
||||||
//for ( SAMRecord read : context.getReads() ) {
|
//for ( SAMRecord read : context.getReads() ) {
|
||||||
|
|
@ -144,7 +136,4 @@ public class SingleSampleGenotyper implements LocusWalker<Integer, Integer> {
|
||||||
public Integer reduce(Integer value, Integer sum) {
|
public Integer reduce(Integer value, Integer sum) {
|
||||||
return value + sum;
|
return value + sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTraveralDone() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -29,6 +29,10 @@ public class Utils {
|
||||||
return filtered;
|
return filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static GenomeLoc genomicLocationOf( final SAMRecord read ) {
|
||||||
|
return new GenomeLoc( read.getReferenceName(), read.getAlignmentStart() );
|
||||||
|
}
|
||||||
|
|
||||||
private static final Map<Integer,String> readFlagNames
|
private static final Map<Integer,String> readFlagNames
|
||||||
= new HashMap<Integer,String>();
|
= new HashMap<Integer,String>();
|
||||||
|
|
||||||
|
|
@ -100,7 +104,7 @@ public class Utils {
|
||||||
return average(vals, vals.size());
|
return average(vals, vals.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setupRefContigOrdering(final ReferenceSequenceFile refFile) {
|
public static boolean setupRefContigOrdering(final ReferenceSequenceFile refFile) {
|
||||||
List<SAMSequenceRecord> refContigs = refFile.getSequenceDictionary();
|
List<SAMSequenceRecord> refContigs = refFile.getSequenceDictionary();
|
||||||
HashMap<String, Integer> refContigOrdering = new HashMap<String, Integer>();
|
HashMap<String, Integer> refContigOrdering = new HashMap<String, Integer>();
|
||||||
|
|
||||||
|
|
@ -116,6 +120,7 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
GenomeLoc.setContigOrdering(refContigOrdering);
|
GenomeLoc.setContigOrdering(refContigOrdering);
|
||||||
|
return refContigOrdering != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Java Generics can't do primitive types, so I had to do this the simplistic way
|
// Java Generics can't do primitive types, so I had to do this the simplistic way
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
java -Xmx4096m -jar ../java/dist/AnalysisTK.jar $*
|
java -Xmx8192m -jar dist/GenomeAnalysisTK.jar $*
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
java -Xmx4096m -agentlib:hprof=cpu=samples -jar ../java/dist/AnalysisTK.jar $*
|
java -Xmx4096m -agentlib:hprof=cpu=samples,depth=10 -jar dist/GenomeAnalysisTK.jar $*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue