|
16 | 16 | import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService; |
17 | 17 | import org.labkey.api.sequenceanalysis.pipeline.ToolParameterDescriptor; |
18 | 18 | import org.labkey.api.sequenceanalysis.run.SimpleScriptWrapper; |
| 19 | +import org.labkey.api.util.PageFlowUtil; |
19 | 20 | import org.labkey.api.writer.PrintWriters; |
20 | 21 | import org.labkey.singlecell.SingleCellModule; |
21 | 22 | import org.labkey.singlecell.run.CellRangerGexCountStep; |
|
30 | 31 |
|
31 | 32 | public class VireoHandler extends AbstractParameterizedOutputHandler<SequenceOutputHandler.SequenceOutputProcessor> |
32 | 33 | { |
| 34 | + private static final String REF_VCF = "refVCF"; |
| 35 | + |
33 | 36 | public VireoHandler() |
34 | 37 | { |
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( |
36 | 39 | ToolParameterDescriptor.create("nDonors", "# Donors", "The number of donors to demultiplex", "ldk-integerfield", new JSONObject(){{ |
37 | 40 | put("allowBlank", false); |
38 | 41 | }}, null), |
39 | 42 | ToolParameterDescriptor.create("maxDepth", "Max Depth", "At a position, read maximally INT reads per input file, to avoid excessive memory usage", "ldk-integerfield", new JSONObject(){{ |
40 | 43 | put("minValue", 0); |
41 | | - }}, null), |
| 44 | + }}, 50000), |
42 | 45 | ToolParameterDescriptor.create("contigs", "Allowable Contigs", "A comma-separated list of contig names to use", "textfield", new JSONObject(){{ |
43 | 46 |
|
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) |
45 | 55 | )); |
46 | 56 | } |
47 | 57 |
|
@@ -195,11 +205,26 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c |
195 | 205 | cellsnp.add("--refseq"); |
196 | 206 | cellsnp.add(genome.getWorkingFastaFile().getPath()); |
197 | 207 |
|
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 |
200 | 221 | { |
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 | + } |
203 | 228 | } |
204 | 229 |
|
205 | 230 | new SimpleScriptWrapper(ctx.getLogger()).execute(cellsnp); |
|
0 commit comments