Skip to content

Commit d0dd7f5

Browse files
committed
Support reference-guided mode for cellsnp-lite
1 parent 5a55965 commit d0dd7f5

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

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

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService;
1717
import org.labkey.api.sequenceanalysis.pipeline.ToolParameterDescriptor;
1818
import org.labkey.api.sequenceanalysis.run.SimpleScriptWrapper;
19+
import org.labkey.api.util.PageFlowUtil;
1920
import org.labkey.api.writer.PrintWriters;
2021
import org.labkey.singlecell.SingleCellModule;
2122
import org.labkey.singlecell.run.CellRangerGexCountStep;
@@ -30,18 +31,27 @@
3031

3132
public class VireoHandler extends AbstractParameterizedOutputHandler<SequenceOutputHandler.SequenceOutputProcessor>
3233
{
34+
private static final String REF_VCF = "refVCF";
35+
3336
public VireoHandler()
3437
{
35-
super(ModuleLoader.getInstance().getModule(SingleCellModule.class), "Run Vireo", "This will run cellsnp-lite and vireo to infer cell-to-sample based on genotype.", null, Arrays.asList(
38+
super(ModuleLoader.getInstance().getModule(SingleCellModule.class), "Run Vireo", "This will run cellsnp-lite and vireo to infer cell-to-sample based on genotype.", PageFlowUtil.set("sequenceanalysis/field/SequenceOutputFileSelectorField.js"), Arrays.asList(
3639
ToolParameterDescriptor.create("nDonors", "# Donors", "The number of donors to demultiplex", "ldk-integerfield", new JSONObject(){{
3740
put("allowBlank", false);
3841
}}, null),
3942
ToolParameterDescriptor.create("maxDepth", "Max Depth", "At a position, read maximally INT reads per input file, to avoid excessive memory usage", "ldk-integerfield", new JSONObject(){{
4043
put("minValue", 0);
41-
}}, null),
44+
}}, 50000),
4245
ToolParameterDescriptor.create("contigs", "Allowable Contigs", "A comma-separated list of contig names to use", "textfield", new JSONObject(){{
4346

44-
}}, "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20")
47+
}}, "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20"),
48+
ToolParameterDescriptor.createExpDataParam(REF_VCF, "Reference SNV Sites", "If provided, these sites will be used to screen for SNPs, instead of discovering them. If provided, the contig list will be ignored", "sequenceanalysis-sequenceoutputfileselectorfield", new JSONObject()
49+
{{
50+
put("allowBlank", true);
51+
put("category", "VCF File");
52+
put("performGenomeFilter", false);
53+
put("doNotIncludeInTemplates", true);
54+
}}, null)
4555
));
4656
}
4757

@@ -195,11 +205,26 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
195205
cellsnp.add("--refseq");
196206
cellsnp.add(genome.getWorkingFastaFile().getPath());
197207

198-
String contigs = ctx.getParams().optString("contigs", "");
199-
if (!StringUtils.isEmpty(contigs))
208+
int vcfFile = ctx.getParams().optInt(REF_VCF, -1);
209+
if (vcfFile > -1)
210+
{
211+
File vcf = ctx.getSequenceSupport().getCachedData(vcfFile);
212+
if (vcf == null || ! vcf.exists())
213+
{
214+
throw new PipelineJobException("Unable to find file with ID: " + vcfFile);
215+
}
216+
217+
cellsnp.add("-R");
218+
cellsnp.add(vcf.getPath());
219+
}
220+
else
200221
{
201-
cellsnp.add("--chrom");
202-
cellsnp.add(contigs);
222+
String contigs = ctx.getParams().optString("contigs", "");
223+
if (!StringUtils.isEmpty(contigs))
224+
{
225+
cellsnp.add("--chrom");
226+
cellsnp.add(contigs);
227+
}
203228
}
204229

205230
new SimpleScriptWrapper(ctx.getLogger()).execute(cellsnp);

0 commit comments

Comments
 (0)