On Thu, May 28, 2009 at 9:41 AM, Ivan Gregoretti <[email protected]> wrote:

> Hello everyone,
>
> It is very easy to display one sequence of DNA from the mouse genome.
>
> For example
>
> > library(BSgenome.Mmusculus.UCSC.mm9)
> > DNAString(Mmusculus$chr1)[100000000:100000050]
>  51-letter "DNAString" instance
> seq: GGACTGCTGTTGCTGATTCATGTTTGATGTTTTAGACTGCTAATATCCTGA
>
>
> My question:
>
> Now lets say I have a BED-like list of genomic spaces like this
>
> > head(A[ , c("chr", "start", "end")])
>   chr   start     end
> 1 chr1 3644952 3649720
> 2 chr1 4599146 4601342
> 3 chr1 5015865 5018830
> 4 chr1 5072928 5076881
> 5 chr1 5504220 5507065
> 6 chr1 5513886 5516391
>
> How do I display many sequences from different chromosomes?
>
>
> Another question:
>
> I wish to add these sequences to my BED-like data.frame as a new
> field. How do I convert them to strings?
>
>
If you used rtracklayer to read the BED file, ie import("file.bed"), you
would get a RangedData object, call it 'x'. Then you could loop over the
names of the RangedData and assign the DNAStringSet directly into the
RangedData:

x$sequence <- do.call("c", lapply(names(x), function(chr) {
  DNAStringSet(Views(Mmusculus[[chr]], ranges(x)[[chr]]))
}))

Untested, but should get you close. It's a bit verbose, so we're thinking of
ways to make it easier.

Michael


> In my defense:
>
> The first question is not covered in the documentation of
> BSgenome.Mmusculus.UCSC.mm9.
>
> Thank you,
>
> Ivan
>
>
> Ivan Gregoretti, PhD
> National Institute of Diabetes and Digestive and Kidney Diseases
> National Institutes of Health
> 5 Memorial Dr, Building 5, Room 205.
> Bethesda, MD 20892. USA.
> Phone: 1-301-496-1592
> Fax: 1-301-496-9878
>
> _______________________________________________
> Bioc-sig-sequencing mailing list
> [email protected]
> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
>

        [[alternative HTML version deleted]]

_______________________________________________
Bioc-sig-sequencing mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing

Reply via email to