Skip to content

Commit 78daefa

Browse files
committed
new heuristics for low-dim data
1 parent a738900 commit 78daefa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

R/utils.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@ find.nn <- function(q, assay = "RNA", slot="data", npca=30, nfeatures=2000, k.pa
1212
if (ngenes < nfeatures) {
1313
nfeatures <- ngenes
1414
}
15-
if (ngenes < npca) {
16-
npca <- ngenes
15+
if (ngenes/2 < npca) {
16+
npca <- ngenes/2
1717
}
1818

1919
if (slot=="counts") {
2020
q <- NormalizeData(q, verbose = FALSE)
2121
}
22-
q <- FindVariableFeatures(q, selection.method = "vst", nfeatures = nfeatures, verbose = FALSE)
22+
if (ngenes > 200) { #only perform this for high-dim data
23+
q <- FindVariableFeatures(q, selection.method = "vst", nfeatures = nfeatures, verbose = FALSE)
24+
} else {
25+
q@assays[[assay]]@var.features <- rownames(q)
26+
}
2327

2428
q@assays[[assay]]@var.features <- setdiff(q@assays[[assay]]@var.features, genes.blacklist)
2529

0 commit comments

Comments
 (0)