Fastman R package: How can set a different cex for points to be highlighted?

106 Views Asked by At

I want to plot SNPs-based and k-mers-based gwas results in one Manhattan plot. I can highlight the k-mers-based associations in Manhattan plot. But at some locations, both are overlapping to each other and one type is hidden under another. If I can give a different cex for only highlighted k-mers points I can easily see if SNPs-based are also present beneath them. Codes I am using:

if( !require(fastman) ){devtools::install_github('kaustubhad/fastman',build_vignettes = TRUE); library(fastman)} else 
        library(fastman)
library(data.table)
# Here is example data set
leafcd_All <- setDT( 
structure(list(chr = c(2L, 6L, 8L, 7L, 6L, 5L, 8L, 4L, 1L, 2L, 
                       1L, 4L, 4L, 6L, 5L, 2L, 2L, 7L, 1L, 4L), 
     ps = c(20812578L, 21922458L, 17725620L, 13743808L, 5562625L, 10048263L, 5509174L, 8047708L,             16788431L, 1210943L, 23409224L, 16606297L, 16789190L, 517233L,             14615216L, 20573133L, 13059817L, 12658352L, 19534214L, 10930609L), 
    rs = c("TGTAAGGTTGTTCCTAGAAATAATTGGCAAA_2153", "6_21922458", 
                                 "8_17725620", "7_13743808", "6_5562625", "5_10048263", "8_5509174", "4_8047708", "1_16788431", "2_1210943", "1_23409224", "4_16606297",  "4_16789190", "6_517233", "5_14615216", "2_20573133", "2_13059817",  "7_12658352", "1_19534214", "4_10930609"), 
    af = c(0.515, 0.20052599941513,-0.0991540413866392, 0.249140233643853, -0.258459039498031, -0.082762873887825,                                                                    0.208875049809843, 0.142353227958131, 0.238243182747475, -0.0952385144332126,                                                                   0.14830584593916, 0.087113892379901, 0.0773651947896911, -0.162990586405916,  0.169921912690918, 0.0709804692588175, -0.0713894932748928, 0.120534157624669, 0.0635756437123949, 0.0660060899435789),
 p_value = c(7.824069e-12, 0.00042769577040115, 0.00272540332860084, 0.00479242286846797, 
                           57412965, 0.0085338001721863,                                                                                 0.00959456164547606, 0.00966518049928214, 0.00993123682688346,                                                                               0.0117703417292982, 0.0149086053151355, 0.0150152941107474, 0.0174181286161663,                                                                                                                          0.0180474657048135, 0.0185344464537632, 0.0214819012476155, 0.0241552335174933,                                                                                                                          0.0247393426120147, 0.0327745679439906)), 
row.names = c(NA, -20L ), class = c( "data.frame") ) )

leafcd_All<-fread('output2.txt')
highlight_snps <- scan("highlight.txt", what=character())
fastman(leafcd_All, snp = "rs", chr="chr", bp = "ps", p="p_value",
 ylab="-LogP_leaffe_boxcox_All", col = c("darkgreen", "mediumvioletred"), 
main=NULL,suggestiveline =FALSE, genomewideline=7.73, 
cex=0.8,cex.lab=0.8,highlight=highlight_snps)

But I don't have an idea how to set a different point size for highlighted SNP above.

0

There are 0 best solutions below