Skip to content

Commit dbce93f

Browse files
committed
merge discvr19.1 r64347-64415
SVN r64416 |2019-09-03 17:06:15 +0000
1 parent 136c533 commit dbce93f

File tree

11 files changed

+134
-21
lines changed

11 files changed

+134
-21
lines changed

SequenceAnalysis/resources/external/scRNAseq/Seurat3.rmd

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ knitr::opts_chunk$set(message=FALSE, warning=FALSE,echo=TRUE,error = FALSE)
44
library(knitr)
55
library(OOSAP)
66
7+
cores <- Sys.getenv('SEQUENCEANALYSIS_MAX_THREADS')
8+
if (cores != ''){
9+
print(paste0('Setting future::plan to ', cores, ' cores'))
10+
future::plan("multiprocess", workers = as.integer(cores))
11+
} else {
12+
print('SEQUENCEANALYSIS_MAX_THREADS not set, will not set cores')
13+
}
14+
15+
print('Updating future.globals.maxSize')
16+
options(future.globals.maxSize = Inf)
17+
718
```
819

920
## Prepare data
@@ -51,7 +62,7 @@ print(seuratObj)
5162

5263
```{r InitialProcessing}
5364
54-
seuratObj <- ProcessSeurat1(seuratObj, variableGeneTable = paste0(outPrefix, '.variableGenes.txt'), doCellFilter = doCellFilter, saveFile = saveFile)
65+
seuratObj <- ProcessSeurat1(seuratObj, variableGeneTable = paste0(outPrefix, '.variableGenes.txt'), doCellFilter = doCellFilter, doCellCycle = doCellCycle, useSCTransform = useSCTransform, saveFile = saveFile)
5566
5667
```
5768

SequenceAnalysis/resources/external/scRNAseq/htoClassifier.Rmd

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,29 @@ library(OOSAP)
1010
1111
barcodeData <- ProcessCiteSeqCount(bFile = barcodeDir, doRowFilter = doHtoFilter)
1212
if (nrow(barcodeData) == 0) {
13-
stop('No passing HTOs')
13+
print('No passing HTOs')
1414
}
1515
1616
if (ncol(barcodeData) == 0) {
17-
stop('No passing cells')
17+
print('No passing cells')
1818
}
1919
20-
GenerateQcPlots(barcodeData)
20+
if (nrow(barcodeData) > 0 && ncol(barcodeData) > 0){
21+
GenerateQcPlots(barcodeData)
22+
}
2123
2224
```
2325

2426
## Generate calls
2527

2628
```{r GenerateCalls}
2729
28-
dt <- GenerateCellHashingCalls(barcodeData = barcodeData, outFile = finalCallFile, allCallsOutFile = allCallsOutFile)
30+
if (nrow(barcodeData) > 0 && ncol(barcodeData) > 0){
31+
dt <- GenerateCellHashingCalls(barcodeData = barcodeData, outFile = finalCallFile, allCallsOutFile = allCallsOutFile)
2932
30-
if (exists('whitelistFile') && !is.null(whitelistFile)){
31-
GenerateSummaryForExpectedBarcodes(dt, whitelistFile=whitelistFile, outputFile='metrics.txt', barcodeData=barcodeData)
33+
if (exists('whitelistFile') && !is.null(whitelistFile)){
34+
GenerateSummaryForExpectedBarcodes(dt, whitelistFile=whitelistFile, outputFile='metrics.txt', barcodeData=barcodeData)
35+
}
3236
}
3337
3438
```

SequenceAnalysis/resources/external/scRNAseq/seuratWrapper.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@ DOCKER=/opt/acc/sbin/exadocker
1111
LK_ROOT=$1
1212

1313
RAM_OPTS=""
14+
ENV_OPTS=""
1415
if [ ! -z $SEQUENCEANALYSIS_MAX_RAM ];then
1516
RAM_OPTS=" --memory=${SEQUENCEANALYSIS_MAX_RAM}g"
17+
18+
ENV_OPTS=" -e SEQUENCEANALYSIS_MAX_RAM"
19+
fi
20+
21+
if [ ! -z SEQUENCEANALYSIS_MAX_THREADS ];then
22+
ENV_OPTS=${ENV_OPTS}" -e SEQUENCEANALYSIS_MAX_THREADS"
1623
fi
1724

1825
sudo $DOCKER pull bimberlab/oosap
1926

20-
sudo $DOCKER run --rm=true $RAM_OPTS -v "${WD}:/work" -v "${HOME}:/homeDir" -u $UID -e USERID=$UID -w /work -e HOME=/homeDir bimberlab/oosap Rscript --vanilla script.R
27+
sudo $DOCKER run --rm=true $RAM_OPTS $ENV_OPTS -v "${WD}:/work" -v "${HOME}:/homeDir" -u $UID -e USERID=$UID -w /work -e HOME=/homeDir bimberlab/oosap Rscript --vanilla script.R

SequenceAnalysis/resources/views/importReadset.view.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
<dependency path="SequenceAnalysis/panel/SequenceImportSettingsPanel.js"/>
77
<dependency path="SequenceAnalysis/panel/SequenceImportPanel.js"/>
88
<dependency path="SequenceAnalysis/window/InstrumentRunWindow.js"/>
9+
<dependency path="SequenceAnalysis/panel/AnalysisSectionPanel.js"/>
910
</dependencies>
1011
</view>

SequenceAnalysis/resources/web/SequenceAnalysis/panel/SequenceImportPanel.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,9 +979,43 @@ Ext4.define('SequenceAnalysis.panel.SequenceImportPanel', {
979979
failure: LDK.Utils.getErrorCallback()
980980
});
981981

982+
multi.add(LABKEY.Ajax.request, {
983+
method: 'POST',
984+
url: LABKEY.ActionURL.buildURL('sequenceanalysis', 'getResourceSettingsJson'),
985+
scope: this,
986+
success: function(response){
987+
LDK.Utils.decodeHttpResponseJson(response);
988+
if (response.responseJSON){
989+
var json = response.responseJSON;
990+
var cfg = this.getJobResourcesCfg(response.responseJSON);
991+
if (cfg) {
992+
cfg.title = 'Step 4: Job Resources (optional)';
993+
var idx = this.items.length - 1;
994+
this.insert(idx, cfg);
995+
}
996+
}
997+
},
998+
failure: LDK.Utils.getErrorCallback()
999+
});
1000+
9821001
multi.send(this.onSendComplete, this);
9831002
},
9841003

1004+
getJobResourcesCfg: function(results){
1005+
if (results.resourceSettings){
1006+
return {
1007+
xtype: 'sequenceanalysis-analysissectionpanel',
1008+
title: 'Job Resources',
1009+
stepType: 'resourceSettings',
1010+
sectionDescription: '',
1011+
toolConfig: results,
1012+
toolIdx: 0
1013+
}
1014+
}
1015+
1016+
return null;
1017+
},
1018+
9851019
onSendComplete: function(){
9861020
if (this.fileLoadSuccess) {
9871021
var warnings = this.populateSamples();

SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisController.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,25 @@ public ApiResponse execute(Object form, BindException errors)
921921
}
922922
}
923923

924+
@RequiresPermission(ReadPermission.class)
925+
public class GetResourceSettingsJsonAction extends ReadOnlyApiAction<Object>
926+
{
927+
public ApiResponse execute(Object form, BindException errors)
928+
{
929+
Map<String, Object> ret = new HashMap<>();
930+
931+
JSONObject resourceSettings = getReourceSettingsJson();
932+
if (resourceSettings != null)
933+
{
934+
JSONArray arr = new JSONArray();
935+
arr.put(resourceSettings);
936+
ret.put("resourceSettings", arr);
937+
}
938+
939+
return new ApiSimpleResponse(ret);
940+
}
941+
}
942+
924943
@RequiresPermission(UpdatePermission.class)
925944
public class SaveAnalysisAsTemplateAction extends MutatingApiAction<SaveAnalysisAsTemplateForm>
926945
{

SequenceAnalysis/src/org/labkey/sequenceanalysis/analysis/CellRangerSeuratHandler.java

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,21 @@ public CellRangerSeuratHandler()
5353
ToolParameterDescriptor.create("useOutputFileContainer", "Submit to Source File Workbook", "If checked, each job will be submitted to the same workbook as the input file, as opposed to submitting all jobs to the same workbook. This is primarily useful if submitting a large batch of files to process separately. This only applies if 'Run Separately' is selected.", "checkbox", new JSONObject(){{
5454
put("checked", false);
5555
}}, false),
56-
ToolParameterDescriptor.create("dimsToUse", "PCs To Use", "This is not ideal, but for now hard code this value. This is the number of PCs that seurat will use.", "ldk-integerfield", new JSONObject(){{
56+
ToolParameterDescriptor.create("dimsToUse", "PCs To Use", "If non-blank, this is the number of PCs that seurat will use for dim reduction steps.", "ldk-integerfield", new JSONObject(){{
5757

5858
}}, null),
59+
ToolParameterDescriptor.create("minDimsToUse", "Minimum PCs To Use", "If non-blank, the pipeline will attempt to infer the number of PCs to use for dim reduction, but will not use fewer than this value.", "ldk-integerfield", new JSONObject(){{
60+
61+
}}, 10),
5962
ToolParameterDescriptor.create("doCellFilter", "Perform Cell Filtering", "If selected, cells will be filtered on pct.mito and number of unique genes.", "checkbox", new JSONObject(){{
6063
put("checked", true);
61-
}}, true)
64+
}}, true),
65+
ToolParameterDescriptor.create("doCellCycle", "Perform Cell Cycle Correction", "If selected, the pipeline will attempt to correct for cell cycle.", "checkbox", new JSONObject(){{
66+
put("checked", true);
67+
}}, true),
68+
ToolParameterDescriptor.create("useSCTransform", "Use SCTransform", "If selected, the pipeline will use the newer SCtransform method instead of the standard Seurat pipeline.", "checkbox", new JSONObject(){{
69+
put("checked", false);
70+
}}, false)
6271
));
6372
}
6473

@@ -263,11 +272,19 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
263272

264273
writer.println("outPrefix <- '" + outPrefix + "'");
265274
writer.println("resolutionToUse <- 0.6");
266-
String dimsToUse = ctx.getParams().optString("dimsToUse", "NULL");
275+
String dimsToUse = StringUtils.trimToNull(ctx.getParams().optString("dimsToUse"));
276+
dimsToUse = dimsToUse == null ? "NULL" : dimsToUse;
277+
267278
writer.println("dimsToUse <- " + dimsToUse);
268279
boolean doCellFilter = ctx.getParams().optBoolean("doCellFilter", true);
269280
writer.println("doCellFilter <- " + String.valueOf(doCellFilter).toUpperCase());
270281

282+
boolean doCellCycle = ctx.getParams().optBoolean("doCellCycle", true);
283+
writer.println("doCellCycle <- " + String.valueOf(doCellCycle).toUpperCase());
284+
285+
boolean useSCTransform = ctx.getParams().optBoolean("useSCTransform", false);
286+
writer.println("useSCTransform <- " + String.valueOf(useSCTransform).toUpperCase());
287+
271288
writer.println("data <- list(");
272289
String delim = "";
273290
for (SequenceOutputFile so : dataMap.keySet())
@@ -296,7 +313,16 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
296313
{
297314
throw new PipelineJobException("Unable to find expected file: " + seuratObj.getPath());
298315
}
299-
ctx.getFileManager().addSequenceOutput(seuratObj, "Seurat Object: " + outPrefix, "Seurat Data", (inputFiles.size() == 1 ? inputFiles.iterator().next().getReadset() : null), null, getGenomeId(inputFiles), null);
316+
317+
String dimsToUse = StringUtils.trimToNull(ctx.getParams().optString("dimsToUse"));
318+
String description = StringUtils.join(new String[]{
319+
"Correct Cell Cycle: " + ctx.getParams().optBoolean("doCellCycle", true),
320+
"Perform Cell Filtering: " + ctx.getParams().optBoolean("doCellFilter", true),
321+
"Dims To Use: " + (dimsToUse == null ? "automatic" : dimsToUse),
322+
"Use SCTransform: " + ctx.getParams().optBoolean("useSCTransform", false)
323+
}, "\n");
324+
325+
ctx.getFileManager().addSequenceOutput(seuratObj, "Seurat Object: " + outPrefix, "Seurat Data", (inputFiles.size() == 1 ? inputFiles.iterator().next().getReadset() : null), null, getGenomeId(inputFiles), description);
300326
ctx.getFileManager().addOutput(action, "Seurat Object", seuratObj);
301327

302328
if (!outHtml.exists())

SequenceAnalysis/src/org/labkey/sequenceanalysis/analysis/MultiQCBamHandler.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
9999
{
100100
if (rd.getFile1() != null)
101101
{
102-
dirs.add(findPipelineRoot(rd.getFile1(), ReadsetImportJob.NAME));
102+
dirs.add(findPipelineRoot(rd.getFile1().getParentFile(), ReadsetImportJob.NAME));
103103
}
104104

105105
if (rd.getFile2() != null)
106106
{
107-
dirs.add(findPipelineRoot(rd.getFile2(), ReadsetImportJob.NAME));
107+
dirs.add(findPipelineRoot(rd.getFile2().getParentFile(), ReadsetImportJob.NAME));
108108
}
109109
}
110110
}
@@ -144,12 +144,12 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
144144
ctx.addActions(action);
145145
}
146146

147-
private File findPipelineRoot(File start, String dirName)
147+
private File findPipelineRoot(File startDir, String dirName)
148148
{
149-
File ret = start.getParentFile();
149+
File ret = startDir;
150150
while (ret != null)
151151
{
152-
if (dirName.equals(ret.getName()))
152+
if (ret.getParentFile() != null && ret.getParentFile().getName().equals(dirName))
153153
{
154154
return ret;
155155
}
@@ -158,7 +158,7 @@ private File findPipelineRoot(File start, String dirName)
158158
}
159159

160160
//indicates pipeline root not found
161-
return start.getParentFile();
161+
return startDir;
162162
}
163163
}
164164
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ private static void moveInputToAnalysisDir(File input, SequenceJob job, Collecti
440440
//NOTE: we assume the input is gzipped already
441441
File outputDir = job.getAnalysisDirectory();
442442
File output = new File(outputDir, input.getName());
443+
job.getLogger().debug("Destination: " + output.getPath());
443444
if (output.exists())
444445
{
445446
if (unalteredInputs != null && unalteredInputs.contains(output))

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.labkey.api.pipeline.file.FileAnalysisJobSupport;
3838
import org.labkey.api.reader.Readers;
3939
import org.labkey.api.sequenceanalysis.model.Readset;
40+
import org.labkey.api.sequenceanalysis.pipeline.TaskFileManager;
4041
import org.labkey.api.util.Compress;
4142
import org.labkey.api.util.FileType;
4243
import org.labkey.api.util.FileUtil;
@@ -993,7 +994,15 @@ else if (type.equals(SequenceUtil.FILETYPE.sff))
993994
{
994995
if (getHelper().getSettings().isDoBarcode())
995996
{
996-
getHelper().getFileManager().addIntermediateFile(input);
997+
if (getHelper().getFileManager().getInputFileTreatment() == TaskFileManager.InputFileTreatment.delete)
998+
{
999+
getJob().getLogger().debug("Marking input as intermediate file: " + input.getPath());
1000+
getHelper().getFileManager().addIntermediateFile(input);
1001+
}
1002+
else
1003+
{
1004+
getJob().getLogger().debug("Inputs were not selected for deletion, not marking as intermediate: " + input.getPath());
1005+
}
9971006
}
9981007
}
9991008

0 commit comments

Comments
 (0)