YinLiLin / CMplot

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

Error : missing value where TRUE/FALSE needed #54

Open anikng opened 3 years ago

anikng commented 3 years ago

Can you please help me understanding the error thrown by CMplot?

*Error in if ((y[i] + 1.5 strheight(words[i], cex = text.cex)) > max(ylim)) { : missing value where TRUE/FALSE needed**

My code,

`length_ds<-read_csv("Length_control.csv") Highlight_SNPs<-read.csv("Highligting_SNPs.csv", header = T)

CMplot(length_ds, plot.type="m",LOG10=TRUE,col=c("grey30","grey60"),highlight=Highlight_SNPs$SNP, highlight.col=c("red","blue","green"),highlight.cex=1,highlight.pch=c(15:17), highlight.text=Highlight_SNPs$Gene,
highlight.text.col=c("red","blue","green"),threshold=0.5/nrow(length_ds),threshold.lty=2,
amplify=FALSE,file="jpg",memo="",dpi=300,file.output=TRUE,verbose=TRUE,width=14,height=6) `

Highliting_SNPs.csv looks like,

SNP Gene
SNP-1.2550305. GeneA1
SNP-1.18463769. GeneA2
SNP-1.31315134. GeneA3
SNP-1.31712331. GeneA4
SNP-1.31874931. GeneA5
SNP-1.31894544. GeneA6

Please note that Manhattan plot without gene highlighting works with my input dataset (4 columns :marker, chrome,pos, and trait). So I guess it has something to do with highlighting file or format.

YinLiLin commented 3 years ago

It seems that the format of all the data you prepared looks fine, would you mind sending me your data? i am pleasure to debug the problem and feed back to you soon.

anikng commented 3 years ago

Thanks. Yes, I sent an email.

YinLiLin commented 3 years ago

Hi, I have located the problem that caused the error you proposed. As CMplot will force the p-value to be in range of 0-1, any digits out of this range will be replaced by NA, if p-value of the highlighted SNP is in this case, it cannot be displayed, because it has no y position, please check your data, and find out why the p-values of some SNPs are bigger than 1.

anikng commented 3 years ago

Ok got it, thanks for the solution for this issue.!!