Skip to content

Commit a4ad1e9

Browse files
committed
Update DefaultNimbleAppend params
1 parent e58c5b9 commit a4ad1e9

File tree

4 files changed

+25
-42
lines changed

4 files changed

+25
-42
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/util/SequenceUtil.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.json.JSONArray;
3434
import org.json.JSONObject;
3535
import org.labkey.api.pipeline.PipelineJobException;
36+
import org.labkey.api.pipeline.PipelineJobService;
3637
import org.labkey.api.sequenceanalysis.SequenceAnalysisService;
3738
import org.labkey.api.sequenceanalysis.model.Readset;
3839
import org.labkey.api.sequenceanalysis.pipeline.ReferenceGenome;
@@ -428,8 +429,19 @@ public static void sortROD(File input, Logger log, Integer startColumnIdx) throw
428429
//then sort/append the records
429430
CommandWrapper wrapper = SequencePipelineService.get().getCommandWrapper(log);
430431
String cat = isCompressed ? "zcat" : "cat";
432+
433+
String sortThreading = "";
434+
if (!PipelineJobService.get().isWebServer())
435+
{
436+
Integer threads = SequencePipelineService.get().getMaxThreads(log);
437+
if (threads != null && threads > 1)
438+
{
439+
sortThreading = " --parallel " + threads;
440+
}
441+
}
442+
431443
File tempSorted = new File(input.getParent(), "sorted.tmp");
432-
wrapper.execute(Arrays.asList("/bin/sh", "-c", "{ cat '" + tempHeader.getPath() + "'; " + cat + " '" + input.getPath() + "' | grep -v '^#' | sort -V -k1,1" + (startColumnIdx == null ? "" : " -k" + startColumnIdx + "," + startColumnIdx + "n") + "; } " + (isCompressed ? " | bgzip -c " : "")), ProcessBuilder.Redirect.to(tempSorted));
444+
wrapper.execute(Arrays.asList("/bin/sh", "-c", "{ cat '" + tempHeader.getPath() + "'; " + cat + " '" + input.getPath() + "' | grep -v '^#' | sort -V -k1,1" + (startColumnIdx == null ? "" : " -k" + startColumnIdx + "," + startColumnIdx + "n") + sortThreading + "; } " + (isCompressed ? " | bgzip -c " : "")), ProcessBuilder.Redirect.to(tempSorted));
433445

434446
//replace the non-sorted output
435447
input.delete();

singlecell/resources/chunks/AppendNimble.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ for (datasetId in names(seuratObjects)) {
1818

1919
for (genomeId in names(nimbleGenomes)) {
2020
maxAmbiguityAllowed <- nimbleGenomeAmbiguousPreference[[genomeId]]
21-
queryDatabaseForLineageUpdates <- queryDatabaseForLineageUpdatesPreference[[genomeId]]
2221
replaceExistingAssayData <- replaceExistingAssayDataByGenome[[genomeId]]
23-
seuratObj <- Rdiscvr::DownloadAndAppendNimble(seuratObject = seuratObj, allowableGenomes = genomeId, ensureSamplesShareAllGenomes = ensureSamplesShareAllGenomes, targetAssayName = nimbleGenomes[[genomeId]], enforceUniqueFeatureNames = TRUE, maxAmbiguityAllowed = maxAmbiguityAllowed, maxLibrarySizeRatio = maxLibrarySizeRatio, queryDatabaseForLineageUpdates = queryDatabaseForLineageUpdates, replaceExistingAssayData = replaceExistingAssayData)
22+
seuratObj <- Rdiscvr::DownloadAndAppendNimble(seuratObject = seuratObj, allowableGenomes = genomeId, ensureSamplesShareAllGenomes = ensureSamplesShareAllGenomes, targetAssayName = nimbleGenomes[[genomeId]], enforceUniqueFeatureNames = TRUE, maxAmbiguityAllowed = maxAmbiguityAllowed, maxLibrarySizeRatio = maxLibrarySizeRatio, replaceExistingAssayData = replaceExistingAssayData)
2423
}
2524

2625
saveData(seuratObj, datasetId)

singlecell/resources/web/singlecell/panel/NimbleAppendPanel.js

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
4040
},LABKEY.ext4.GRIDBUTTONS.DELETERECORD()],
4141
store: {
4242
type: 'array',
43-
fields: ['genomeId', 'targetAssay','maxAmbiguityAllowed', 'queryDatabaseForLineageUpdates', 'replaceExistingAssayData']
43+
fields: ['genomeId', 'targetAssay','maxAmbiguityAllowed', 'appendIfExists']
4444
},
4545
columns: [{
4646
dataIndex: 'genomeId',
@@ -78,24 +78,14 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
7878
minValue: 0
7979
}
8080
},{
81-
dataIndex: 'queryDatabaseForLineageUpdates',
81+
dataIndex: 'appendIfExists',
8282
width: 175,
83-
header: 'Check for Lineage Updates',
83+
header: 'Append To Assay If Exists',
8484
editor: {
8585
xtype: 'checkbox',
8686
allowBlank: true,
8787
value: false
8888
}
89-
},{
90-
dataIndex: 'replaceExistingAssayData',
91-
width: 150,
92-
header: 'Replace Existing Data?',
93-
editor: {
94-
xtype: 'checkbox',
95-
allowBlank: true,
96-
value: true
97-
}
98-
9989
}]
10090
}]
10191
});
@@ -106,7 +96,7 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
10696
getValue: function(){
10797
var ret = [];
10898
this.down('ldk-gridpanel').store.each(function(r, i) {
109-
ret.push([r.data.genomeId, r.data.targetAssay, r.data.maxAmbiguityAllowed ?? '', !!r.data.queryDatabaseForLineageUpdates], !!r.data.replaceExistingAssayData);
99+
ret.push([r.data.genomeId, r.data.targetAssay, r.data.maxAmbiguityAllowed ?? '', !!r.data.appendIfExists]);
110100
}, this);
111101

112102
return Ext4.isEmpty(ret) ? null : JSON.stringify(ret);
@@ -143,8 +133,7 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
143133
genomeId: row[0],
144134
targetAssay: row[1],
145135
maxAmbiguityAllowed: row[2],
146-
queryDatabaseForLineageUpdates: !!row[3],
147-
replaceExistingAssayData: !!row[4]
136+
appendIfExists: !!row[3]
148137
});
149138
grid.store.add(rec);
150139
}, this);

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

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected Chunk createParamChunk(SequenceOutputHandler.JobContext ctx, List<Seur
9696
for (int i = 0; i < json.length(); i++)
9797
{
9898
JSONArray arr = json.getJSONArray(i);
99-
if (arr.length() != 5)
99+
if (arr.length() != 4)
100100
{
101101
throw new PipelineJobException("Unexpected value: " + json.getString(i));
102102
}
@@ -113,38 +113,21 @@ protected Chunk createParamChunk(SequenceOutputHandler.JobContext ctx, List<Seur
113113
}
114114
ret.bodyLines.add(")");
115115

116-
ret.bodyLines.add("queryDatabaseForLineageUpdatesPreference <- list(");
117-
delim = "";
118-
for (int i = 0; i < json.length(); i++)
119-
{
120-
JSONArray arr = json.getJSONArray(i);
121-
if (arr.length() != 5)
122-
{
123-
throw new PipelineJobException("Unexpected value: " + json.getString(i));
124-
}
125-
126-
int genomeId = arr.getInt(0);
127-
String valStr = arr.get(3) == null ? null : StringUtils.trimToNull(String.valueOf(arr.get(3)));
128-
boolean val = Boolean.parseBoolean(valStr);
129-
130-
ret.bodyLines.add("\t" + delim + "'" + genomeId + "' = " + (val ? "TRUE" : "FALSE"));
131-
delim = ",";
132-
}
133-
ret.bodyLines.add(")");
134-
135116
ret.bodyLines.add("replaceExistingAssayDataByGenome <- list(");
136117
delim = "";
137118
for (int i = 0; i < json.length(); i++)
138119
{
139120
JSONArray arr = json.getJSONArray(i);
140-
if (arr.length() != 5)
121+
if (arr.length() != 4)
141122
{
142123
throw new PipelineJobException("Unexpected value: " + json.getString(i));
143124
}
144125

145126
int genomeId = arr.getInt(0);
146-
String valStr = arr.get(4) == null ? null : StringUtils.trimToNull(String.valueOf(arr.get(4)));
147-
boolean val = Boolean.parseBoolean(valStr);
127+
128+
// NOTE: the param in the UI is inverted: appendIfExists
129+
String valStr = arr.get(3) == null ? null : StringUtils.trimToNull(String.valueOf(arr.get(3)));
130+
boolean val = !Boolean.parseBoolean(valStr);
148131

149132
ret.bodyLines.add("\t" + delim + "'" + genomeId + "' = " + (val ? "TRUE" : "FALSE"));
150133
delim = ",";

0 commit comments

Comments
 (0)