PyWGCNA
0
2
Entering edit mode
18 months ago

I am using pyWGCNA to analyze 37 samples x 50000 genes.

I got the following error in analyseWGCNA().

Error image

What should I do? Please give me your opinion.

WGCNA • 2.5k views
ADD COMMENT
1
Entering edit mode

please read about reproducible examples (reprex) and then alter your post. E.g., here: https://reprex.tidyverse.org/

ADD REPLY
1
Entering edit mode

Thank you for your comment.

I apologize for the inadequacy of my question. I am having trouble understanding how to use "reprex" or "pyreprex". I am using Google colaboratory for python analysis. I have copied the more detailed code and output to Github and will attach it.

pyWGCNA question

Any valuable feedback from you would be greatly appreciated. Best regards.

ADD REPLY
1
Entering edit mode

Very nice!!! I will work on this at some time today when I have time. Until then, I can offer this:

the function that is throwing the error is not a part of the pyWGCNA package.

Instead, pyWGCNA calls Seaborn, and Seaborn calls matplotlib.

Now, within matplotlib, a function in _base.py() calls shrunk_to_aspect(), which ultimately throws the error. The best way forward is to google that exact error message. Doing that will show you a couple threads of people having the same problem in different scenarios: Sometimes you can study those scenarios and find a workaround.

Consider this thread. In their case, geopandas calls matplotlib, not seaborn, but the solution could be the same or similar to your case.

Will look more when have time.

ADD REPLY
0
Entering edit mode

Thanks for your response!!

   if box_aspect <= 0 or fig_aspect <= 0:
    --> 545             raise ValueError("'box_aspect' and 'fig_aspect' must be positive")

    <Figure size 4500x0 with 2 Axes>

I believe box_aspect is the cause of the error.

import matplotlib.pyplot as plt
fig1, ax = plt.subplots()
ax.set_box_aspect(1)

According to Google, the above code was added as a similar error countermeasure. However, since pyWGCNA is a library, it could not be incorporated from the outside.

ADD REPLY
1
Entering edit mode

I believe box_aspect is the cause of the error.

Yes - I think it is, because the fig_aspect variable is set to 1 by default (transforms.py, line 522).

it could not be incorporated from the outside

That's true, BUT you could temporarily alter the the shrunk_to_aspect() function within transforms.py, or perhaps one of the functions in _base.py() file within the matplotlib package, by writing:

vi /usr/local/lib/python3.10/dist-packages/matplotlib/transforms.py

you could the hardcode the box_aspect variable, for instance, then change it back afterwards.

ADD REPLY
1
Entering edit mode

Thank you for your valuable input!!

I will try your suggestion.

ADD REPLY
2
Entering edit mode

This is definitely not one of the easier / quicker debugging problems you come across - it is pretty difficult.

please feel free to continue posting updates if you get stuck.

VAL

ADD REPLY
1
Entering edit mode

Yoshi - Were you able to figure this out?

ADD REPLY
0
Entering edit mode

Hi, VAL! I'm still trying to figure this out. Will be working on it this weekend.

I will report back with or without progress.

ADD REPLY
0
Entering edit mode

This is definitely not one of the easier / quicker debugging problems you come across - it is pretty difficult.

Your thoughts are correct.

I have rewritten the code in transforms.py but noticed that it is not reflected.

PyWGCNA_question_2

I am thinking of incorporating "box_aspect = 1" if there is a way to reflect this..,

ADD REPLY

Login before adding your answer.

Traffic: 2333 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6