YinLiLin / CMplot

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

highlighted SNPs in different color #75

Closed BirongZhang closed 1 year ago

BirongZhang commented 2 years ago

Hi @YinLiLin ,

Thanks for developing such a useful package. I really enjoy using it!

I wonder if I can highlight some genes in a different color myself. I know you have some function in "add genes or SNP names around highlighted SNPS", but I don't understand how it works. For example, I have SNPs <- c(" geneA ", "geneB", "geneC", "GeneD"), and I want geneA and geneB to be red, geneC and geneD to be blue, what should I do?

I hope I have made my problem clear. Any advice would be highly appreciated. Many thanks.

Kind regards, Birong

YinLiLin commented 2 years ago

Hi @BirongZhang ,

Thank you for using CMplot. First, you should assign a vector containing the names of the highlighted SNPs (e.g., "snpA", "snpB", "snpC", "snpD", which are located in the first column of your data) to the parameter "highlight", then add a parameter "highlight.text.col" to change the color of highlighted genes, for example:

CMplot(..., highlight=c("snpA", "snpB", "snpC", "snpD"), highlight.text=c(" geneA ", "geneB", "geneC", "GeneD"), highlight.text.col=c("red", "red", "blue", "blue"))

Best, Lilin

BirongZhang commented 2 years ago

Hi Lilin,

It works well. Thanks for your kind help!

Kind regards, Birong