Merge pull request #284 from broadinstitute/dr_fewer_stranded_temp_files
Reduce number of leftover temp files in GATK runs
This commit is contained in:
commit
52677429a0
|
|
@ -176,6 +176,7 @@ public class VariantsToBinaryPed extends RodWalker<Integer,Integer> {
|
||||||
// Cut down on memory.
|
// Cut down on memory.
|
||||||
try {
|
try {
|
||||||
File temp = File.createTempFile("VariantsToBPed_"+sample, ".tmp");
|
File temp = File.createTempFile("VariantsToBPed_"+sample, ".tmp");
|
||||||
|
temp.deleteOnExit();
|
||||||
printMap.put(sample,new PrintStream(temp));
|
printMap.put(sample,new PrintStream(temp));
|
||||||
tempFiles.put(sample,temp);
|
tempFiles.put(sample,temp);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,11 @@ public class ArtificialBAMBuilder {
|
||||||
try {
|
try {
|
||||||
final File file = File.createTempFile("tempBAM", ".bam");
|
final File file = File.createTempFile("tempBAM", ".bam");
|
||||||
file.deleteOnExit();
|
file.deleteOnExit();
|
||||||
|
|
||||||
|
// Register the bam index file for deletion on exit as well:
|
||||||
|
new File(file.getAbsolutePath().replace(".bam", ".bai")).deleteOnExit();
|
||||||
|
new File(file.getAbsolutePath() + ".bai").deleteOnExit();
|
||||||
|
|
||||||
return makeBAMFile(file);
|
return makeBAMFile(file);
|
||||||
} catch ( IOException e ) {
|
} catch ( IOException e ) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,10 @@ public class WalkerTest extends BaseTest {
|
||||||
for (int i = 0; i < spec.nOutputFiles; i++) {
|
for (int i = 0; i < spec.nOutputFiles; i++) {
|
||||||
String ext = spec.exts == null ? ".tmp" : "." + spec.exts.get(i);
|
String ext = spec.exts == null ? ".tmp" : "." + spec.exts.get(i);
|
||||||
File fl = createTempFile(String.format("walktest.tmp_param.%d", i), ext);
|
File fl = createTempFile(String.format("walktest.tmp_param.%d", i), ext);
|
||||||
|
|
||||||
|
// Mark corresponding *.idx for deletion on exit as well just in case an index is created for the temp file:
|
||||||
|
new File(fl.getAbsolutePath() + ".idx").deleteOnExit();
|
||||||
|
|
||||||
tmpFiles.add(fl);
|
tmpFiles.add(fl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue