Skip to content

Commit 52fa80c

Browse files
committed
set samtools sort RAM for Velocyto
1 parent dccdd4d commit 52fa80c

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

singlecell/src/org/labkey/singlecell/run/VelocytoAlignmentStep.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ public Provider()
4646
put("extensions", Arrays.asList("gtf"));
4747
put("width", 400);
4848
put("allowBlank", true);
49-
}}, null)
49+
}}, null),
50+
ToolParameterDescriptor.createExpDataParam("samtoolsMem", "Samtools Mem To Sort (GB)", "The amount of ram to use to samtools sort", "ldk-integerfield", new JSONObject()
51+
{{
52+
put("minValue", 0);
53+
}}, 10)
5054
)), new LinkedHashSet<>(PageFlowUtil.set("sequenceanalysis/field/GenomeFileSelectorField.js")), null, true, false, ALIGNMENT_MODE.MERGE_THEN_ALIGN);
5155
}
5256

@@ -83,7 +87,8 @@ else if (!gtf.exists())
8387
}
8488
}
8589

86-
File loom = new VelocytoWrapper(getPipelineCtx().getLogger()).runVelocytoFor10x(localBam, gtf, outputDirectory, mask, rs);
90+
Integer samtoolsMem = getProvider().getParameterByName("samtoolsMem").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Integer.class);
91+
File loom = new VelocytoWrapper(getPipelineCtx().getLogger()).runVelocytoFor10x(localBam, gtf, outputDirectory, mask, rs, samtoolsMem);
8792
output.addSequenceOutput(loom, rs.getName() + ": velocyto", "Velocyto Counts", rs.getReadsetId(), null, referenceGenome.getGenomeId(), null);
8893

8994
return output;
@@ -102,7 +107,7 @@ public VelocytoWrapper(Logger log)
102107
super(log);
103108
}
104109

105-
public File runVelocytoFor10x(File localBam, File gtf, File outputFolder, @Nullable File mask, Readset rs) throws PipelineJobException
110+
public File runVelocytoFor10x(File localBam, File gtf, File outputFolder, @Nullable File mask, Readset rs, @Nullable Integer samtoolsMem) throws PipelineJobException
106111
{
107112
getLogger().debug("Inspecting GTF for lines without gene_id or transcript_id");
108113
int linesDropped = 0;
@@ -170,6 +175,13 @@ public File runVelocytoFor10x(File localBam, File gtf, File outputFolder, @Nulla
170175
args.add(String.valueOf(threads - 1));
171176
}
172177

178+
if (samtoolsMem != null)
179+
{
180+
// velocyto expects this in Mb
181+
args.add("--samtools_memory");
182+
args.add(String.valueOf(samtoolsMem * 1000));
183+
}
184+
173185
if (mask != null)
174186
{
175187
args.add("-m");

singlecell/src/org/labkey/singlecell/run/VelocytoAnalysisStep.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ public Provider()
4141
put("extensions", Arrays.asList("gtf"));
4242
put("width", 400);
4343
put("allowBlank", true);
44-
}}, null)
44+
}}, null),
45+
ToolParameterDescriptor.createExpDataParam("samtoolsMem", "Samtools Mem To Sort (GB)", "The amount of ram to use to samtools sort", "ldk-integerfield", new JSONObject()
46+
{{
47+
put("minValue", 0);
48+
}}, 10)
4549
), new LinkedHashSet<>(PageFlowUtil.set("sequenceanalysis/field/GenomeFileSelectorField.js")), null);
4650
}
4751

@@ -82,7 +86,8 @@ else if (!gtf.exists())
8286
}
8387
}
8488

85-
File loom = getWrapper().runVelocytoFor10x(inputBam, gtf, outputDir, mask, rs);
89+
Integer samtoolsMem = getProvider().getParameterByName("samtoolsMem").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Integer.class);
90+
File loom = getWrapper().runVelocytoFor10x(inputBam, gtf, outputDir, mask, rs, samtoolsMem);
8691
output.addSequenceOutput(loom, rs.getName() + ": velocyto", "Velocyto Counts", rs.getReadsetId(), null, referenceGenome.getGenomeId(), null);
8792

8893
return output;

0 commit comments

Comments
 (0)