Skip to content
Snippets Groups Projects
Commit fa54c856 authored by bow's avatar bow
Browse files

Properly open and close files in ExtractAlignedFastq

parent 164f4b11
No related branches found
No related tags found
No related merge requests found
...@@ -261,17 +261,25 @@ object ExtractAlignedFastq extends ToolCommand { ...@@ -261,17 +261,25 @@ object ExtractAlignedFastq extends ToolCommand {
logger.info("Writing to output file(s) ...") logger.info("Writing to output file(s) ...")
(commandArgs.inputFastq2, commandArgs.outputFastq2) match { (commandArgs.inputFastq2, commandArgs.outputFastq2) match {
case (None, None) => extractReads(memFunc, case (None, None) =>
new FastqReader(commandArgs.inputFastq1), val in = new FastqReader(commandArgs.inputFastq1)
new BasicFastqWriter(commandArgs.outputFastq1)) val out = new BasicFastqWriter(commandArgs.outputFastq1)
extractReads(memFunc, in, out)
case (Some(i2), Some(o2)) => extractReads(memFunc, in.close()
new FastqReader(commandArgs.inputFastq1), out.close()
new BasicFastqWriter(commandArgs.outputFastq1),
new FastqReader(i2), case (Some(i2), Some(o2)) =>
new BasicFastqWriter(o2)) val in1 = new FastqReader(commandArgs.inputFastq1)
val in2 = new FastqReader(i2)
case _ => // handled by the command line config check above val out1 = new BasicFastqWriter(commandArgs.outputFastq1)
val out2 = new BasicFastqWriter(o2)
extractReads(memFunc, in1, out1, in2, out2)
in1.close()
in2.close()
out1.close()
out2.close()
case _ => ; // handled by the command line config check above
} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment