|
28 | 28 | import org.labkey.api.sequenceanalysis.pipeline.ReferenceGenome; |
29 | 29 | import org.labkey.api.sequenceanalysis.pipeline.SequenceAnalysisJobSupport; |
30 | 30 | import org.labkey.api.sequenceanalysis.pipeline.SequenceOutputHandler; |
| 31 | +import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService; |
31 | 32 | import org.labkey.api.sequenceanalysis.pipeline.VariantProcessingStep; |
32 | 33 | import org.labkey.api.sequenceanalysis.run.SelectVariantsWrapper; |
33 | 34 | import org.labkey.api.util.FileType; |
@@ -176,6 +177,7 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c |
176 | 177 |
|
177 | 178 | boolean dropGenotypes = params.optBoolean("dropGenotypes", false); |
178 | 179 | boolean useBcfTools = params.optBoolean("useBcfTools", false); |
| 180 | + boolean doNotRetainUnmapped = params.optBoolean("doNotRetainUnmapped", false); |
179 | 181 |
|
180 | 182 | int chainFileId = params.getInt("chainFileId"); |
181 | 183 | File chainFile = ctx.getSequenceSupport().getCachedData(chainFileId); |
@@ -214,7 +216,7 @@ else if (_vcfFileType.isType(f.getFile())) |
214 | 216 | } |
215 | 217 |
|
216 | 218 | File lifted = new File(outDir, baseName + ".lifted-" + targetGenomeId + ext); |
217 | | - File unmappedOutput = new File(outDir, baseName + ".unmapped-" + targetGenomeId + ext); |
| 219 | + File unmappedOutput = doNotRetainUnmapped ? null : new File(outDir, baseName + ".unmapped-" + targetGenomeId + ext); |
218 | 220 |
|
219 | 221 | try |
220 | 222 | { |
@@ -260,7 +262,11 @@ else if (_vcfFileType.isType(f.getFile())) |
260 | 262 | ctx.addSequenceOutput(so1); |
261 | 263 | } |
262 | 264 |
|
263 | | - if (!unmappedOutput.exists()) |
| 265 | + if (unmappedOutput == null) |
| 266 | + { |
| 267 | + // skip |
| 268 | + } |
| 269 | + else if (!unmappedOutput.exists()) |
264 | 270 | { |
265 | 271 | job.getLogger().info("no unmapped intervals"); |
266 | 272 | } |
@@ -328,6 +334,8 @@ public void liftOverVcf(JobContext ctx, ReferenceGenome targetGenome, ReferenceG |
328 | 334 | { |
329 | 335 | LiftoverBcfToolsWrapper wrapper = new LiftoverBcfToolsWrapper(job.getLogger()); |
330 | 336 | wrapper.doLiftover(currentVCF, chain, sourceGenome.getWorkingFastaFile(), targetGenome.getWorkingFastaFile(), unmappedOutput, output); |
| 337 | + |
| 338 | + SequencePipelineService.get().sortVcf(output, null, targetGenome.getSequenceDictionary(), ctx.getLogger()); |
331 | 339 | } |
332 | 340 | else |
333 | 341 | { |
|
0 commit comments