Entering edit mode
6.5 years ago
Ana
▴
200
Hi all I just want to draw a Manhattan plot for several environmental variable (Bayes factors for several env.variable; columns 3-5) in a loop in r. I want to draw a plot for each variable. this is the head of my data
> head(chrom1)
snp_pos chrom MAT_e MVMT_e MCMT_e snp_id
1 52967 0 -5.892840 -5.445123 -6.327080 52967_0
2 53241 0 -11.409509 -11.438922 -11.109112 53241_0
3 68062 0 -6.409155 -5.544443 -6.774634 68062_0
4 68080 0 -11.501740 -12.907424 -8.474243 68080_0
5 68285 0 -12.400456 -12.633168 -12.630723 68285_0
6 68296 0 -11.319704 -10.951429 -12.062912 68296_0
I am trying something like this, bust does not work and I am stuck now
pdf (file ="manhattan_plots.pdf", width = 24)
for (i in 3:5){
manhattan(chrom1,bp ="snp_pos", chr = "chrom", p ="i", snp = "snp", logp = FALSE, ylim = c(-20,50),suggestiveline = FALSE, genomewideline = 10, xlab = "chromosome", ylab = "BFis (in dB)", col = c("blue4", "orange3"))
}
dev.off()
I get this error message Error in manhattan(chrom1, bp = "snp_pos", chr = "chrom", p = "i", snp = "snp", : Column i not found!
how can I fix this? Thanks