added -nosort cmdline flag; if specified, the output writer does not attempt to sort reads on the fly (sorting involves use of sorting collection backed up by temporary disk storage and can lead to crashes if temp size is low and/or filesystem is not behaving). Output can be later sorted externally by samtools

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1085 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
asivache 2009-06-24 15:58:00 +00:00
parent 7b5d8d7604
commit a9c30c5fcc
1 changed files with 10 additions and 1 deletions

View File

@ -9,6 +9,8 @@ import org.broadinstitute.sting.utils.cmdLine.Argument;
import org.broadinstitute.sting.playground.indels.*;
import net.sf.samtools.*;
import net.sf.samtools.SAMFileHeader.SortOrder;
import java.util.*;
import java.io.File;
import java.io.FileWriter;
@ -37,6 +39,8 @@ public class IntervalCleanerWalker extends LocusWindowWalker<Integer, Integer>
public int MAX_CONSENSUSES = 30;
@Argument(fullName="maxReadsForConsensuses", shortName="greedy", doc="max reads used for finding the alternate consensuses (necessary to improve performance in deep coverage)", required=false)
public int MAX_READS_FOR_CONSENSUSES = 120;
@Argument(fullName="noOutputSorting", shortName="nosort", doc="if specified, the output bam file may be not fully sorted. Use if low on temp space", required=false)
public boolean NOSORT=false;
public static final int MAX_QUAL = 99;
@ -58,7 +62,12 @@ public class IntervalCleanerWalker extends LocusWindowWalker<Integer, Integer>
SAMFileHeader header = getToolkit().getEngine().getSAMHeader();
if ( OUT != null ) {
writer = Utils.createSAMFileWriterWithCompression(header, false, OUT, getToolkit().getBAMCompression());
if ( NOSORT ) {
header.setSortOrder(SortOrder.unsorted);
writer = Utils.createSAMFileWriterWithCompression(header, true, OUT, getToolkit().getBAMCompression());
} else {
writer = Utils.createSAMFileWriterWithCompression(header, false, OUT, getToolkit().getBAMCompression());
}
readsToWrite = new TreeSet<ComparableSAMRecord>();
}