Comments (6)
Hi,
You can set save=False to avoid doing all the visualization and downstream analysis besides the module trait relationship heatmap
this function is mostly wanted to do downstream analysis and an appropriate way to visualise them.
so mainly in this function, I try to combine all the useful analyses in a single function to be able to run all of them in an easier way.
I will add one single function for the module trait relationship heatmap so that one would be doable with a single function as well.
from pywgcna.
Hi,
Sometimes we don't want to plot the heatmap and barplots. Now we can set sort=[] and save=False in analyseWGCNA. In this case, all the information are still be stored in pyWGCNA object, although the function will be interrupted by the empty list (sort=[]). Could you support sort = [], so we can run analyseWGCNA() without interruption ? then we can plot by ourselves in our favorite style and tools. Besides, could you return an ax for the figure in pyWGCNA so that we can revise and becautify the figures, now we cannot beautify the figures (such as barploteigengene, I think this also exists in other plotting functions) becuase of the lack of an ax.
from pywgcna.
Hi
there is no parameter called sort! So I assume you mean order! but you don't need to mess with this parameter in the new version you just need to set save=False so it's not gonna do any visualization!
For complicated plots, I also add return axs if you set save=FALSE but you have to call each function separately!
As I told you before, in this function I combine all the useful downstream analysis in a single function to be able to run all of them in an easier way. But if you want axs, you should run each of them separately.
if you have more questions about this, please reopen this issue :)
from pywgcna.
Hi, I mean it's better to support order=[""],here is the error when I set order=[""], then I can plot using our own tools, such as altair, echart, bokeh and so on.
I set order=[""] becuase I don't want to run the following code:
print(f"{OKCYAN}Calculating module trait relationship ...{ENDC}")
self.moduleTraitCor = pd.DataFrame(index=self.MEs.columns,
columns=datTraits.columns,
dtype="float")
self.moduleTraitPvalue = pd.DataFrame(index=self.MEs.columns,
columns=datTraits.columns,
dtype="float")
for i in self.MEs.columns:
for j in datTraits.columns:
tmp = stats.pearsonr(self.MEs[i], datTraits[j], alternative='greater')
self.moduleTraitCor.loc[i, j] = tmp[0]
self.moduleTraitPvalue.loc[i, j] = tmp[1]
fig, ax = plt.subplots(figsize=(max(20, int(self.moduleTraitPvalue.shape[0] * 1.5)),
self.moduleTraitPvalue.shape[1] * 1.5), facecolor='white')
# names
xlabels = []
for label in self.MEs.columns:
xlabels.append(label[2:].capitalize() + '(' + str(sum(self.datExpr.var['moduleColors'] == label[2:])) + ')')
ylabels = datTraits.columns
# Loop over data dimensions and create text annotations.
tmp_cor = self.moduleTraitCor.T.round(decimals=2)
tmp_pvalue = self.moduleTraitPvalue.T.round(decimals=3)
labels = (np.asarray(["{0}\n({1})".format(cor, pvalue)
for cor, pvalue in zip(tmp_cor.values.flatten(),
tmp_pvalue.values.flatten())])) \
.reshape(self.moduleTraitCor.T.shape)
sns.set(font_scale=1.5)
res = sns.heatmap(self.moduleTraitCor.T, annot=labels, fmt="", cmap='RdBu_r',
vmin=-1, vmax=1, ax=ax, annot_kws={'size': 20, "weight": "bold"},
xticklabels=xlabels, yticklabels=ylabels)
res.set_xticklabels(res.get_xmajorticklabels(), fontsize=20, fontweight="bold", rotation=90)
res.set_yticklabels(res.get_ymajorticklabels(), fontsize=20, fontweight="bold")
plt.yticks(rotation=0)
ax.set_title(f"Module-trait Relationships heatmap for {self.name}",
fontsize=30, fontweight="bold")
ax.set_facecolor('white')
fig.tight_layout()
if not show:
plt.close(fig)
if self.save:
fig.savefig(f"{self.outputPath}figures/Module_trait_relationships.{self.figureType}")
print("\tDone..\n")
print(f"{OKCYAN}Adding (signed) eigengene-based connectivity (module membership) ...{ENDC}")
self.CalculateSignedKME()
print("\tDone..\n")
if geneList is not None:
print(f"{OKCYAN}Updating gene information based on given gene list ...{ENDC}")
self.updateGeneInfo(geneInfo=geneList)
print("\tDone..\n")
............
from pywgcna.
Perhaps you can teach me how to run the functions in analyseWGCNA separately. Is it a wrapper of the following functions, I can run them sequentially to replace analyseWGCNA() ?
self.getDatTraits()
self.CalculateSignedKME()
self.plotModuleEigenGene
from pywgcna.
Hi
In my perspective, order=[""] does not make sense and that's exactly why you get that error :)
I'm not sure why you need self.getDatTraits() if you don't want to calculate module-trait relationship heatmap
To know how you should call each function, please look at the API documentation and search for the function you want to run!
from pywgcna.
Related Issues (20)
- how to set figsize HOT 2
- SystemExit: All your genes ended up in one modules! Reconsider your input parameters in order to get more modules. HOT 6
- module_trait_relationships_heatmap HOT 4
- Pandas error HOT 4
- 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
- Seeking help on `order` Parameter Usage and Metadata Color Settings HOT 13
- 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
- 2
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.