Added the ability to get a merged header in a LociByReference traversal
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@514 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
282f1d88b8
commit
3dc2afd7ab
|
|
@ -486,4 +486,5 @@ public class GenomeAnalysisTK extends CommandLineProgram {
|
|||
}
|
||||
|
||||
public SAMFileReader getSamReader() { return this.engine.getSamReader(); }
|
||||
public TraversalEngine getEngine() { return this.engine; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,6 +119,9 @@ public class MicroManager {
|
|||
ReferenceProvider referenceProvider = new ReferenceProvider( refIter );
|
||||
LocusContextProvider locusProvider = new LocusContextProvider( readShard );
|
||||
|
||||
// set the sam header of the traversal engine
|
||||
traversalEngine.setSAMHeader(readShard.getMergedHeader());
|
||||
System.err.println(traversalEngine.getSAMHeader().getSequenceDictionary().toString());
|
||||
accumulator = traversalEngine.traverse( walker, shard, referenceProvider, locusProvider, accumulator );
|
||||
readShard.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,11 @@ public abstract class TraversalEngine {
|
|||
protected boolean THREADED_IO = false;
|
||||
protected int THREADED_IO_BUFFER_SIZE = 10000;
|
||||
|
||||
|
||||
|
||||
// the stored header
|
||||
protected SAMFileHeader myHeader = null;
|
||||
|
||||
/**
|
||||
* our log, which we want to capture anything from this class
|
||||
*/
|
||||
|
|
@ -168,6 +173,26 @@ public abstract class TraversalEngine {
|
|||
//
|
||||
// --------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* get the associated SAM header for our run
|
||||
* @return the header if it's stored, null if not
|
||||
*/
|
||||
public SAMFileHeader getSAMHeader() {
|
||||
return myHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* set's the SAM header for this traversal, which should
|
||||
* be the merged header in the multiple BAM file case.
|
||||
*
|
||||
* @param myHeader the passed in header
|
||||
*/
|
||||
|
||||
public void setSAMHeader(SAMFileHeader myHeader) {
|
||||
this.myHeader = myHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the location string locStr and sets the traversal engine to only process
|
||||
* regions specified by the location string. The string is of the form:
|
||||
|
|
@ -417,7 +442,7 @@ public abstract class TraversalEngine {
|
|||
|
||||
public boolean shutdown() {
|
||||
// todo: actually shutdown the resources
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -462,7 +487,7 @@ public abstract class TraversalEngine {
|
|||
public <M, T> T traverse(Walker<M, T> walker, ArrayList<GenomeLoc> locations) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// traversal by loci functions
|
||||
|
|
|
|||
|
|
@ -1,28 +1,21 @@
|
|||
|
||||
package org.broadinstitute.sting.playground.gatk.walkers;
|
||||
|
||||
import net.sf.samtools.*;
|
||||
import org.broadinstitute.sting.gatk.*;
|
||||
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 net.sf.samtools.SAMFileHeader;
|
||||
import net.sf.samtools.SAMReadGroupRecord;
|
||||
import org.broadinstitute.sting.gatk.GenomeAnalysisTK;
|
||||
import org.broadinstitute.sting.gatk.LocusContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||
import org.broadinstitute.sting.gatk.LocusContext;
|
||||
import org.broadinstitute.sting.playground.gatk.walkers.AlleleFrequencyWalker;
|
||||
import org.broadinstitute.sting.playground.utils.AlleleFrequencyEstimate;
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
import org.broadinstitute.sting.utils.cmdLine.Argument;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
public class ListSampleIds extends LocusWalker<Boolean, Boolean>
|
||||
{
|
||||
public void initialize()
|
||||
{
|
||||
GenomeAnalysisTK toolkit = this.getToolkit();
|
||||
SAMFileHeader header = toolkit.getSamReader().getFileHeader();
|
||||
SAMFileHeader header = toolkit.getEngine().getSAMHeader();
|
||||
List<SAMReadGroupRecord> read_groups = header.getReadGroups();
|
||||
|
||||
for (int i = 0; i < read_groups.size(); i++)
|
||||
|
|
|
|||
Loading…
Reference in New Issue