Skip to content

Commit 5d58764

Browse files
committed
Bugfix to handling of 10x barcodes
1 parent fbe9a13 commit 5d58764

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,10 @@ public AlignmentOutput performAlignment(Readset rs, List<File> inputFastqs1, @Nu
400400
{
401401
NimbleHelper.write10xBarcodes(bam, getWrapper().getLogger(), rs, referenceGenome, output);
402402
}
403+
else
404+
{
405+
getPipelineCtx().getLogger().info("BAM file does not exist, cannot write 10x barcodes: " + bam.getPath());
406+
}
403407

404408
if (!shouldDiscardBam())
405409
{

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class NimbleAlignmentStep extends AbstractCellRangerDependentStep
4141
public static final String MAX_HITS_TO_REPORT = "maxHitsToReport";
4242
public static final String STRANDEDNESS = "strandedness";
4343
public static final String REQUIRE_CACHED_BARCODES = "requireCachedBarcodes";
44+
public static final String WRITE_10X_BARCODES = "write10xBarcodes";
4445

4546
public NimbleAlignmentStep(AlignmentStepProvider<?> provider, PipelineContext ctx, CellRangerWrapper wrapper)
4647
{
@@ -76,7 +77,10 @@ public static List<ToolParameterDescriptor> getToolParameters()
7677
}}, 4),
7778
ToolParameterDescriptor.create(REQUIRE_CACHED_BARCODES, "Fail Unless Cached Barcodes Present", "If checked, the pipeline will expect a previously computed map of cellbarcodes and UMIs to be computed. Under default conditions, if this is missing, cellranger will be re-run. This flag can be helpful to avoid that computation if you expect the barcode file to exist.", "checkbox", new JSONObject(){{
7879

79-
}}, false)
80+
}}, false),
81+
ToolParameterDescriptor.create(WRITE_10X_BARCODES, "Write 10x Barcodes To File", "If checked, the pipeline will save the 10x barcodes from the BAM to a TSV. This facilitates future analyses.", "checkbox", new JSONObject(){{
82+
83+
}}, true)
8084
);
8185
}
8286

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package org.labkey.singlecell.run;
22

3-
import htsjdk.samtools.SAMFileHeader;
4-
import htsjdk.samtools.SAMTag;
5-
import htsjdk.samtools.SamReaderFactory;
63
import org.labkey.api.pipeline.PipelineJobException;
74
import org.labkey.api.sequenceanalysis.model.AnalysisModel;
85
import org.labkey.api.sequenceanalysis.model.Readset;
@@ -21,6 +18,8 @@
2118
import java.util.LinkedHashSet;
2219
import java.util.List;
2320

21+
import static org.labkey.singlecell.run.NimbleAlignmentStep.WRITE_10X_BARCODES;
22+
2423
public class NimbleAnalysis extends AbstractPipelineStep implements AnalysisStep
2524
{
2625
public NimbleAnalysis(PipelineStepProvider<?> provider, PipelineContext ctx)
@@ -61,14 +60,14 @@ public Output performAnalysisPerSampleRemote(Readset rs, File inputBam, Referenc
6160
NimbleHelper helper = new NimbleHelper(getPipelineCtx(), getProvider(), getStepIdx());
6261
helper.doNimbleAlign(inputBam, output, rs, FileUtil.getBaseName(inputBam));
6362

64-
SAMFileHeader header = SamReaderFactory.makeDefault().getFileHeader(inputBam);
65-
if (header.getAttribute(SAMTag.CB.name()) != null)
63+
boolean write10xBarcodes = getProvider().getParameterByName(WRITE_10X_BARCODES).extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Boolean.class, true);
64+
if (write10xBarcodes)
6665
{
6766
NimbleHelper.write10xBarcodes(inputBam, getPipelineCtx().getLogger(), rs, referenceGenome, output);
6867
}
6968
else
7069
{
71-
getPipelineCtx().getLogger().info("BAM lacks CB tag, will not output 10x barcodes to file");
70+
getPipelineCtx().getLogger().info("10x barcodes will not be saved to TSV");
7271
}
7372

7473
return output;

0 commit comments

Comments
 (0)