2011/6/16 Hervé Pagès <hpages@fhcrc.org>

> On 11-06-08 01:56 PM, Hervé Pagès wrote:
>
>> Hi Fahim,
>>
> [...]
>
>  So it looks like the first thing you might want to do is to import
>> your file into a GRangesList object. Which can be done with something
>> like:
>>
>> library(GenomicRanges)
>> refseqs <- read.table("RefSeqs.txt", header=TRUE,
>> stringsAsFactors=FALSE)
>> starts <- strsplitAsListOfIntegerVectors**(refseqs$targetStart)
>> widths <- strsplitAsListOfIntegerVectors**(refseqs$blockSizes)
>> ranges <- IRanges(start=unlist(starts), width=unlist(widths))
>> seqnames <- Rle(factor(refseqs$targetName)**, elementLengths(starts))
>> strand <- Rle(strand(refseqs$strand), elementLengths(starts))
>> gr <- GRanges(seqnames, ranges, strand)
>> grl <- split(gr, rep.int(seq_len(length(starts)**),
>> elementLengths(starts)))
>> names(grl) <- refseqs$RefSeqID
>>
>
> FWIW, I've added an utility function to the devel version of the
> GenomicRanges package that takes care of making a GRangesList object
> from this type of input:
>
>
>  library(GenomicRanges)
>  refseqs <- read.table("RefSeqs.txt", header=TRUE,
>                        stringsAsFactors=FALSE)
>  grl <- with(refseqs,
>              makeGRangesListFromFeatureFrag**ments(
>                  seqnames=targetName,
>                  fragmentStarts=targetStart,
>                  fragmentWidths=blockSizes,
>                  strand=strand))
>
> Sorry for the long and ugly name... (suggestions welcome).
>
>
The "blocks" function in rtracklayer does this for BED-style input (very
similar to the above). It takes a RangedData as imported from the BED and
outputs a GRanges with a 'tx' column that can be used for splitting into a
GRangesList.

One major difference is that the fragment starts are specified as offsets
from the start of the main feature (the transcript). If your function
supported that mode, then the two could be unified. Perhaps import.bed
should gain an expandBlocks argument that does this upon import.

Michael


> Cheers,
> H.
>
>
> --
> Hervé Pagès
>
> Program in Computational Biology
> Division of Public Health Sciences
> Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N, M1-B514
> P.O. Box 19024
> Seattle, WA 98109-1024
>
> E-mail: hpages@fhcrc.org
> Phone:  (206) 667-5791
> Fax:    (206) 667-1319
>
> ______________________________**_________________
> Bioconductor mailing list
> Bioconductor@r-project.org
> https://stat.ethz.ch/mailman/**listinfo/bioconductor<https://stat.ethz.ch/mailman/listinfo/bioconductor>
> Search the archives: http://news.gmane.org/gmane.**
> science.biology.informatics.**conductor<http://news.gmane.org/gmane.science.biology.informatics.conductor>
>

	[[alternative HTML version deleted]]

