Cloufield / gwaslab

A Python package for handling and visualizing GWAS summary statistics. https://cloufield.github.io/gwaslab/
GNU General Public License v3.0
151 stars 25 forks source link

Display issues #8

Closed michaelofrancis closed 1 year ago

michaelofrancis commented 1 year ago

Hi, thank you for this package. There are a few more issues I would like to see fixed before using this package in a manuscript. Maybe there are already ways to fix these with parameters?

image
  1. There are too many axis ticks below the cut, and too few above.
  2. This gap before the beginning of the plot is not good
  3. How to change thickness of significance line? Right now it is too thick
  4. Uneven gaps between chromosomes, compare these large gaps in the later chromsomes to chr 1-12.

Thanks!

Cloufield commented 1 year ago

Hi, thanks for the very detailed discription. I fixed these issues and please update to pip install gwaslab==3.4.1

  1. you can now use ystep to change it.
  2. set xpad to change the padding before the first chr and after the last chr
  3. added a parameter sc_linewidth to change the thickness of cut line and significance line.
  4. you can use use_rank to remove all gaps. (By default, the physical basepair positions are used. So the gaps basicially mean there are no SNPs in those regions. You can usually see those gaps in the middle of chr9 , and acrocentric chromosomes like chr13,14,15,21,22.) If you set use_rank=True, gwaslab will simply use the rank instead of physical positions.

Example: mysumstats.plot_mqq(mode="m", skip=2, cut=50) image

and you can try the folowing parameters mysumstats.plot_mqq(mode="m", skip=2, cut=50,ystep=5,use_rank=True,sc_linewidth=1,xpad=0.01,marker_size=(10,10),fontsize=8)

image

michaelofrancis commented 1 year ago

This is great, thank you. I have a couple more items and then I will be all set. The first one is the most important, the others I can fix in Illustrator if necessary.

image
  1. Is there a way to set y-axis ticks to the section above the cut as well? It looks awkward with only one tick up there as there are many intermediate values that are difficult to interpret without the axes. I like that it displays the top value but it would be really great to have 100, 200 here as well.
  2. Why is 40 missing here?
  3. This is a minor point, but I think the x-axis should say "Chromosome" and not "Chromosomes"
  4. Is there a way to set the font family for the axis labels?

Thanks!

Cloufield commented 1 year ago

Hi, Thanks again for your very deailed comments. I just fixed those issues. Please update to pip install gwaslab==3.4.2. You can now use ylabels to set the y ticklabels and font_family to set the font family. "Chromosomes" was changed to "Chromosome".

Hope this is what you expected for the figure.

mysumstats.plot_mqq(mode="m", 
                    skip=2, 
                    cut=50,
                    ylabels=[5,10,20,30,40,50,100,168],
                    use_rank=True,
                    sc_linewidth=1,
                    xpad=0.01,
                    marker_size=(10,10),
                    fontsize=10,
                    font_family="Arial")

image

michaelofrancis commented 1 year ago

Hi, thanks again for your response. I think we are almost there...

I was thinking the expected behavior from "cut" was to change to logarithmic scale (technically, the log of the log scale since it is already a log scale of the original P values) , i.e. like this, where the y-axis doubles and each doubling remains the same distance apart.

image

Unfortunately the current behavior is to "re-set" the axis but not change to log scale.

image

Could you possibly implement the switch to log scale? I think this option would make this plotting tool very valuable. This is the last thing I will ask, I promise :)

Cloufield commented 1 year ago

Hi, You can now add "cut_log=True" to change the y axis above "cut" to log scale, and add "jagged=True" to make a jagged y axis if needed. Please update to "pip install gwaslab==3.4.3".

mysumstats.plot_mqq(mode="m",skip=3,
                    cut=50,
                    cut_log=True,
                    ylabels=[10,20,30,40,50,100,200,400],
                    fontsize = 8)

image

michaelofrancis commented 1 year ago

Incredible. Amazing. Thank you!!