Closed YannLeGuen closed 3 years ago
Thanks for using CMplot. I suggest to include this datapoint in your highlighted SNPs and assign NA for it in the corresponding position of text vector
This would be a convenient solution. However it does not work. I should say that I am trying the multracks option (TRUE). Given the following
a <- vector of all SNPs to avoid
b <- vector of SNPs with a true label
a <- a[!(a %in% b)]
c <- vector of labels for b
d <- rep(c(NA), times=length(a))
SNPs2<- c(b, a)
genes2 <- c(c, d)
genes <- list(genes1, genes2)
SNPs <- list(SNPs1, SNPs2)
This produces the following error:
Error in highlight_text(x = pvalue.posN[highlight_index[[i]]], y = logpvalue[highlight_index[[i]]], :
highlighted genes not equal to the highlighted SNPs.
Replacing
d <- rep(c('G'), times=length(a))
Leads to no error. However, as expected the other dots are labelled, which is not the behavior I want.
Thus, NA does not seem to be an acceptable value.
Thanks, Yann
Just re-read your post. I should assign NA to highlight.text.yadj and .highlight.text.xadj.
Edit:
Letting d as
d <- rep(c('G'), times=length(a))
xpos <- list(
rep(c(0), times=length(SNPs[[1]])),
c(rep(c(0), times=length(b)), rep(NA, times=length(a)))
)
ypos <- list(
rep(c(1), times=length(SNPs[[1]])),
c(rep(c(0), times=length(b)), rep(NA, times=length(a)))
)
Then assigning xpos and ypos to
highlight.text.xadj = xpos, highlight.text.yadj = ypos,
Leads to the following error for xadj
Error in highlight_text(x = pvalue.posN[highlight_index[[i]]], y = logpvalue[highlight_index[[i]]], :
-1, 0, 1 limited for xadj
So NA is not acceptable?
Hi Yann,
Sorry for not replying in time. If you only have one trait, just use 'vector' rather than 'list' taking one trait for an example: assuming there are 5 SNPs: SNP1, SNP2, SNP3, SNP4, SNP5, and we want to highlight SNP1, SNP3, SNP5 with labels of GENE1, GENE3, and GENE5, but as you encountered, the points of SNP2 and SNP4 are overlapped with the labels of other 3 SNPs, to avoid this matter, you can try as following:
CMplot(..., highlight=c("SNP1","SNP2","SNP3","SNP4","SNP5"), highlight.text=c("GENE1",NA,"GENE3",NA,"GENE5"))
LL
I have multiple traits as suggested by the lines below, where genes1 are the genes for trait1 and genes2 are the genes to highlight for trait2.
genes <- list(genes1, genes2)
SNPs <- list(SNPs1, SNPs2)
The proposed suggestion does not apply.
First thank you for this wonderful tool!
Would it be possible to avoid that the text overlap datapoint of the manhattan plots?
Thanks, Yann