YinLiLin / CMplot

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

Error in highlight.text #24

Open LineS97 opened 4 years ago

LineS97 commented 4 years ago

Hi,

I get this error, when I try to highlight my SNPs: Error in highlight_text(x = pvalue.posN[highlight_index[[i]]], y = logpvalue[highlight_index[[i]]], : highlighted genes not equal to the highlighted SNPs.

I have try to do it in some different ways, but I always end up with this error.

head(gwasny) SNP CHR BP P 1 rs367896724 1 10177 0.3010 2 rs201106462 1 10352 0.1123 3 rs575272151 1 11008 0.3141 4 rs544419019 1 11012 0.3141 5 rs540538026 1 13110 0.8830 6 rs62635286 1 13116 0.5363

SNPss [1] rs12122629 rs962993 rs12722547 rs10905467 rs7936070 rs970924
[7] rs3001427 rs1689510 rs373277279 rs2180769 rs72743477 rs778984966 [13] rs4787951 rs62026377 rs35311840 rs201389301 rs2412099 rs11406702 [19] rs1106639 rs72836344 rs7567352 rs73203086 rs7618005 rs45613035 [25] rs1837253 rs17622656 rs6865932 rs7705653 rs9270911 rs2428494
[31] rs9272226 rs905671 rs34567668 rs4739737 rs7848215 rs1758599
[37] rs10815279 37 Levels: rs10815279 rs10905467 rs1106639 rs11406702 rs12122629 ... rs970924

enes [1] "GENE_1" "GENE_2" "GENE_3" "GENE_4" "GENE_5" "GENE_6" "GENE_7" [8] "GENE_8" "GENE_9" "GENE_10" "GENE_11" "GENE_12" "GENE_13" "GENE_14" [15] "GENE_15" "GENE_16" "GENE_17" "GENE_18" "GENE_19" "GENE_20" "GENE_21" [22] "GENE_22" "GENE_23" "GENE_24" "GENE_25" "GENE_26" "GENE_27" "GENE_28" [29] "GENE_29" "GENE_30" "GENE_31" "GENE_32" "GENE_33" "GENE_34" "GENE_35" [36] "GENE_36" "GENE_37"

CMplot(gwasny, plot.type="m",LOG10=TRUE,col=c("grey30","grey60"),highlight=SNPss,

  • highlight.col=c("red","blue","green"),highlight.cex=1,highlight.pch=c(15:17), highlight.text=enes, highlight.text.col=c("red","blue","green"),threshold.lty=2, amplify=FALSE,file="jpg",memo="",dpi=300,file.output=TRUE,verbose=TRUE,width=14,height=6)

Error in highlight_text(x = pvalue.posN[highlight_index[[i]]], y = logpvalue[highlight_index[[i]]], : highlighted genes not equal to the highlighted SNPs

Best Line

YinLiLin commented 4 years ago

Hi,

Looking at the format of your given data, it should be fine, one potential reason i guess is that the 'SNPss' may not completely match to the 'gwasny', could you please check if there is any SNPs in 'SNPss' that don't appear in the first column of 'gwasny'? If not, I am pleasure to debug the script if you could email me your data at ylilin@163.com.

Best, LL

LineS97 commented 4 years ago

Hi LL, Im so sorry for the late response! I found a solution, thank you so much! Best, Line

parvathisudha commented 2 years ago

Hi LL, Im so sorry for the late response! I found a solution, thank you so much! Best, Line

Hi,

I am having similar issue. I checked the SNPS to be highlighted and the genes, they are the same. Can you please tell us about your solution for this issue?

Thanks Parvathi.

LineS97 commented 2 years ago

Of course. As far as I remember, I was simply missing my data from chromosome 9. I could plot everything else so I did not think about it being a problem. But it was :)

parvathisudha commented 2 years ago

Hi,

In my case, it is highlighting only some of the regions and getting an error when I label try to them. If I have to label gene1 in more than one point with different p-values, then it will highlight only one of that, not all.

Do you have any solution for this?

LineS97 commented 2 years ago

I don't remember it being a problem (having been working with it for a year), as far as I remember I highlight gene names with highlight.text=sapply(genes,function(x){x[1]}) or something like that. I will check my code tomorrow and let you know :-)

YinLiLin commented 2 years ago

Hi guys, thanks for proposing the issue, may i ask for a small example data which can repeat the above error? There may be some potential bugs in the script, i plant to locate it and get it resolved in the next version of updates.

parvathisudha commented 2 years ago

Hi,

Here is a subset of my input file.

SNP | CHR | Start | p-value | label CCDC73 | 11 | 32640216 | 4.47e-08 CCDC73 | 11 | 32681187 | 5.41e-12 CCDC75P1 | 3 | 73198278 | 3.46e-06 CCDC88C | 14 | 91276578 | 9.41e-07 CCDC88C | 14 | 91362544 | 2.62e-07 CCDC93 | 2 | 117959487 | 2.56e-07 CCDC93 | 2 | 117965310 | 1.43e-06 CCKAR | 4 | 26489029 | 3.85e-07 CCL3 | 17 | 36093423 | 2.10e-07 | CCL3 CCM2 | 7 | 45075689 | 4.05e-09 CCN2 | 6 | 131985186 | 1.02e-09 CCN5 | 20 | 44714082 | 1.08e-07 CCNB3 | X | 50368323 | 2.93e-07 CCNB3P1 | 5 | 26744323 | 1.10e-08 CCND1 | 11 | 69635059 | 4.14e-08 | CCND1 CCND1 | 11 | 69640495 | 1.00e-34 | CCND1 CCND1 | 11 | 69647220 | 1.33e-07 CCNHP1 | 4 | 181877362 | 6.47e-07 CCNHP1 | 4 | 181882206 | 1.61e-07 CCNHP1 | 4 | 181933568 | 2.75e-07 CCNHP1 | 4 | 181993542 | 1.24e-11

In my case, if I want to label CCND1 with different p-values, CMplot marks only one of that.

YinLiLin commented 2 years ago

yes, because CMplot does not allow having the same names for SNPs, that means all SNPs should be unique, so you can just replace the current SNPs names at the first column by a newly generated unique character vector, but remember not to change the labels which needs to be highlighted, then all the labels will be marked.

BirongZhang commented 1 year ago

Dear all,

I ran into the same problem. I only want to label few SNPs. I tried to do this but it doesn't work 😩

SNPs <- c(up[1:3],down[1:3])
color <- c(rep("red",3),rep("blue",3))

label <- SNPs
label[c(2:5)] <- NA
label_color <- color

Any advices would be highly appreciated, thanks.

YinLiLin commented 1 year ago

Hi @BirongZhang,

Thank you for the feedback. If you still cannot find a solution, you are welcome to send me a small example data which can reproduce the error, as well as the running script by the email: ylilin@163.com.

Best, LL