Skip to content

Commit 77203ce

Browse files
committed
Update vireo args
1 parent 057d027 commit 77203ce

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

singlecell/src/org/labkey/singlecell/pipeline/singlecell/VireoHandler.java

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public class VireoHandler extends AbstractParameterizedOutputHandler<SequenceOu
4141
public VireoHandler()
4242
{
4343
super(ModuleLoader.getInstance().getModule(SingleCellModule.class), "Run CellSnp-Lite/Vireo", "This will run cellsnp-lite and vireo to infer cell-to-sample based on genotype.", new LinkedHashSet<>(PageFlowUtil.set("sequenceanalysis/field/SequenceOutputFileSelectorField.js")), Arrays.asList(
44-
ToolParameterDescriptor.create("nDonors", "# Donors", "The number of donors to demultiplex", "ldk-integerfield", new JSONObject(){{
45-
put("allowBlank", false);
44+
ToolParameterDescriptor.create("nDonors", "# Donors", "The number of donors to demultiplex. This can be blank only if a reference VCF is provided.", "ldk-integerfield", new JSONObject(){{
45+
4646
}}, null),
4747
ToolParameterDescriptor.create("maxDepth", "Max Depth", "At a position, read maximally INT reads per input file, to avoid excessive memory usage", "ldk-integerfield", new JSONObject(){{
4848
put("minValue", 0);
@@ -112,6 +112,13 @@ public void init(JobContext ctx, List<SequenceOutputFile> inputFiles, List<Recor
112112
{
113113
throw new PipelineJobException("Unable to find file: " + bam.getPath());
114114
}
115+
116+
int nDonors = ctx.getParams().optInt("nDonors", -1);
117+
int vcfFile = ctx.getParams().optInt(REF_VCF, -1);
118+
if (nDonors == -1 & vcfFile == -1)
119+
{
120+
throw new PipelineJobException("nDonors must be provided, unless a reference VCF is used");
121+
}
115122
}
116123

117124
private File getBarcodesFile(File loupe)
@@ -146,7 +153,7 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
146153
File barcodesGz = getBarcodesFile(inputFiles.get(0).getFile());
147154
File bam = getBamFile(inputFiles.get(0).getFile());
148155

149-
File barcodes = new File(ctx.getWorkingDirectory(), "barcodes.csv");
156+
File barcodes = new File(ctx.getWorkingDirectory(), "barcodes.tsv");
150157
try (BufferedReader reader = IOUtil.openFileForBufferedUtf8Reading(barcodesGz); PrintWriter writer = PrintWriters.getPrintWriter(barcodes))
151158
{
152159
String line;
@@ -314,21 +321,20 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
314321
vireo.add("-o");
315322
vireo.add(ctx.getWorkingDirectory().getPath());
316323

317-
int nDonors = ctx.getParams().optInt("nDonors", 0);
318324
boolean storeCellSnpVcf = ctx.getParams().optBoolean("storeCellSnpVcf", false);
319-
if (nDonors == 0)
320-
{
321-
throw new PipelineJobException("Must provide nDonors");
322-
}
323-
324325
if (refVcfSubset != null)
325326
{
326327
vireo.add("-d");
327328
vireo.add(refVcfSubset.getPath());
328329
}
329330

330-
vireo.add("-N");
331-
vireo.add(String.valueOf(nDonors));
331+
// Note: this value should be checked in init(). It is required only if refVCF is null
332+
int nDonors = ctx.getParams().optInt("nDonors", -1);
333+
if (nDonors > -1)
334+
{
335+
vireo.add("-N");
336+
vireo.add(String.valueOf(nDonors));
337+
}
332338

333339
if (nDonors == 1)
334340
{

0 commit comments

Comments
 (0)