yanailab / enhance Goto Github PK
View Code? Open in Web Editor NEWENHANCE: Accurate denoising of single-cell RNA-Seq data (Python implementation)
ENHANCE: Accurate denoising of single-cell RNA-Seq data (Python implementation)
Hi,
First of all, thank you for you package and for the great manuscript that is linked to it!
I'm trying to run Enhance on different datasets and some of them returned an error:
denois <- enhance (data)
[1] "Calculating number of neighbors to aggregate to aim for 2e+05 transcripts"
[1] "Number of neighbors to aggregate: 1"
[1] "Number of principal components to use: 50"
Error in base::rowSums(x, na.rm = na.rm, dims = dims, ...) :
'x' must be an array of at least two dimensions
10.stop("'x' must be an array of at least two dimensions")
9.base::rowSums(x, na.rm = na.rm, dims = dims, ...)
8.rowSums(D[, indices])
7.rowSums(D[, indices]) at
enhance.R#147
6.FUN(X[[i]], ...)
5.lapply(X = X, FUN = FUN, ...)
4.sapply(nn, function(indices) {
rowSums(D[, indices])
})
3.sapply(nn, function(indices) {
rowSums(D[, indices])
}) at
enhance.R#146
2.aggregate_nearest_neighbors(D = data_raw, nn = nn_1) at
enhance.R#223
1.enhance(data)
Strangely, I only got this error message with my bigger datasets (>1e+06 transcripts per cells). I am surprised that k_nn
estimation is 1 and I guess it is the source of the error.
Looking at the code I see that k_nn
, the number of neighbors to aggregate, is defined as
med_raw = median(colSums(data_raw))
k_nn = ceiling(target_transcripts / med_raw)
Maybe I miss an important point but shouldn't be k_nn
equal to ceiling(med_raw / target_transcripts )
instead, so that the number of neighbors to aggregate increases with the number of transcripts per cells ?
In every cases, do you know how I could avoid an error when k_nn = 1
? Should I increase k_nn
to 2 or does it mean that the dataset is too big/small for the method to work ?
[EDIT]
Sorry, I posted this issue in the Python repository instead of the R one. However the calculation of knn is the same and I guess my questions are still relevant here
k = int(ceil(target_transcript_count / transcript_count))
Thanks,
Anthony
ENHANCE is so fantastically simply and fast that I had to try it immediately.
Since I'm using the Seurat for most of my analyses, I used it to see the impact of ENHANCE on cluster and dimensional reduction. After using ENHANCE, I find many more clusters and noticed some strange looking shapes in the UMAP. I'm not sure I understood the procedure you described in the supplementary methods, but could it be that normalizing, PCA transformation and scaling the data introduces too smoothing (or whatever you might call it) which leads to these shapes?
Here is the code and UMAP made with the raw counts:
seurat_raw <- CreateSeuratObject(raw_sparse)
seurat_raw <- NormalizeData(seurat_raw)
seurat_raw <- FindVariableFeatures(seurat_raw)
seurat_raw <- ScaleData(seurat_raw)
seurat_raw <- RunPCA(seurat_raw)
seurat_raw <- FindNeighbors(seurat_raw)
seurat_raw <- FindClusters(seurat_raw)
seurat_raw <- RunUMAP(seurat_raw, dims = 1:30)
Here the code and UMAP after using ENHANCE:
seurat_enhance <- CreateSeuratObject(enhance_sparse)
seurat_enhance <- NormalizeData(seurat_enhance)
seurat_enhance <- FindVariableFeatures(seurat_enhance)
seurat_enhance <- ScaleData(seurat_enhance)
seurat_enhance <- RunPCA(seurat_enhance)
seurat_enhance <- FindNeighbors(seurat_enhance)
seurat_enhance <- FindClusters(seurat_enhance)
seurat_enhance <- RunUMAP(seurat_enhance, dims = 1:30)
I'm using R 3.5.2 and Seurat v3 but I don't think that matters a lot.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.