Skip to content

Commit 2f85634

Browse files
committed
Download the uncompressed SRA files to the temp folder, not work dir
1 parent ae17460 commit 2f85634

File tree

1 file changed

+46
-8
lines changed

1 file changed

+46
-8
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceAlignmentTask.java

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,8 +1933,22 @@ else if (sraIDs.contains(rd.getSra_accession()))
19331933
continue;
19341934
}
19351935

1936+
File unzippedOutDir = new File(SequencePipelineService.get().getJavaTempDir(), "cachedReadDataGz");
1937+
getTaskFileManagerImpl().addIntermediateFile(unzippedOutDir);
1938+
if (unzippedOutDir.exists())
1939+
{
1940+
try
1941+
{
1942+
FileUtils.deleteDirectory(unzippedOutDir);
1943+
}
1944+
catch (IOException e)
1945+
{
1946+
throw new PipelineJobException(e);
1947+
}
1948+
}
1949+
19361950
File outDir = new File(getHelper().getWorkingDirectory(), "cachedReadData");
1937-
getTaskFileManagerImpl().addDeferredIntermediateFile(outDir);
1951+
getTaskFileManagerImpl().addIntermediateFile(outDir);
19381952

19391953
File doneFile = new File(outDir, rd.getSra_accession() + ".done");
19401954
sraIDs.add(rd.getSra_accession());
@@ -1949,18 +1963,42 @@ else if (sraIDs.contains(rd.getSra_accession()))
19491963
}
19501964
else
19511965
{
1952-
if (!outDir.exists())
1966+
try
19531967
{
1968+
if (outDir.exists())
1969+
{
1970+
getHelper().getLogger().debug("Deleting existing folder: " + outDir.getPath());
1971+
FileUtils.deleteDirectory(outDir);
1972+
}
1973+
19541974
outDir.mkdirs();
1955-
}
19561975

1957-
Pair<File, File> downloaded = sra.downloadSra(rd.getSra_accession(), outDir, rd.isPairedEnd());
1958-
rdi.setFile(downloaded.first, 1);
1959-
rdi.setFile(downloaded.second, 2);
1976+
Pair<File, File> downloaded = sra.downloadSra(rd.getSra_accession(), unzippedOutDir, rd.isPairedEnd());
1977+
File moved1 = new File(outDir, downloaded.first.getName());
1978+
if (moved1.exists())
1979+
{
1980+
moved1.delete();
1981+
}
1982+
FileUtils.moveFile(downloaded.first, moved1);
1983+
rdi.setFile(moved1, 1);
1984+
1985+
if (downloaded.second != null)
1986+
{
1987+
File moved2 = new File(outDir, downloaded.second.getName());
1988+
if (moved2.exists())
1989+
{
1990+
moved2.delete();
1991+
}
1992+
FileUtils.moveFile(downloaded.second, moved2);
1993+
rdi.setFile(moved2, 2);
1994+
}
19601995

1961-
try
1962-
{
19631996
Files.touch(doneFile);
1997+
1998+
if (unzippedOutDir.exists())
1999+
{
2000+
FileUtils.deleteDirectory(unzippedOutDir);
2001+
}
19642002
}
19652003
catch (IOException e)
19662004
{

0 commit comments

Comments
 (0)