Giter Club home page Giter Club logo

enhance's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

enhance's Issues

k_nn calculation

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

Swapped labels of figure in Readme?

Really interesting work. I'm just wondering about the labels in the figure of the Readme. Shouldn't "Raw data" and "ENHANCE" be written on the side rather than on top?

figure

And since I'm here: Am I right to assume that the output of ENHANCE won't be a sparse matrix anymore?

UMAP from ENHANCE counts

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)

UMAP_raw

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)

UMAP_enhance

I'm using R 3.5.2 and Seurat v3 but I don't think that matters a lot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.