Comments (3)
Hi @PattF,
So there are a couple of issues with using sparse matrices with this tutorial. rpy2
is one of them... another is batch correction. While rpy2
(or now anndata2ri
in the newest version) cannot accept sparse matrices, ComBat (and all other batch correction/data integration tools I am aware of) will output a matrix that is no longer dominated by 0 values. You can of course run ComBat in such a way that either zeros are retained (setting all pre-combat 0s, to 0 after combat), or that all negative values are cast to 0... but we've not done that in the case study. It's also arguable whether this is not just a distortion of the expression values in a biased way to benefit computation efficiency (i.e., the zeros are artificial and they should not be there).
That being said, you should be able to turn your matrix back into a sparse format by running something like this: adata.X = sp.sparse.csr_matrix(adata.X)
. But the sparse representation may not longer be a good idea with the matrices that you do this to.
To be honest, I can't see why a downstream method would only work for sparse matrix representations. This is just a convenient way to represent the data using less memory to load it (if there are a lot of zeros), but the data is no different in sparse or dense representation.
I'm not entirely sure what you mean by a "list of provided transcripts". A sparse matrix would not constitute that input format either. You can obtain a list of transcripts from adata.var_names
.
Hope that helps.
from single-cell-tutorial.
Thanks for the explanation, makes more sense now!
I was just assuming it might have to do with sparse vs dense matrices as the function I'm trying to run contains a section with scipy.sparse.csr_matrix.
Happy to take this offline if you're interest to see what I mean, I fear posting it all here is out of scope for the tutorial.
Thanks again.
from single-cell-tutorial.
Maybe the method expects a count matrix? It's probably best to take this discussion elsewhere.
from single-cell-tutorial.
Related Issues (20)
- get the clustering and subclustering results differ from those given in example
- How can we change the plot shape (not only using dot) of UMAP in Scanpy? HOT 2
- executing sc.tl.rank_genes_groups() function on tutorial data provides incorrect results HOT 1
- Scale before calculating gene score, and after regressing out cell cycle ? HOT 2
- List of package versions for the latest version of the notebook HOT 3
- Sparse matrix dimensions HOT 1
- concatenate to main adata object HOT 1
- enviroment install failed HOT 1
- environment installation problem HOT 1
- ValueError: Unknown dtype dtype('uint16') cannot be converted to ?gRMatrix. HOT 4
- AttributeError: module 'pertpy.tools' has no attribute 'Milopy' HOT 2
- Concatenating issue when plotting analytic_pearson_residuals layers HOT 7
- sc.tl.rank_genes_groups , p value question HOT 1
- creating the env in windows
- Too few Duodenum cells HOT 1
- R command throw UnicodeDecodeError HOT 3
- Batch correction with combat causes Jupyter kernel to die HOT 2
- Key Error "base" in section "marker genes & annotation" HOT 4
- Can we also use Seurat v3 v4 or liger in scanpy or python? HOT 7
- sc.tl.rank_genes_groups and pct1 & pct2 output HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from single-cell-tutorial.