Skip to content

Commit e5f990b

Browse files
committed
Implement DELETE_INPUTS
1 parent 89a6ec3 commit e5f990b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/java/org/broadinstitute/dropseqrna/beadsynthesis/CorrectScrnaReadPairs.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import picard.nio.PicardHtsPath;
4343

4444
import java.io.File;
45+
import java.io.IOException;
4546
import java.nio.file.Files;
4647
import java.nio.file.Path;
4748
import java.util.List;
@@ -161,6 +162,24 @@ protected int doWork() {
161162
if (METRICS != null) {
162163
barcodeCorrector.writeMetrics(METRICS, getMetricsFile());
163164
}
165+
166+
try {
167+
if (DELETE_INPUTS) {
168+
inputPaths.stream().forEach(p -> Files.delete(p));
169+
}
170+
if (DELETE_INPUT_INDICES) {
171+
for (final Path inputBam : inputPaths) {
172+
final Path index = SamFiles.findIndex(inputBam);
173+
if (index != null && index.toFile().exists()) {
174+
Files.delete(index);
175+
176+
}
177+
}
178+
}
179+
} catch (IOException e) {
180+
throw new RuntimeIOException(e);
181+
}
182+
164183
return 0;
165184
}
166185
/** Stock main method, for testing. */

0 commit comments

Comments
 (0)