Skip to content

Commit 696619e

Browse files
committed
Bugfix to SRA download with multiple file pairs
1 parent 470319b commit 696619e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,8 +1968,14 @@ else if (sraIDs.contains(rd.getSra_accession()))
19681968
{
19691969
if (outDir.exists())
19701970
{
1971-
getHelper().getLogger().debug("Deleting existing folder: " + outDir.getPath());
1972-
FileUtils.deleteDirectory(outDir);
1971+
getHelper().getLogger().debug("Inspecting existing folder: " + outDir.getPath());
1972+
Arrays.stream(outDir.listFiles()).forEach(f -> {
1973+
if (f.getName().startsWith(rd.getSra_accession()))
1974+
{
1975+
getPipelineJob().getLogger().debug("Deleting existing file: " + f.getPath());
1976+
f.delete();
1977+
}
1978+
});
19731979
}
19741980

19751981
outDir.mkdirs();
@@ -1980,6 +1986,8 @@ else if (sraIDs.contains(rd.getSra_accession()))
19801986
{
19811987
moved1.delete();
19821988
}
1989+
1990+
getPipelineJob().getLogger().debug("Moving gzipped file to: " + moved1.getPath());
19831991
FileUtils.moveFile(downloaded.first, moved1);
19841992
rdi.setFile(moved1, 1);
19851993

@@ -1990,6 +1998,7 @@ else if (sraIDs.contains(rd.getSra_accession()))
19901998
{
19911999
moved2.delete();
19922000
}
2001+
getPipelineJob().getLogger().debug("Moving gzipped file to: " + moved2.getPath());
19932002
FileUtils.moveFile(downloaded.second, moved2);
19942003
rdi.setFile(moved2, 2);
19952004
}

0 commit comments

Comments
 (0)