Updating the recalibrator to make use of StingSAMFileWriter.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2566 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
c8ad025ad0
commit
b51f4aae11
|
|
@ -7,6 +7,7 @@ import org.broadinstitute.sting.gatk.walkers.WalkerName;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Requires;
|
import org.broadinstitute.sting.gatk.walkers.Requires;
|
||||||
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
||||||
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrderedDataSource;
|
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrderedDataSource;
|
||||||
|
import org.broadinstitute.sting.gatk.io.StingSAMFileWriter;
|
||||||
import org.broadinstitute.sting.utils.cmdLine.*;
|
import org.broadinstitute.sting.utils.cmdLine.*;
|
||||||
import org.broadinstitute.sting.utils.*;
|
import org.broadinstitute.sting.utils.*;
|
||||||
|
|
||||||
|
|
@ -70,8 +71,8 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Command Line Arguments
|
// Command Line Arguments
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
@Argument(fullName="output_bam", shortName="outputBam", doc="output BAM file", required=true)
|
@Argument(fullName="output_bam", shortName="outputBam", doc="The output BAM file", required=true)
|
||||||
private String OUTPUT_BAM_FILE = null;
|
private StingSAMFileWriter OUTPUT_BAM;
|
||||||
@Argument(fullName="preserve_qscores_less_than", shortName="pQ",
|
@Argument(fullName="preserve_qscores_less_than", shortName="pQ",
|
||||||
doc="Bases with quality scores less than this threshold won't be recalibrated, default=5. In general it's unsafe to change qualities scores below < 5, since base callers use these values to indicate random or bad bases", required=false)
|
doc="Bases with quality scores less than this threshold won't be recalibrated, default=5. In general it's unsafe to change qualities scores below < 5, since base callers use these values to indicate random or bad bases", required=false)
|
||||||
private int PRESERVE_QSCORES_LESS_THAN = 5;
|
private int PRESERVE_QSCORES_LESS_THAN = 5;
|
||||||
|
|
@ -79,8 +80,6 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
private int SMOOTHING = 1;
|
private int SMOOTHING = 1;
|
||||||
@Argument(fullName="max_quality_score", shortName="maxQ", required = false, doc="The integer value at which to cap the quality scores, default is 40")
|
@Argument(fullName="max_quality_score", shortName="maxQ", required = false, doc="The integer value at which to cap the quality scores, default is 40")
|
||||||
private int MAX_QUALITY_SCORE = 40;
|
private int MAX_QUALITY_SCORE = 40;
|
||||||
@Argument(fullName="compression_level", shortName="compress", required = false, doc="Compression level parameter passed to SAMFileWriter, higher value means more compression at added cost in run time, default is 5")
|
|
||||||
private int COMPRESSION_LEVEL = 5;
|
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Debugging-only Arguments
|
// Debugging-only Arguments
|
||||||
|
|
@ -96,8 +95,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
private static final Pattern COMMENT_PATTERN = Pattern.compile("^#.*");
|
private static final Pattern COMMENT_PATTERN = Pattern.compile("^#.*");
|
||||||
private static final Pattern OLD_RECALIBRATOR_HEADER = Pattern.compile("^rg,.*");
|
private static final Pattern OLD_RECALIBRATOR_HEADER = Pattern.compile("^rg,.*");
|
||||||
private static final Pattern COVARIATE_PATTERN = Pattern.compile("^ReadGroup,QualityScore,.*");
|
private static final Pattern COVARIATE_PATTERN = Pattern.compile("^ReadGroup,QualityScore,.*");
|
||||||
private static final String versionString = "v2.2.8"; // Major version, minor version, and build number
|
private static final String versionString = "v2.2.9"; // Major version, minor version, and build number
|
||||||
private SAMFileWriter OUTPUT_BAM = null;// The File Writer that will write out the recalibrated bam
|
|
||||||
private Random coinFlip; // Random number generator is used to remove reference bias in solid bams
|
private Random coinFlip; // Random number generator is used to remove reference bias in solid bams
|
||||||
private static final long RANDOM_SEED = 1032861495;
|
private static final long RANDOM_SEED = 1032861495;
|
||||||
|
|
||||||
|
|
@ -247,14 +245,10 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
commandLineString += "smoothing = " + SMOOTHING;
|
commandLineString += "smoothing = " + SMOOTHING;
|
||||||
programRecord.setCommandLine( commandLineString );
|
programRecord.setCommandLine( commandLineString );
|
||||||
header.addProgramRecord( programRecord );
|
header.addProgramRecord( programRecord );
|
||||||
}
|
|
||||||
|
|
||||||
// Create the SAMFileWriter that we will be using to output the reads
|
// write out the new header
|
||||||
if( OUTPUT_BAM_FILE != null ) {
|
OUTPUT_BAM.writeHeader( header );
|
||||||
final SAMFileWriterFactory factory = new SAMFileWriterFactory();
|
|
||||||
OUTPUT_BAM = factory.makeBAMWriter( header, true, new File(OUTPUT_BAM_FILE), COMPRESSION_LEVEL );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -454,12 +448,9 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the output bam file
|
* Do nothing
|
||||||
* @param output The SAMFileWriter that outputs the bam file
|
* @param output The SAMFileWriter that outputs the bam file
|
||||||
*/
|
*/
|
||||||
public void onTraversalDone(SAMFileWriter output) {
|
public void onTraversalDone(SAMFileWriter output) {
|
||||||
if( output != null ) {
|
|
||||||
output.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue