Skip to content

Commit 73128a0

Browse files
committed
Allow method to work on cite-seq and hashing
1 parent d343b37 commit 73128a0

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

singlecell/src/org/labkey/singlecell/CellHashingServiceImpl.java

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,10 @@ public File getValidCellIndexFile(File sourceDir)
341341
public File processCellHashingOrCiteSeqForParent(Readset parentReadset, PipelineOutputTracker output, SequenceOutputHandler.JobContext ctx, CellHashingParameters parameters) throws PipelineJobException
342342
{
343343
parameters.validate(true);
344-
Map<Integer, Integer> readsetToHashing = getCachedHashingReadsetMap(ctx.getSequenceSupport());
345-
if (readsetToHashing.isEmpty())
344+
Map<Integer, Integer> readsetToHashingOrCite = parameters.type == BARCODE_TYPE.hashing ? getCachedHashingReadsetMap(ctx.getSequenceSupport()) : getCachedCiteSeqReadsetMap(ctx.getSequenceSupport());
345+
if (readsetToHashingOrCite.isEmpty())
346346
{
347-
ctx.getLogger().info("No cached hashing readsets, skipping");
347+
ctx.getLogger().info("No cached " + parameters.type.name() + " readsets, skipping");
348348
return null;
349349
}
350350

@@ -356,35 +356,39 @@ public File processCellHashingOrCiteSeqForParent(Readset parentReadset, Pipeline
356356
}
357357

358358
long lineCount = SequencePipelineService.get().getLineCount(htoBarcodeWhitelist);
359-
if (lineCount == 1)
359+
if (parameters.type == BARCODE_TYPE.hashing && lineCount == 1)
360360
{
361361
ctx.getLogger().info("Only one barcode is used, will not use cell hashing");
362362
return null;
363363
}
364364

365-
ctx.getLogger().debug("total cached readset/hashing readset pairs: " + readsetToHashing.size());
365+
ctx.getLogger().debug("total cached readset/" + parameters.type.name() + " readset pairs: " + readsetToHashingOrCite.size());
366366
ctx.getLogger().debug("unique HTOs: " + lineCount);
367367

368-
Readset htoReadset = ctx.getSequenceSupport().getCachedReadset(readsetToHashing.get(parentReadset.getReadsetId()));
369-
if (htoReadset == null)
368+
Readset htoOrCiteReadset = ctx.getSequenceSupport().getCachedReadset(readsetToHashingOrCite.get(parentReadset.getReadsetId()));
369+
if (htoOrCiteReadset == null)
370370
{
371371
throw new PipelineJobException("Unable to find HTO readset for readset: " + parentReadset.getRowId());
372372
}
373-
parameters.htoOrCiteseqReadset = htoReadset;
374-
375-
File hashtagCalls = processCellHashingOrCiteSeq(output, ctx.getOutputDir(), ctx.getSourceDirectory(), ctx.getLogger(), parameters);
376-
if (!hashtagCalls.exists())
373+
parameters.htoOrCiteseqReadset = htoOrCiteReadset;
374+
375+
// either the HTO calls or count matrix for CITE-seq
376+
File processOutput = processCellHashingOrCiteSeq(output, ctx.getOutputDir(), ctx.getSourceDirectory(), ctx.getLogger(), parameters);
377+
if (!processOutput.exists())
377378
{
378-
throw new PipelineJobException("Unable to find expected file: " + hashtagCalls.getPath());
379+
throw new PipelineJobException("Unable to find expected file: " + processOutput.getPath());
379380
}
380381

381-
File html = new File(hashtagCalls.getParentFile(), FileUtil.getBaseName(FileUtil.getBaseName(hashtagCalls.getName())) + ".html");
382-
if (!html.exists())
382+
if (parameters.type == BARCODE_TYPE.hashing)
383383
{
384-
throw new PipelineJobException("Unable to find HTML file: " + html.getPath());
384+
File html = new File(processOutput.getParentFile(), FileUtil.getBaseName(FileUtil.getBaseName(processOutput.getName())) + ".html");
385+
if (!html.exists())
386+
{
387+
throw new PipelineJobException("Unable to find HTML file: " + html.getPath());
388+
}
385389
}
386390

387-
return hashtagCalls;
391+
return processOutput;
388392
}
389393

390394
@Override

0 commit comments

Comments
 (0)