[Bioc-sig-seq] GRanges object from AlignedRead?

Martin Morgan mtmorgan at fhcrc.org
Sun Feb 28 19:53:16 CET 2010


On 02/28/2010 09:49 AM, Patrick Aboyoun wrote:
> Joseph,
> There is a short term answer and a long term answer to that question.
> The short term answer is below. The long term answer is that the
> GenomicFeatures infrastructure is undergoing rapid changes and so you
> should use it with caution over the next 2-4 weeks. If you run into any
> issues or have any feature requests, don't hesitate to e-mail the list.
> 
> library(ShortRead)
> sp <- SolexaPath(system.file("extdata", package="ShortRead"))
> ap <- analysisPath(sp)
> aligns <- readAligned(ap, "s_2_export.txt", "SolexaExport")
> aligns <- aligns[!is.na(position(aligns))]
> levels(aligns at chromosome) <- gsub("\\.fa$", "", levels(chromosome(aligns)
>
> alignRanges <-
> GRanges(seqnames = chromosome(aligns),
>         ranges = IRanges(position(aligns), width = width(aligns)),
>         strand = as.character(strand(aligns)))

Two important revisions to this. As of ShortRead 1.5.16, one can

  chromosome =
    factor(chromosome(aligns),
           labels=sub("\\.fa$", "", levels(chromosome(aligns))))
  aligns = renew(aligns, chromosome=chromosome)

and levels(strand(aligns)) has been updated to return c("+", "-", "*")
in ShortRead 1.5.18 (svn now, biocLite after Monday) so there is no need
for the character cast.

   GRanges(seqnames = chromosome(aligns),
           ranges = IRanges(position(aligns), width = width(aligns)),
           strand = strand(aligns))

see news(Version>=1.5, "ShortRead")

> 
> alignRanges
> GRanges with 406 ranges and 0 values columns
>    seqnames                 ranges strand |
> <Rle> <IRanges> <Rle> |
> 1     chr17 [ 69345321,  69345355]      - |
> 2     chr18 [ 54982866,  54982900]      + |
> 3     chr12 [ 80537786,  80537820]      - |
> 4     chr10 [117148563, 117148597]      - |
> 5      chr9 [  9192755,   9192789]      - |
> 6      chr1 [  3393025,   3393059]      + |
> 7     chr19 [  4786365,   4786399]      - |
> 8      chr2 [ 98506741,  98506775]      - |
> 9      chr9 [  3026723,   3026757]      + |
> 10     chr8 [129798321, 129798355]      + |
> 
> 
> 
> 
> 
> On 2/27/10 7:29 PM, joseph wrote:
>> Hello
>> My goal is to identify the genes associated with the reads in my
>> AlignedRead object using GenomicFeatures package.
>> Can you please show me how to make the GRanges object from the
>> AlignedRead?
>> Joseph Dhahbi
>>
>>
>>
>>
>>     [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> Bioc-sig-sequencing mailing list
>> Bioc-sig-sequencing at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
>>
> 
> _______________________________________________
> Bioc-sig-sequencing mailing list
> Bioc-sig-sequencing at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing


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

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioc-sig-sequencing mailing list