|
1 | 1 | package org.labkey.singlecell.run; |
2 | 2 |
|
| 3 | +import org.apache.commons.io.FileUtils; |
3 | 4 | import org.jetbrains.annotations.Nullable; |
4 | 5 | import org.json.JSONObject; |
5 | 6 | import org.labkey.api.pipeline.PipelineJobException; |
6 | | -import org.labkey.api.sequenceanalysis.SequenceOutputFile; |
7 | | -import org.labkey.api.sequenceanalysis.model.AnalysisModel; |
8 | 7 | import org.labkey.api.sequenceanalysis.model.Readset; |
9 | 8 | import org.labkey.api.sequenceanalysis.pipeline.AbstractAlignmentStepProvider; |
10 | 9 | import org.labkey.api.sequenceanalysis.pipeline.AlignmentOutputImpl; |
|
17 | 16 | import org.labkey.api.util.PageFlowUtil; |
18 | 17 |
|
19 | 18 | import java.io.File; |
| 19 | +import java.io.IOException; |
20 | 20 | import java.util.Arrays; |
21 | | -import java.util.Collection; |
22 | 21 | import java.util.LinkedHashSet; |
23 | 22 | import java.util.List; |
24 | 23 |
|
@@ -73,6 +72,20 @@ public AlignmentOutput performAlignment(Readset rs, List<File> inputFastqs1, @Nu |
73 | 72 | AlignmentOutputImpl output = new AlignmentOutputImpl(); |
74 | 73 | File localBam = runCellRanger(output, rs, inputFastqs1, inputFastqs2, outputDirectory, referenceGenome, basename, readGroupId, platformUnit); |
75 | 74 |
|
| 75 | + File crDir = new File(localBam.getPath().replace(".nimble.cellranger.bam", "")); |
| 76 | + if (crDir.exists()) |
| 77 | + { |
| 78 | + getPipelineCtx().getLogger().debug("Deleting CR output dir: " + crDir.getPath()); |
| 79 | + try |
| 80 | + { |
| 81 | + FileUtils.deleteDirectory(crDir); |
| 82 | + } |
| 83 | + catch (IOException e) |
| 84 | + { |
| 85 | + throw new PipelineJobException(); |
| 86 | + } |
| 87 | + } |
| 88 | + |
76 | 89 | // Now run nimble itself: |
77 | 90 | NimbleHelper helper = new NimbleHelper(getPipelineCtx(), getProvider(), getStepIdx()); |
78 | 91 | helper.doNimbleAlign(localBam, output, rs, basename); |
|
0 commit comments