Skip to content

Commit 646dc2e

Browse files
committed
Support demuxEM demultiplexing, including caching of H5 files
1 parent 5a8cee6 commit 646dc2e

File tree

7 files changed

+220
-37
lines changed

7 files changed

+220
-37
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/ProcessVariantsHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,9 @@ public static File processVCF(File input, Integer libraryId, JobContext ctx, Res
471471

472472
private static String countUsingBcfTools(File vcf, Logger log) throws PipelineJobException
473473
{
474-
return new BcftoolsRunner(log).executeWithOutput(Arrays.asList("index", "-n", vcf.getPath()));
474+
BcftoolsRunner wrapper = new BcftoolsRunner(log);
475+
476+
return wrapper.executeWithOutput(Arrays.asList(wrapper.getBcfToolsPath().getPath(), "index", "-n", vcf.getPath()));
475477
}
476478

477479
public static String getVCFLineCount(File vcf, Logger log, boolean passOnly, boolean useBcfTools) throws PipelineJobException

singlecell/api-src/org/labkey/api/singlecell/CellHashingService.java

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import au.com.bytecode.opencsv.CSVReader;
44
import org.apache.commons.lang3.StringUtils;
5-
import org.apache.logging.log4j.Logger;
65
import org.jetbrains.annotations.NotNull;
76
import org.jetbrains.annotations.Nullable;
87
import org.json.JSONObject;
@@ -45,12 +44,12 @@ static public void setInstance(CellHashingService instance)
4544
_instance = instance;
4645
}
4746

48-
abstract public void prepareHashingIfNeeded(File sourceDir, PipelineJob job, SequenceAnalysisJobSupport support, String filterField, final boolean failIfNoHashing) throws PipelineJobException;
49-
50-
abstract public void prepareHashingAndCiteSeqFilesIfNeeded(File sourceDir, PipelineJob job, SequenceAnalysisJobSupport support, String filterField, boolean failIfNoHashing, boolean failIfNoCiteSeq) throws PipelineJobException;
47+
abstract public void prepareHashingForVdjIfNeeded(File sourceDir, PipelineJob job, SequenceAnalysisJobSupport support, String filterField, final boolean failIfNoHashing) throws PipelineJobException;
5148

5249
abstract public File generateHashingCallsForRawMatrix(Readset parentReadset, PipelineOutputTracker output, SequenceOutputHandler.JobContext ctx, CellHashingParameters parameters, File rawCountMatrixDir) throws PipelineJobException;
5350

51+
abstract public File getH5FileForGexReadset(SequenceAnalysisJobSupport support, int readsetId, int genomeId) throws PipelineJobException;
52+
5453
abstract public File getCDNAInfoFile(File sourceDir);
5554

5655
abstract public Sample getSampleById(int rowId);
@@ -69,7 +68,7 @@ static public void setInstance(CellHashingService instance)
6968

7069
abstract public boolean usesCiteSeq(SequenceAnalysisJobSupport support, List<SequenceOutputFile> inputFiles) throws PipelineJobException;
7170

72-
abstract public List<ToolParameterDescriptor> getHashingCallingParams();
71+
abstract public List<ToolParameterDescriptor> getHashingCallingParams(boolean allowDemuxEm);
7372

7473
abstract public Set<String> getHtosForParentReadset(Integer parentReadsetId, File webserverJobDir, SequenceAnalysisJobSupport support) throws PipelineJobException;
7574

@@ -94,10 +93,12 @@ public static class CellHashingParameters
9493
public @Nullable Integer genomeId;
9594
public boolean skipNormalizationQc = false;
9695
public Integer minCountPerCell = 5;
97-
public List<CALLING_METHOD> methods = CALLING_METHOD.getDefaultMethods();
96+
public List<CALLING_METHOD> methods = CALLING_METHOD.getDefaultConsensusMethods(); //Default to just executing the set used for default consensus calls, rather than additional ones
97+
public List<CALLING_METHOD> consensusMethods = null;
9898
public String basename = null;
9999
public Integer cells = 0;
100100
public boolean keepMarkdown = false;
101+
public File h5File = null;
101102

102103
private CellHashingParameters()
103104
{
@@ -127,6 +128,14 @@ public static CellHashingService.CellHashingParameters createFromStep(SequenceOu
127128
{
128129
throw new IllegalArgumentException("Must provide at least one calling method");
129130
}
131+
132+
String methodStr2 = StringUtils.trimToNull(step.getProvider().getParameterByName("consensusMethods").extractValue(ctx.getJob(), step.getProvider(), step.getStepIdx(), String.class));
133+
if (methodStr2 != null)
134+
{
135+
ret.consensusMethods = extractMethods(methodStr2);
136+
137+
throw new PipelineJobException("All consensusMethods must be present in methods: " + methodStr2);
138+
}
130139
}
131140

132141
return ret;
@@ -143,12 +152,21 @@ public static CellHashingParameters createFromJson(BARCODE_TYPE type, File webse
143152
ret.parentReadset = parentReadset;
144153
ret.htoBarcodesFile = new File(webserverDir, type.getAllBarcodeFileName());
145154
ret.methods = extractMethods(params.optString("methods"));
155+
ret.consensusMethods = extractMethods(params.optString("consensusMethods"));
146156

147157
if (type == BARCODE_TYPE.hashing && ret.methods.isEmpty())
148158
{
149159
throw new IllegalArgumentException("Must provide at least one calling method");
150160
}
151161

162+
if (ret.consensusMethods != null && !ret.consensusMethods.isEmpty())
163+
{
164+
if (!ret.methods.containsAll(ret.consensusMethods))
165+
{
166+
throw new PipelineJobException("All consensusMethods must be present in methods: " + ret.consensusMethods.stream().map(CALLING_METHOD::name).collect(Collectors.joining(",")));
167+
}
168+
}
169+
152170
return ret;
153171
}
154172

@@ -278,33 +296,51 @@ public Set<String> getAllowableBarcodeNames() throws PipelineJobException
278296

279297
public enum CALLING_METHOD
280298
{
281-
multiseq(false),
282-
htodemux(false),
283-
dropletutils(true),
284-
gmm_demux(true),
285-
bff_cluster(true),
286-
bff_raw(false);
299+
multiseq(true, false),
300+
htodemux(false, false),
301+
dropletutils(true, true),
302+
gmm_demux(true, true),
303+
demuxem(true, false),
304+
bff_cluster(true, true),
305+
bff_raw(true, false);
306+
307+
boolean isDefaultRun;
308+
boolean isDefaultConsensus;
309+
310+
CALLING_METHOD(boolean isDefaultRun, boolean isDefaultConsensus)
311+
{
312+
this.isDefaultRun = isDefaultRun;
313+
this.isDefaultConsensus = isDefaultConsensus;
314+
}
287315

288-
boolean isDefault;
316+
public boolean isDefaultRun()
317+
{
318+
return isDefaultRun;
319+
}
320+
321+
public boolean isDefaultConsensus()
322+
{
323+
return isDefaultConsensus;
324+
}
289325

290-
CALLING_METHOD(boolean isDefault)
326+
private static List<CALLING_METHOD> getDefaultRunMethods()
291327
{
292-
this.isDefault = isDefault;
328+
return Arrays.stream(values()).filter(CALLING_METHOD::isDefaultRun).collect(Collectors.toList());
293329
}
294330

295-
public boolean isDefault()
331+
private static List<CALLING_METHOD> getDefaultConsensusMethods()
296332
{
297-
return isDefault;
333+
return Arrays.stream(values()).filter(CALLING_METHOD::isDefaultConsensus).collect(Collectors.toList());
298334
}
299335

300-
public static List<CALLING_METHOD> getDefaultMethods()
336+
public static List<String> getDefaultRunMethodNames()
301337
{
302-
return Arrays.stream(values()).filter(CALLING_METHOD::isDefault).collect(Collectors.toList());
338+
return getDefaultRunMethods().stream().map(Enum::name).collect(Collectors.toList());
303339
}
304340

305-
public static List<String> getDefaultMethodNames()
341+
public static List<String> getDefaultConsensusMethodNames()
306342
{
307-
return getDefaultMethods().stream().map(Enum::name).collect(Collectors.toList());
343+
return getDefaultConsensusMethods().stream().map(Enum::name).collect(Collectors.toList());
308344
}
309345
}
310346

0 commit comments

Comments
 (0)