[Bioc-sig-seq] Like subseq() but with the ability to accept a vector of starts

Martin Morgan mtmorgan at fhcrc.org
Wed Jun 1 18:21:01 CEST 2011


On 06/01/2011 09:06 AM, Ivan Gregoretti wrote:
> Hello IRanges connoisseurs,
>
> Is there a function like subseq() but with the ability to accept a
> vector of starts?
>
>
> For instance, if I want to chop the beginning of the murine
> mitochondrial DNA into 50 nucleotides, I'd do
>
> library(BSgenome.Mmusculus.UCSC.mm9)
>
> subseq(Mmusculus[["chrM"]], start=1,   width=50)
> subseq(Mmusculus[["chrM"]], start=51,  width=50)
> subseq(Mmusculus[["chrM"]], start=101, width=50)
> ...

Sorry, didn't mean to send a response just yet; it would seem like a bug 
in subseq but maybe I'm misunderstanding (like you) what subseq is 
supposed to do. A solution (probably better from a memory use / speed 
perspective) is

   v = Views(Mmusculus[["chrM"]], successiveIRanges(rep(50, 100)))

which if necessary could be cast to a DNAStringSet

   as(v, "DNAStringSet")

Martin

>
> however, it would be more convenient something like this
>
> subseq(Mmusculus[["chrM"]], start=c(1,51,101), width=50)
>
> Thank you
>
> Ivan
>
> _______________________________________________
> Bioc-sig-sequencing mailing list
> Bioc-sig-sequencing at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing


-- 
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793



More information about the Bioc-sig-sequencing mailing list