Skip to content

Commit 1597a11

Browse files
committed
Add option to drop assays in seurat objects on merge
1 parent 3bc1602 commit 1597a11

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

singlecell/resources/chunks/MergeSeurat.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ mergeBatch <- function(dat) {
1212
}
1313
}
1414

15+
if (!is.null(assaysToDrop)) {
16+
for (assayName in assaysToDrop) {
17+
print(paste0('Dropping assay: ', assayName))
18+
for (datasetId in names(toMerge)) {
19+
if (assayName %in% names(toMerge[[datasetId]]@assays)) {
20+
toMerge[[datasetId]]@assays[[assayName]] <- NULL
21+
}
22+
}
23+
}
24+
}
25+
1526
seuratObj <- CellMembrane::MergeSeuratObjs(toMerge, projectName = projectName, doGC = doDiet, errorOnBarcodeSuffix = errorOnBarcodeSuffix)
1627
return(seuratObj)
1728
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ public Provider()
2828
put("allowBlank", false);
2929
}}, null),
3030
SeuratToolParameter.create("doDiet", "Run DietSeurat", "If selected, this will run DietSeurat and gc() on the incoming seurat objects prior to merge. This is primarily to help with memory.", "checkbox", null, false, "dietSeurat", true, false),
31-
SeuratToolParameter.create("errorOnBarcodeSuffix", "Error On Cell Barcode Suffixes", "In certain cases, software appends a digit (i.e. -1) to the end of cell barcodes; however, no code in DISCVR should do this. These are a problem if different datasets are inconsistent when using them. If this setting is checked, the code will error if these are encountered.", "checkbox", null, true, "errorOnBarcodeSuffix", true, false)
31+
SeuratToolParameter.create("errorOnBarcodeSuffix", "Error On Cell Barcode Suffixes", "In certain cases, software appends a digit (i.e. -1) to the end of cell barcodes; however, no code in DISCVR should do this. These are a problem if different datasets are inconsistent when using them. If this setting is checked, the code will error if these are encountered.", "checkbox", null, true, "errorOnBarcodeSuffix", true, false),
32+
SeuratToolParameter.create("assaysToDrop", "Assays to Drop", "These assays, entered comma-separated or one/line, will be dropped prior to merge.", "sequenceanalysis-trimmingtextarea", new JSONObject(){{
33+
put("height", 150);
34+
put("delimiter", ",");
35+
}}, "RNA.orig").delimiter(",")
3236
), null, null);
3337
}
3438

0 commit comments

Comments
 (0)