what you want to do is create a Ranges object and then get a View of the
sequences.


library(Biostrings)
library(GenomicRanges)
mirs <- GRanges( paste('chr', mirInfo[i,1], sep=''),
                 IRanges(start=mirInfo[i,4], width=1),
                 strand=whereverYouKeepTheStrand )
upstream <- flank(mirs, 200)
upseqs <- Views(Rnorvegicus, mirs)
show(upseqs)

Untested because I am lazy as hell, but it should work, and be a LOT faster.


On Thu, Mar 15, 2012 at 8:23 AM, Iain Gallagher <
iaingallagher@btopenworld.com> wrote:

>
>
> Hello List
>
> I have a dataframe of miRNA genomic positions and I would like to get
> sequence for 200bp upstream of each microRNA.
>
> library(BSgenome.Rnorvegicus.UCSC.rn4)# get genome
>
> ftpAddr <- "ftp://mirbase.org/pub/mirbase/CURRENT/genomes/rno.gff" # get
> miR coords
> mirInfo <- read.table(ftpAddr) # as dataframe
>
> seqs <- list() # holder
>
> for (i in 1:nrow(mirInfo)){
> seq <- getSeq(Rnorvegicus, paste('chr', mirInfo[i,1], sep=''), start =
> mirInfo[i,4], end = mirInfo[i,4]+200)
> seqs <- c(seqs, seq)
> }
>
> This works but seems to be pretty inefficient in terms of computing power
> as my pc locks up during the loop.
>
> Could someone point me to a better way?
>
> Thanks
>
> iain
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>



-- 
*A model is a lie that helps you see the truth.*
*
*
Howard Skipper<http://cancerres.aacrjournals.org/content/31/9/1173.full.pdf>

	[[alternative HTML version deleted]]

