Code Monkey home page Code Monkey logo

Comments (3)

lorenzoamir avatar lorenzoamir commented on July 26, 2024

I tried looking into this issue hoping that I could maybe fix if it was just a matter of switching 2 variable names. And found this in the documentation of the WGCNA class:

class WGCNA(GeneExp):
"""
A class used to do weighted gene co-expression network analysis.
[ . . . ]
:param anndata: if the expression data is in anndata format you should pass it through this parameter. X should be expression matrix. var is a sample information and obs is a gene information.
:param anndata: anndata

So :param anndata: is repeated twice (the second time it should probably be :type anndata:), but the documentation states that genes should be stored in the obs field and samples should be in the var field. It is a bit counterintuitive, because, as far as I know, it is usually the other way round (obs = samples and var = genes), but this could explain why they were switched in my previous example.

However in the PyWGCNA_object tutorial it is stated that the data is stored "in AnnData format which rows/obs are samples/sample information and cols/var are genes/gene information" and indeed it is shown that the .obs field contains samples and the .var field contains genes.

I'm a bit confused and don't know if I should transpose my data or not anymore, this can be easily solved by using dataframes instead of anndata objects, but maybe it should be clarified a bit more clearly since an anndata option is available?

from pywgcna.

nargesr avatar nargesr commented on July 26, 2024

Hi @lorenzoamir ,

Thank you for mentioning this!

I'll look into this matter in the next few days and update the related documents :)

meanwhile, as you mentioned you can pass data in separate tsv/csv files.

from pywgcna.

nargesr avatar nargesr commented on July 26, 2024

Hi @lorenzoamir,

Sorry for the confusion! I was trying to use mostly the similar function/format of input that has been used in the original WGCNA in R.

you were right about the API documentation part. I fixed the documentation so X should be an expression matrix. var is a gene information and obs is a sample information.

for goodSamplesGenes, if you look at the wrapper function (preprocess()) for the preprocessing steps you can see that I transposed the expression matrix before passing it to the goodSamplesGenes() function.

goodGenes, goodSamples, allOK = WGCNA.goodSamplesGenes(self.datExpr.to_df().T)

I just updated the documentation! It should reflect on the website in the next few minutes.

Sorry again for the confusion and thanks for pointing it out
Please feel free to reopen this issue if there is still a problem.

from pywgcna.

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.