Get DNA sequences using R and BSgenome




My typical approach for getting a particular DNA sequence is to use the UCSC genome browser. Recently I needed to screen over 40 SNPs for restriction enzyme cut sites and didn’t want to go through all the clicks on the UCSC browser to get the flanking sequences. The Galaxy tool could certainly make quick work of this task, but lately I’ve been trying to do all of my work in R. Here is an R solution utilizing the BSgenome package from Bioconductor:

#Install the BSgenome package from Bioconductor
source("http://bioconductor.org/biocLite.R")
biocLite("BSgenome")

#Load the BSgenome package
library(BSgenome)

#Download and install the genome of your choice
available.genomes()
biocLite("BSgenome.Celegans.UCSC.ce6")

#Load the Celegans data package, sequences are put into memory as needed
library(BSgenome.Celegans.UCSC.ce6)

#Create data.frame of SNPs
snps <- data.frame(chrom=c("chrI","chrII","chrIV"), start=c(8534533,7338823,
  6938443), end=c(8534534,7338824,6938444))
snps
##   chrom   start     end
## 1  chrI 8534533 8534534
## 2 chrII 7338823 7338824
## 3 chrIV 6938443 6938444

#Get flanking sequence where SNP is in the middle of 20 bp
snp.flanks <- getSeq(Celegans, snps$chrom, start=(snps$end-9), 
  end=(snps$end+10))
names(snp.flanks) chrI_8534534
## 2 CAAATTTTAGAAATTGTCAA
## 3       >chrII_7338824
## 4 TAAAGTATGTTTCTGTCTCA
## 5       >chrIV_6938444
## 6 TATTTAATGATGGAAATTAG
稿源:Eldon Prince (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合技术 » Get DNA sequences using R and BSgenome

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录