|
5 | 5 | import org.apache.commons.io.IOUtils; |
6 | 6 | import org.apache.commons.io.output.StringBuilderWriter; |
7 | 7 | import org.apache.commons.lang3.StringUtils; |
| 8 | +import org.apache.logging.log4j.Logger; |
8 | 9 | import org.jetbrains.annotations.Nullable; |
9 | 10 | import org.json.JSONArray; |
10 | 11 | import org.json.JSONObject; |
|
27 | 28 | import org.labkey.api.sequenceanalysis.pipeline.PipelineStepProvider; |
28 | 29 | import org.labkey.api.sequenceanalysis.pipeline.ReferenceGenome; |
29 | 30 | import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService; |
| 31 | +import org.labkey.api.sequenceanalysis.run.DISCVRSeqRunner; |
30 | 32 | import org.labkey.api.sequenceanalysis.run.DockerWrapper; |
31 | 33 | import org.labkey.api.util.PageFlowUtil; |
32 | 34 | import org.labkey.api.writer.PrintWriters; |
@@ -494,6 +496,28 @@ private Map<NimbleGenome, File> doAlignment(List<NimbleGenome> genomes, List<Fil |
494 | 496 | return resultMap; |
495 | 497 | } |
496 | 498 |
|
| 499 | + public static void write10xBarcodes(File bam, Logger log, Readset rs, ReferenceGenome referenceGenome, PipelineStepOutput output) throws PipelineJobException |
| 500 | + { |
| 501 | + // Write barcodes: |
| 502 | + DISCVRSeqRunner runner = new DISCVRSeqRunner(log); |
| 503 | + List<String> barcodeArgs = new ArrayList<>(runner.getBaseArgs("Save10xBarcodes")); |
| 504 | + barcodeArgs.add("--bam"); |
| 505 | + barcodeArgs.add(bam.getPath()); |
| 506 | + |
| 507 | + File cbOutput = new File(bam.getParentFile(), SequenceAnalysisService.get().getUnzippedBaseName(bam.getName()) + "cb.txt.gz"); |
| 508 | + barcodeArgs.add("--cbOutput"); |
| 509 | + barcodeArgs.add(cbOutput.getPath()); |
| 510 | + |
| 511 | + File umiOutput = new File(bam.getParentFile(), SequenceAnalysisService.get().getUnzippedBaseName(bam.getName()) + "umi.txt.gz"); |
| 512 | + barcodeArgs.add("--umiOutput"); |
| 513 | + barcodeArgs.add(umiOutput.getPath()); |
| 514 | + |
| 515 | + runner.execute(barcodeArgs); |
| 516 | + |
| 517 | + output.addSequenceOutput(cbOutput, "10x CellBarcode Map: " + rs.getName(), "10x CellBarcode Map", rs.getReadsetId(), null, referenceGenome.getGenomeId(), null); |
| 518 | + output.addSequenceOutput(umiOutput, "10x UMI Map: " + rs.getName(), "10x UMI Map", rs.getReadsetId(), null, referenceGenome.getGenomeId(), null); |
| 519 | + } |
| 520 | + |
497 | 521 | public static File runNimbleReport(File alignResultsGz, int genomeId, PipelineStepOutput output, PipelineContext ctx) throws PipelineJobException |
498 | 522 | { |
499 | 523 | List<String> reportArgs = new ArrayList<>(); |
|
0 commit comments