Good way to graph allele frequency of different SNPs along chromosomes
2
0
Entering edit mode
7.7 years ago
devenvyas ▴ 740

I have allele frequencies for the Neanderthal allele at sites where both Neanderthal genomes are homozygous and overlap with putative introgressed haplotypes in the form of Plink frequency output (--freq --missing --within cluster --out output).

I want to plot the allele frequencies along the SNPs' genomic coordinates.

Basically, I want to generate something like this Figure 1A from Sankararaman et al. (2014) (http://www.nature.com/nature/journal/v507/n7492/fig_tab/nature12961_F1.html) except the Y-axis would be frequency.

Anyone know how I could do this?

SNP allele • 6.3k views
ADD COMMENT
3
Entering edit mode
7.7 years ago
devenvyas ▴ 740

I figured out how to modify Isran's code. In case anyone else needs/wants it, here it is.

snps<-read.table("filename.txt",header=T)

goodChrOrder <- c(1:22,"X","Y")
snps$CHR <- factor(snps$CHR,levels=goodChrOrder)

library(ggplot2)
freq = ggplot(snps,aes(COORD,MAF, colour=CLST)) + geom_point() +
  facet_wrap(~ CHR,ncol=2) + # separate plots for each chr, x-scales can differ from chr to chr
  ggtitle("Distribution of allele frequency across genome") +
  xlab("Position in the genome") + 
  ylab("SNP frequency") + 


pdf("filename.pdf",20,20)
print(freq)
dev.off()
ADD COMMENT
0
Entering edit mode
7.7 years ago
John 13k

I often use Irsan's solution from Plotting Density Of Snps On Chromosomes Works for me :)

ADD COMMENT
0
Entering edit mode

Is there anyway to modify the code to display allele frequencies instead of density? Also, what about display frequencies in multiple populations?

ADD REPLY

Login before adding your answer.

Traffic: 3119 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6