Allowing the GATK to have non-required outputs
Modified the SAMFileWriterArgumentTypeDescriptor to accept output bam files that are null if they're not required (in the @Output annotation). This change enables the nWayOut parameter for the IndeRealigner and ReduceReads to operate optionally while maintaining the original single way out. [#DEV-10 transition:31 resolution:1]
This commit is contained in:
parent
a234bacb02
commit
80d92e0c63
|
|
@ -124,32 +124,28 @@ public class SAMFileWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor
|
|||
|
||||
// This parser has been passed a null filename and the GATK is not responsible for creating a type default for the object;
|
||||
// therefore, the user must have failed to specify a type default
|
||||
if(writerFileName == null) {
|
||||
if(!source.isRequired())
|
||||
throw new MissingArgumentValueException(bamArgumentDefinition);
|
||||
if(generateMD5)
|
||||
if(writerFileName == null && generateMD5)
|
||||
throw new ArgumentException("MD5 generation specified, but no output file specified. If md5 generation is desired, please specify a BAM output file and an md5 file will be written alongside.");
|
||||
}
|
||||
|
||||
// Create the stub and set parameters.
|
||||
SAMFileWriterStub stub;
|
||||
if ( writerFileName != null )
|
||||
SAMFileWriterStub stub = null; // stub = new SAMFileWriterStub(engine, defaultOutputStream);
|
||||
|
||||
if ( writerFileName != null ) {
|
||||
stub = new SAMFileWriterStub(engine, new File(writerFileName));
|
||||
else
|
||||
stub = new SAMFileWriterStub(engine, defaultOutputStream);
|
||||
|
||||
if ( compressionLevel != null )
|
||||
stub.setCompressionLevel(compressionLevel);
|
||||
if ( indexOnTheFly )
|
||||
stub.setIndexOnTheFly(indexOnTheFly);
|
||||
if ( generateMD5 )
|
||||
stub.setGenerateMD5(generateMD5);
|
||||
if ( simplifyBAM )
|
||||
stub.setSimplifyBAM(simplifyBAM);
|
||||
if ( compressionLevel != null )
|
||||
stub.setCompressionLevel(compressionLevel);
|
||||
if ( indexOnTheFly )
|
||||
stub.setIndexOnTheFly(indexOnTheFly);
|
||||
if ( generateMD5 )
|
||||
stub.setGenerateMD5(generateMD5);
|
||||
if ( simplifyBAM )
|
||||
stub.setSimplifyBAM(simplifyBAM);
|
||||
|
||||
// WARNING: Side effects required by engine!
|
||||
parsingEngine.addTags(stub,getArgumentTags(matches));
|
||||
engine.addOutput(stub);
|
||||
// WARNING: Side effects required by engine!
|
||||
parsingEngine.addTags(stub,getArgumentTags(matches));
|
||||
engine.addOutput(stub);
|
||||
}
|
||||
|
||||
return stub;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -370,8 +370,6 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
|||
|
||||
currentInterval = intervals.hasNext() ? intervals.next() : null;
|
||||
|
||||
writerToUse = writer;
|
||||
|
||||
if ( N_WAY_OUT != null ) {
|
||||
boolean createIndex = true;
|
||||
|
||||
|
|
@ -383,9 +381,9 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
|||
createIndex, generateMD5s,createProgramRecord(),KEEP_ALL_PG_RECORDS);
|
||||
}
|
||||
} else {
|
||||
|
||||
// set up the output writer
|
||||
setupWriter(getToolkit().getSAMFileHeader());
|
||||
writerToUse = writer;
|
||||
}
|
||||
manager = new ConstrainedMateFixingManager(writerToUse, getToolkit().getGenomeLocParser(), MAX_ISIZE_FOR_MOVEMENT, MAX_POS_MOVE_ALLOWED, MAX_RECORDS_IN_MEMORY);
|
||||
|
||||
|
|
|
|||
|
|
@ -113,4 +113,14 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
|
|||
executeTest(String.format("realigner [%s]", entry.getKey()), spec);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNWayOut() {
|
||||
WalkerTestSpec spec1 = new WalkerTestSpec(
|
||||
baseCommandPrefix + " -nWayOut .clean.bam ",
|
||||
1,
|
||||
Arrays.asList("d41d8cd98f00b204e9800998ecf8427e"));
|
||||
executeTest("test realigner nWayOut", spec1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue