Skip to content

Commit 8c35a13

Browse files
committed
Updates to Save10xBarcodes
1 parent 3cc6db1 commit 8c35a13

File tree

3 files changed

+14
-35
lines changed

3 files changed

+14
-35
lines changed

singlecell/src/org/labkey/singlecell/run/AbstractCellRangerDependentStep.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ protected File runCellRanger(AlignmentOutputImpl output, Readset rs, List<File>
8888
}
8989
}
9090

91+
NimbleHelper.write10xBarcodes(localBam, getWrapper().getLogger(), rs, referenceGenome, output);
92+
9193
return localBam;
9294
}
9395

singlecell/src/org/labkey/singlecell/run/NimbleAlignmentStep.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,9 @@ public AlignmentOutput performAlignment(Readset rs, List<File> inputFastqs1, @Nu
109109

110110
private File createNimbleBam(AlignmentOutputImpl output, Readset rs, List<File> inputFastqs1, List<File> inputFastqs2) throws PipelineJobException
111111
{
112-
File cellbarcodes = getCachedBarcodeFile(rs, true);
113-
File umiMapping = getUmiMapping(cellbarcodes);
112+
File cellBarcodeUmiMap = getCachedBarcodeFile(rs, true);
114113

115-
return NimbleHelper.runFastqToBam(output, getPipelineCtx(), rs, inputFastqs1, inputFastqs2, cellbarcodes, umiMapping);
114+
return NimbleHelper.runFastqToBam(output, getPipelineCtx(), rs, inputFastqs1, inputFastqs2, cellBarcodeUmiMap);
116115
}
117116

118117
private File getCachedBarcodeFile(Readset rs, boolean throwIfNotFound) throws PipelineJobException
@@ -132,18 +131,7 @@ private File getCachedBarcodeFile(Readset rs, boolean throwIfNotFound) throws Pi
132131
File ret = getPipelineCtx().getSequenceSupport().getCachedData(dataId);
133132
if (ret == null || ! ret.exists())
134133
{
135-
throw new PipelineJobException("Missing cached cellbarcode file: " + dataId);
136-
}
137-
138-
return ret;
139-
}
140-
141-
private File getUmiMapping(File cellbarcodeFile) throws PipelineJobException
142-
{
143-
File ret = new File(cellbarcodeFile.getPath().replaceAll("cb.txt.gz", "umi.txt.gz"));
144-
if (!ret.exists())
145-
{
146-
throw new PipelineJobException("Missing cached UMI file: " + ret.getPath());
134+
throw new PipelineJobException("Missing cached cellbarcode/UMI file: " + dataId);
147135
}
148136

149137
return ret;
@@ -156,7 +144,7 @@ private ExpData findCellBarcodeFiles(Readset rs) throws PipelineJobException
156144
TableInfo ti = us.getTable("outputfiles");
157145

158146
SimpleFilter sf = new SimpleFilter(FieldKey.fromString("readset"), rs.getRowId());
159-
sf.addCondition(FieldKey.fromString("category"), NimbleHelper.CATEGORY_CB);
147+
sf.addCondition(FieldKey.fromString("category"), NimbleHelper.CATEGORY_CB_UMI);
160148
List<Integer> cbs = new TableSelector(ti, PageFlowUtil.set("dataid"), sf, new Sort("-rowid")).getArrayList(Integer.class);
161149
if (!cbs.isEmpty())
162150
{
@@ -194,8 +182,6 @@ private File performCellRangerAlignment(AlignmentOutputImpl output, Readset rs,
194182
}
195183
}
196184

197-
NimbleHelper.write10xBarcodes(localBam, getWrapper().getLogger(), rs, referenceGenome, output);
198-
199185
return localBam;
200186
}
201187

singlecell/src/org/labkey/singlecell/run/NimbleHelper.java

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,7 @@ private Map<NimbleGenome, File> doAlignment(List<NimbleGenome> genomes, List<Fil
498498
return resultMap;
499499
}
500500

501-
public static final String CATEGORY_CB = "10x CellBarcode Map";
502-
public static final String CATEGORY_UB = "10x UMI Map";
501+
public static final String CATEGORY_CB_UMI = "10x CellBarcode/UMI Map";
503502

504503
public static void write10xBarcodes(File bam, Logger log, Readset rs, ReferenceGenome referenceGenome, PipelineStepOutput output) throws PipelineJobException
505504
{
@@ -509,18 +508,13 @@ public static void write10xBarcodes(File bam, Logger log, Readset rs, ReferenceG
509508
barcodeArgs.add("-I");
510509
barcodeArgs.add(bam.getPath());
511510

512-
File cbOutput = new File(bam.getParentFile(), SequenceAnalysisService.get().getUnzippedBaseName(bam.getName()) + ".cb.txt.gz");
513-
barcodeArgs.add("--cbOutput");
514-
barcodeArgs.add(cbOutput.getPath());
515-
516-
File umiOutput = new File(bam.getParentFile(), SequenceAnalysisService.get().getUnzippedBaseName(bam.getName()) + ".umi.txt.gz");
517-
barcodeArgs.add("--umiOutput");
518-
barcodeArgs.add(umiOutput.getPath());
511+
File bcOutput = new File(bam.getParentFile(), SequenceAnalysisService.get().getUnzippedBaseName(bam.getName()) + ".bc.txt.gz");
512+
barcodeArgs.add("--output");
513+
barcodeArgs.add(bcOutput.getPath());
519514

520515
runner.execute(barcodeArgs);
521516

522-
output.addSequenceOutput(cbOutput, "10x CellBarcode Map: " + rs.getName(), CATEGORY_CB, rs.getReadsetId(), null, referenceGenome.getGenomeId(), null);
523-
output.addSequenceOutput(umiOutput, "10x UMI Map: " + rs.getName(), CATEGORY_UB, rs.getReadsetId(), null, referenceGenome.getGenomeId(), null);
517+
output.addSequenceOutput(bcOutput, "10x CellBarcode/UMI Map: " + rs.getName(), CATEGORY_CB_UMI, rs.getReadsetId(), null, referenceGenome.getGenomeId(), null);
524518
}
525519

526520
public static File runNimbleReport(File alignResultsGz, int genomeId, PipelineStepOutput output, PipelineContext ctx) throws PipelineJobException
@@ -600,7 +594,7 @@ private static File getNimbleDoneFile(File parentDir, String resumeString)
600594
return new File(parentDir, "nimble." + resumeString + ".done");
601595
}
602596

603-
public static File runFastqToBam(PipelineStepOutput output, PipelineContext ctx, Readset rs, List<File> inputFastqs1, List<File> inputFastqs2, File cellBarcodes, File umiMapping) throws PipelineJobException
597+
public static File runFastqToBam(PipelineStepOutput output, PipelineContext ctx, Readset rs, List<File> inputFastqs1, List<File> inputFastqs2, File cellBarcodeUmiMap) throws PipelineJobException
604598
{
605599
List<File> outputBams = new ArrayList<>();
606600
int bamIdx = 0;
@@ -632,11 +626,8 @@ public static File runFastqToBam(PipelineStepOutput output, PipelineContext ctx,
632626
args.add("--r2-fastq");
633627
args.add(inputFastqs2.get(bamIdx).getPath());
634628

635-
args.add("--cell-barcodes");
636-
args.add(cellBarcodes.getPath());
637-
638-
args.add("--umi-mapping");
639-
args.add(umiMapping.getPath());
629+
args.add("--map");
630+
args.add(cellBarcodeUmiMap.getPath());
640631

641632
args.add("--output");
642633
args.add(outputBam.getPath());

0 commit comments

Comments
 (0)