--simplifyBAM is now in the SAMFileWriterArgumentTypeDescriptor, as suggested by map. PrintReads has an integrationtest now that writes out a 1 MB bit of HiSeq normally, with compress 0, and with simplifyBAM on.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5521 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2011-03-26 14:57:18 +00:00
parent 28ae53d796
commit 3bcd4c5d75
4 changed files with 74 additions and 9 deletions

View File

@ -118,10 +118,6 @@ public class GATKArgumentCollection {
@Input(fullName = "DBSNP", shortName = "D", doc = "DBSNP file", required = false)
public String DBSNPFile = null;
@Element(required = false)
@Argument(fullName = "simplifyBAM", shortName = "simplifyBAM", doc = "If provided, output BAM files will be simplified to include just key reads for downstream variation discovery analyses (removing duplicates, PF-, non-primary reads), as well stripping all extended tags from the kept reads except the read group identifier", required = false)
public boolean simplifyBAM = false;
/**
* The override mechanism in the GATK, by default, populates the command-line arguments, then
* the defaults from the walker annotations. Unfortunately, walker annotations should be trumped
@ -439,9 +435,6 @@ public class GATKArgumentCollection {
if (enableLowMemorySharding != other.enableLowMemorySharding)
return false;
if ( simplifyBAM != other.simplifyBAM )
return false;
return true;
}

View File

@ -48,6 +48,9 @@ public class SAMFileWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor
public static final String COMPRESSION_FULLNAME = "bam_compression";
public static final String COMPRESSION_SHORTNAME = "compress";
public static final String SIMPLIFY_BAM_FULLNAME = "simplifyBAM";
public static final String SIMPLIFY_BAM_SHORTNAME = SIMPLIFY_BAM_FULLNAME;
public static final String CREATE_INDEX_FULLNAME = "index_output_bam_on_the_fly";
/**
@ -79,7 +82,8 @@ public class SAMFileWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor
public List<ArgumentDefinition> createArgumentDefinitions( ArgumentSource source ) {
return Arrays.asList( createBAMArgumentDefinition(source),
createBAMCompressionArgumentDefinition(source),
createWriteIndexArgumentDefinition(source));
createWriteIndexArgumentDefinition(source),
createSimplifyBAMArgumentDefinition(source));
}
@Override
@ -114,6 +118,7 @@ public class SAMFileWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor
stub.setCompressionLevel(compressionLevel);
stub.setIndexOnTheFly(argumentIsPresent(createWriteIndexArgumentDefinition(source),matches));
stub.setSimplifyBAM(argumentIsPresent(createSimplifyBAMArgumentDefinition(source),matches));
// WARNING: Side effects required by engine!
parsingEngine.addTags(stub,getArgumentTags(matches));
@ -181,4 +186,20 @@ public class SAMFileWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor
null,
null );
}
private ArgumentDefinition createSimplifyBAMArgumentDefinition(ArgumentSource source) {
return new ArgumentDefinition( ArgumentIOType.ARGUMENT,
boolean.class,
SIMPLIFY_BAM_FULLNAME,
SIMPLIFY_BAM_SHORTNAME,
"If provided, output BAM files will be simplified to include just key reads for downstream variation discovery analyses (removing duplicates, PF-, non-primary reads), as well stripping all extended tags from the kept reads except the read group identifier",
false,
false,
false,
source.isHidden(),
null,
null,
null,
null );
}
}

View File

@ -107,6 +107,11 @@ public class SAMFileWriterStub implements Stub<SAMFileWriter>, StingSAMFileWrite
*/
BAQ baqHMM = new BAQ();
/**
* Should we simplify the BAM file while writing it out?
*/
private boolean simplifyBAM = false;
/**
* Create a new stub given the requested SAM file and compression level.
* @param engine source of header data, maybe other data about input files.
@ -138,7 +143,11 @@ public class SAMFileWriterStub implements Stub<SAMFileWriter>, StingSAMFileWrite
}
public boolean simplifyBAM() {
return engine.getArguments().simplifyBAM;
return simplifyBAM;
}
public void setSimplifyBAM(boolean v) {
simplifyBAM = v;
}
public OutputStream getSAMOutputStream() {

View File

@ -0,0 +1,42 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.WalkerTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.HashMap;
public class PrintReadsIntegrationTest extends WalkerTest {
private static class PRTest {
final static String REF = hg18Reference;
final static String BAM = validationDataLocation + "HiSeq.1mb.bam";
String args;
String md5;
private PRTest(String args, String md5) {
this.args = args;
this.md5 = md5;
}
}
@DataProvider(name = "PRTest")
public Object[][] createData1() {
return new Object[][]{
{new PRTest("", "dc8e5451dd29757c336013146010f73a")},
{new PRTest(" -compress 0", "fde82269c78c9e91e57286433531b4af")},
{new PRTest(" -simplifyBAM", "0531717b32a7e21c0de70b1526b0751f")} };
}
@Test(dataProvider = "PRTest")
public void testPrintReads(PRTest params) {
WalkerTestSpec spec = new WalkerTestSpec(
"-T PrintReads -R " + params.REF +
" -I " + params.BAM +
params.args +
" -o %s",
Arrays.asList(params.md5));
executeTest("testVariantRecalibrator-"+params.args, spec).getFirst();
}
}