Skip to content

Commit 6b4a6f3

Browse files
committed
Support min cells to keep param for TcrFilter
1 parent f4ab831 commit 6b4a6f3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

singlecell/resources/chunks/TcrFilter.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ for (datasetId in names(seuratObjects)) {
2626
return(length(intersect(values, cdr3ForLocus)) != 0)
2727
})
2828

29-
if (sum(matchingCells) == 0) {
29+
if (sum(matchingCells) <= thresholdToKeep) {
30+
print(paste0('Too few cells, skipping: ', datasetId))
3031
next
3132
}
3233

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@ public static class Provider extends AbstractPipelineStepProvider<SingleCellStep
2121
{
2222
public Provider()
2323
{
24-
super("TcrFilter", "TCR-Based Filter", "CellMembrane/Seurat", "This will filter a seurat object based on TCR data.", Collections.singletonList(
24+
super("TcrFilter", "TCR-Based Filter", "CellMembrane/Seurat", "This will filter a seurat object based on TCR data.", Arrays.asList(
2525
SeuratToolParameter.create("cdr3s", "CDR3s To Keep", "A comma- or newline-delimited list of CDR3 sequences where locus prefixes the AA sequence (i.e. TRB:XXXXXX or TRA:YYYYYYY). Any cell matching any of these CDR3s will be kept. If that cell has multiple chains for a locus (i.e. 'CASSXXXXX,CASSYYYYY'), then only one of these needs to match for that cell to be kept. Also, all the input CDR3s should be single-chain (i.e. 'TRA:XXXXX', not 'TRA:XXXX,YYYY').", "sequenceanalysis-trimmingtextarea", new JSONObject(){{
2626
put("height", 150);
2727
put("delimiter", ",");
2828
put("stripCharsRe", "/(^['\"]+)|(['\"]+$)/g");
29-
}}, null).delimiter(",")
29+
}}, null).delimiter(","),
30+
SeuratToolParameter.create("thresholdToKeep", "Min Cells To Keep", "If fewer than this many cells remain, the object will be discarded. This is primary present because seurat cannot easily accommodate objects with 1 cells", "ldk-integerfield", new JSONObject(){{
31+
put("minValue", 0);
32+
}}, 1)
3033
), List.of("/sequenceanalysis/field/TrimmingTextArea.js"), null);
3134
}
3235

0 commit comments

Comments
 (0)