GithubHelp home page GithubHelp logo

Comments (3)

LuckyMD avatar LuckyMD commented on August 25, 2024

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.

PattF avatar PattF commented on August 25, 2024

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.

LuckyMD avatar LuckyMD commented on August 25, 2024

Maybe the method expects a count matrix? It's probably best to take this discussion elsewhere.

from single-cell-tutorial.

Related Issues (20)

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.