YinLiLin / CMplot

📊 Circular and Rectangular Manhattan Plot
520 stars 112 forks source link

Labelling all chromosomes #70

Open hatre0 opened 2 years ago

hatre0 commented 2 years ago

Hi,

I'm plotting a subset of my chromosomes and am wondering if there's a way to get all the chromosomes labelled? I have chromosome 30 and 31 on the same plot but only 31 is being labelled (image). All are labelled correctly when the full genome is plotted.

Plotting code:

CMplot( subset(data, CHR>29), amplify = FALSE, signal.cex = 0.5, cex = 0.5, plot.type="m", multracks=TRUE, LOG10=TRUE, threshold=5e-8, threshold.col="black", file="jpg", memo="31", dpi=300, file.output=TRUE, verbose=TRUE, width=10, height=5, chr.labels.angle=0, cex.axis=1.25 )

cmplot

Thanks, Hannah

YinLiLin commented 2 years ago

Thank you for using CMplot. Please try to add a parameter chr.labels.angle=45.

hatre0 commented 2 years ago

Thanks for the suggestion. No such luck though image

YinLiLin commented 2 years ago

I am not pretty sure if there is a bug in the script. May i please ask for your data for debuging?

hatre0 commented 2 years ago

Data is commercially sensitive so I am not able to provide sorry. I have a theory though.

e.g. I have a chromosome with 10,000bp I split the chromosome in two unevenly and call it chr1 (base pairs 9000-10,000) and chr2 (base pairs 0-9000) cmplot would plot chr1 first and try to put the label at base pair 5000 (because it sees maximum base pair = 10,000 and assumes range 0-10,000) so "plots" the label outside the plotting space. chr2 plots as normal.

Would a process like that explain the lack of seeing "30" on the x axis? If so I will have to play with my data

Thankyou again

YinLiLin commented 2 years ago

oh, i guess you may forget to change the name of chromosome to "30", if you use the code unique(data[,2]), it should report two returns, that are "30" and "31", then there would be two labels at x-axis.

YinLiLin commented 2 years ago

BTW, it seems that you are plotting multiple traits in one axis, i recommend sourcing the latest script on GitHub, because we have updated some optimizations for this type of plot, which has not been submitted to CRAN.

hatre0 commented 2 years ago

I will look into the update thankyou. The chromosome is named correctly as when the whole genome is plotted the labels are there. In the image you can see the gap in Chr30 where (with the earlier example) the bases 0-9000 would be expected image