Comments (13)
Hi,
Thank you for your kind comments:)
- you need to specify this when you update your metadata. but I just realized I updated it in a way you don’t need to specify it. the only key import thing is that the index should match and it will update it based on the index
for more information look at the updateGeneInfo() and updateSampleInfo().
I will update the Data_format in the next week to reflect changes (I will notify you through this issue).
thanks for catching this :)
- if you have a continuous value you can pass the color as a color palette using matplotlib.cm.ScalarMappable.
from pywgcna.
Hi @nargesr , thanks so much for your time and kind help. Now everything works well in the new version.
from pywgcna.
Thanks for your quick reply. Sorry, I may still have a naive question😂. Regarding the second solution, I attempted the following codes, but encountered an error: AttributeError: 'ScalarMappable' object has no attribute 'keys'
.
import matplotlib as mpl
norm = mpl.colors.Normalize(vmin=min(adata.obs['age']),
vmax=max(adata.obs['age']))
cmap = mpl.colormaps['viridis']
pyWGCNA.setMetadataColor('age', mpl.cm.ScalarMappable(norm, cmap))
pyWGCNA.analyseWGCNA(geneList=adata.var)
from pywgcna.
Hi @KGZaker,
I believe I used the same script! lol
can you send me the full error?
import matplotlib as mpl
norm = mpl.colors.Normalize(vmin=adata.obs['age'].min(),
vmax=adata.obs['age'].max())
my_palette_age = mpl.cm.ScalarMappable(norm=norm, cmap='viridis')
from pywgcna.
Hi, thanks for helping me figure out what's wrong. Here is the code I used and errors I got:
pyWGCNA.updateSampleInfo(adata.obs[["sex", "age"]])
norm = mpl.colors.Normalize(vmin=adata.obs['age'].min(), vmax=adata.obs['age'].max())
my_palette_age = mpl.cm.ScalarMappable(norm=norm, cmap='viridis')
pyWGCNA.setMetadataColor('age', my_palette_age)
pyWGCNA.barplotModuleEigenGene(moduleName="white", metadata=["age"])
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[229], line 1
----> 1 pyWGCNA.barplotModuleEigenGene(moduleName="white", metadata=["age"])
File [~/micromamba/envs/macbiom/lib/python3.11/site-packages/PyWGCNA/wgcna.py:3028](http://localhost:8889/~/micromamba/envs/macbiom/lib/python3.11/site-packages/PyWGCNA/wgcna.py#line=3027), in WGCNA.barplotModuleEigenGene(self, moduleName, metadata, combine, colorBar, show)
3026 height_ratios = []
3027 for m in metadata:
-> 3028 height_ratios.append(len(list(self.metadataColors[m].keys())))
3029 height_ratios.reverse()
3031 modules = np.unique(self.datExpr.var['moduleColors']).tolist()
AttributeError: 'ScalarMappable' object has no attribute 'keys'
from pywgcna.
Hi @KGZaker
I just released the new version (2.0.4) which hopefully will solve your problem. Please upgrade the PyWGCNA and let me know if you still have the same problem
from pywgcna.
Related Issues (20)
- AttributeError: 'WGCNA' object has no attribute 'expressionList' HOT 1
- Unable to run the package due to pandas issue. I am attaching the screenshot for the error generated. HOT 6
- varianceStabilizingTransformation and input data HOT 3
- Gene Significance HOT 1
- Correlation matrix HOT 6
- ask for some questions HOT 3
- Image too large. How suppress drawing when using pyWGCNA_obj.preprocess() ? HOT 3
- RecursionError when run pyWGCNA_ct.preprocess() HOT 1
- getDatTraits method might not be suitable for continuous traits. HOT 1
- How adjust parameter in functions??
- Genes and samples switched in goodSamplesGenes HOT 3
- error experienced in tutorial HOT 6
- Doubt on application HOT 1
- What other methods to define metadata colors are allowed, besides color labels ('black', 'pink', etc)? HOT 1
- a issue for findModules() HOT 3
- findModules() inappropriately passes all kwargs to pickSoftThreshold() and cuttreeHybrid() HOT 2
- Re-naming modules HOT 1
- In the module Network Plot, Can we label the node as gene_name instead of gene_id ? HOT 2
- Several errors when performing findModules steps individually HOT 8
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 pywgcna.