Skip to content

Commit 5b873b3

Browse files
committed
Improve flexibility for running CellTypist
1 parent b7ad8f7 commit 5b873b3

File tree

7 files changed

+56
-7
lines changed

7 files changed

+56
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ private File runDefaultVariantMerge(TaskFileManagerImpl manager, RecordedAction
191191

192192
if (subsetVcfIdx.exists())
193193
{
194-
getJob().getLogger().debug("Index exists, will not re-submit the VCF: " + subsetVcf.getName());
194+
getJob().getLogger().debug("Index exists, will not re-subset the VCF: " + subsetVcf.getName());
195195
}
196196
else
197197
{

cluster/resources/web/cluster/window/Buttons.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ Cluster.Utils = new function() {
4444
}
4545

4646
window.location = LABKEY.ActionURL.buildURL('cluster', 'forcePipelineCancel', null, {jobIds: checked.join(',')});
47-
}
47+
},
48+
49+
replaceJobStore: function (dataRegionName) {
50+
const checked = LABKEY.DataRegions[dataRegionName].getChecked();
51+
if (!checked.length){
52+
Ext4.Msg.alert('Error', 'No rows selected');
53+
return;
54+
}
55+
56+
window.location = LABKEY.ActionURL.buildURL('cluster', 'replaceJobStore', null, {jobIds: checked.join(',')});
57+
},
4858
};
4959
};

cluster/src/org/labkey/cluster/ClusterModule.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.labkey.cluster.pipeline.TestCase;
4242
import org.labkey.cluster.query.ForceCancelJobsButton;
4343
import org.labkey.cluster.query.RecoverCompletedJobsButton;
44+
import org.labkey.cluster.query.ReplaceJobStoreButton;
4445
import org.labkey.cluster.query.ViewClusterSubmissionsButton;
4546
import org.labkey.cluster.query.ViewJavaLogButton;
4647

@@ -103,6 +104,7 @@ public void doStartupAfterSpringConfig(ModuleContext moduleContext)
103104
LDKService.get().registerQueryButton(new ViewClusterSubmissionsButton(), "pipeline", "job");
104105
LDKService.get().registerQueryButton(new RecoverCompletedJobsButton(), "pipeline", "job");
105106
LDKService.get().registerQueryButton(new ForceCancelJobsButton(), "pipeline", "job");
107+
LDKService.get().registerQueryButton(new ReplaceJobStoreButton(), "pipeline", "job");
106108
}
107109

108110
@Override

cluster/src/org/labkey/cluster/query/RecoverCompletedJobsButton.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ public RecoverCompletedJobsButton()
2525
@Override
2626
public boolean isAvailable(TableInfo ti)
2727
{
28-
return super.isAvailable(ti) || ContainerManager.getRoot().equals(ti.getUserSchema().getContainer());
28+
return ti.getUserSchema().getUser().isInSiteAdminGroup() && (super.isAvailable(ti) || ContainerManager.getRoot().equals(ti.getUserSchema().getContainer()));
2929
}
3030
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package org.labkey.cluster.query;
2+
3+
import org.labkey.api.data.ContainerManager;
4+
import org.labkey.api.data.TableInfo;
5+
import org.labkey.api.ldk.table.SimpleButtonConfigFactory;
6+
import org.labkey.api.module.ModuleLoader;
7+
import org.labkey.api.security.permissions.AdminPermission;
8+
import org.labkey.api.view.template.ClientDependency;
9+
import org.labkey.cluster.ClusterModule;
10+
11+
import java.util.Arrays;
12+
13+
public class ReplaceJobStoreButton extends SimpleButtonConfigFactory
14+
{
15+
public ReplaceJobStoreButton()
16+
{
17+
super(ModuleLoader.getInstance().getModule(ClusterModule.class), "Replace JobStore from JSON", "Cluster.Utils.replaceJobStore(dataRegionName);", Arrays.asList(
18+
ClientDependency.supplierFromPath("Ext4"),
19+
ClientDependency.supplierFromPath("cluster/window/Buttons.js")
20+
));
21+
22+
setPermission(AdminPermission.class);
23+
}
24+
25+
@Override
26+
public boolean isAvailable(TableInfo ti)
27+
{
28+
return ti.getUserSchema().getUser().isInSiteAdminGroup() && (super.isAvailable(ti) || ContainerManager.getRoot().equals(ti.getUserSchema().getContainer()));
29+
}
30+
}

singlecell/resources/chunks/RunCelltypist.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ for (datasetId in names(seuratObjects)) {
22
printName(datasetId)
33
seuratObj <- readRDS(seuratObjects[[datasetId]])
44

5-
seuratObj <- RIRA::RunCellTypist(seuratObj, convertAmbiguousToNA = convertAmbiguousToNA, columnPrefix = columnPrefix, pThreshold = pThreshold, minProp = minProp)
5+
for (mn in modelNames) {
6+
seuratObj <- RIRA::RunCellTypist(seuratObj, modelName = paste0(mn, '.pkl'), convertAmbiguousToNA = convertAmbiguousToNA, columnPrefix = paste0('celltypist.', mn, '.'), pThreshold = pThreshold, minProp = minProp, maxAllowableClasses = maxAllowableClasses)
7+
}
68

79
saveData(seuratObj, datasetId)
810
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,19 @@ public static class Provider extends AbstractPipelineStepProvider<SingleCellStep
2020
public Provider()
2121
{
2222
super("RunCelltypist", "Run Celltypist (Built-In Model)", "Celltypist", "This will run Celltypist with the Immune_All_Low.pkl model.", Arrays.asList(
23+
SeuratToolParameter.create( "modelNames", "Model(s)", "The build-in model(s) to use.", "ldk-simplecombo", new JSONObject(){{
24+
put("storeValues", "Immune_All_Low;Immune_All_High;Human_Lung_Atlas;Healthy_COVID19_PBMC");
25+
put("allowBlank", false);
26+
put("multiSelect", true);
27+
}}, "Immune_All_Low.pkl", null, true, true).delimiter(";"),
2328
SeuratToolParameter.create("convertAmbiguousToNA", "Convert Ambiguous To NA", "If true, any values for majority_voting with commas (indicating they are ambiguous) will be converted to NA", "checkbox", new JSONObject()
2429
{{
2530
put("checked", false);
2631
}}, false),
27-
SeuratToolParameter.create("columnPrefix", "Column Prefix", "If provided, this string will be added to the beginning of all output column names.", "textfield", new JSONObject()
32+
SeuratToolParameter.create("maxAllowableClasses", "Max Allowable Classes", "Celltypist can assign a cell to many classes, creating extremely long labels. Any cell with more than this number of labels will be set to NA", "ldk-integerfield", new JSONObject()
2833
{{
29-
30-
}}, null),
34+
put("minValue", 0);
35+
}}, 5),
3136
SeuratToolParameter.create("pThreshold", "pThreshold", "This is passed to the --p-thres argument.", "ldk-numberfield", new JSONObject()
3237
{{
3338
put("minValue", 0);

0 commit comments

Comments
 (0)