Can I use rtracklayer to get the sequence surrounding a set of variants?
2
0
Entering edit mode
@stephanie-m-gogarten-5121
Last seen 13 hours ago
University of Washington

I have a set of variants stored in a GRanges, and I'd like to get the surrounding reference sequence (+/- 100 bp) for each one. I can use rtracklayer to view the variants in UCSC, and I can then get the surrounding sequence by going to the table browser, selecting my custom track and "output format: sequence", then specifying the number of extra bases I want in the browser window. Is there a way to do this programmatically from within R?

rtracklayer sequencing reference genome • 1.3k views
ADD COMMENT
1
Entering edit mode
@stephanie-m-gogarten-5121
Last seen 13 hours ago
University of Washington

No reason, I just hadn't used it before. Turns out it's super easy. Solution for posterity:

> library(BSgenome.Hsapiens.UCSC.hg19)
> gr <- GRanges("chr1", IRanges(65500, 65500))
> start(gr) <- start(gr) - 100
> end(gr) <- end(gr) + 100
> getSeq(Hsapiens, gr, as.character=TRUE)
[1] "AAAGCTCAGACTGGCTATTCCCAGATCTCTTCAGGTACATCTAGTCCATTCATAAAGGGCTTTTAATTAACCAAGTGGTTTACTAAAAAGGACAATTCACTACATATTATTCTCTTACAGTTTTTATGCCTCATTCTGTGAAAATTGCTGTAGTCTCTTCCAGTTATGAAGAAGGTAGGTGGAAACAAAGACAAAACACAT"
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 2.3 years ago
United States

Currently, no. There was some work on that, but it was abandoned, I think because BSgenome already offers the sequence for the important organisms. Is there some reason why you can't use a BSgenome package?

ADD COMMENT

Login before adding your answer.

Traffic: 862 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