[Bioc-sig-seq] Consolidating RangedData

Ivan Gregoretti ivangreg at gmail.com
Thu Jan 6 15:46:39 CET 2011


Hi Michael,

Sorry I couldn't provide more details yesterday. When I saw your post
I was logged out from the server and already on my way out of the
office.

This is my experience with stack(). Please see below.

Thank you,

Ivan


### load relevant libraries
library(Biostrings)
library(BSgenome.Mmusculus.UCSC.mm9)

### define a subset of chromosomes
someChromosomes <- c('chr1',  'chr2',  'chr3',  'chr4',  'chr5',
                     'chr6',  'chr7',  'chr8',  'chr9', 'chr10',
                    'chr11', 'chr12', 'chr13', 'chr14', 'chr15',
                    'chr16', 'chr17', 'chr18', 'chr19',
                     'chrX')

### generate a series of ranges at the end of the chromosomes
LargeListOfSmallRangedData <- lapply(someChromosomes,

function(x){RangedData(ranges=IRanges(start=seq(length(Mmusculus[[x]])-500+1,

              length(Mmusculus[[x]]),

              100),

    width=100),
                                                            space=x,

distance=seq(500-100,0,-100))})

### Peak at the first 2 elements of the list above
LargeListOfSmallRangedData[c(1,2)]

### Try to consolidate using stack(). Here is the error message
bigRangedData <- stack(LargeListOfSmallRangedData, indName='space')

Error in rep.int(names(x), lapply(x, length)) :
  unimplemented type 'NULL' in 'rep2'

### machine and OS information
sessionInfo()

R version 2.13.0 Under development (unstable) (2010-12-02 r53747)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] BSgenome.Mmusculus.UCSC.mm9_1.3.17 BSgenome_1.19.2
[3] GenomicRanges_1.3.7                Biostrings_2.19.2
[5] IRanges_1.9.17

loaded via a namespace (and not attached):
[1] Biobase_2.11.7







On Wed, Jan 5, 2011 at 5:11 PM, Michael Lawrence
<lawrence.michael at gene.com> wrote:
> That's the correct basic usage, but how about an error message or a little
> more context?
>
> On Wed, Jan 5, 2011 at 2:08 PM, Ivan Gregoretti <ivangreg at gmail.com> wrote:
>>
>> I tried to use it to the best of my understanding:
>>
>> stack(LargeListOfSmallRangedData, indName='space')
>>
>> I think that the failure is due to misuse from my part rather than a bug.
>>
>> Ivan
>>
>>
>>
>>
>> On Wed, Jan 5, 2011 at 4:51 PM, Michael Lawrence
>> <lawrence.michael at gene.com> wrote:
>> > Well it would be good to see what you tried. I think there are some
>> > critical
>> > bug fixes to stack in devel, but not release, so I would try with devel.
>> >
>> > Michael
>> >
>> > On Wed, Jan 5, 2011 at 1:13 PM, Ivan Gregoretti <ivangreg at gmail.com>
>> > wrote:
>> >>
>> >> Hi Michael,
>> >>
>> >> Actually, I tried consolidating the list with stack() but I failed.
>> >> Perhaps there is no need to change anything but only show how the
>> >> consolidation is done with stack().
>> >>
>> >> Would you mind showing it for the record?
>> >>
>> >> Thank you,
>> >>
>> >> Ivan
>> >>
>> >>
>> >>
>> >>
>> >> On Wed, Jan 5, 2011 at 4:05 PM, Michael Lawrence
>> >> <lawrence.michael at gene.com> wrote:
>> >> >
>> >> >
>> >> > On Wed, Jan 5, 2011 at 12:45 PM, Ivan Gregoretti <ivangreg at gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> It works. Thanks, Martin.
>> >> >>
>> >> >> It would be nice to have a pointer to this functionality in the
>> >> >> documentation. For instance, when I do ?RangedData, I can see a
>> >> >> RangedData constructor and coercion options. However,
>> >> >> ?RangedDataList
>> >> >> reports its constructor but no coercion.
>> >> >>
>> >> >
>> >> > It's not a coercion in the strict sense. The rbind method is
>> >> > documented
>> >> > for
>> >> > RangedData. Also, RangedDataList has a stack method for rbind'ing
>> >> > them
>> >> > and
>> >> > adding a factor column indicating the source of each record. The
>> >> > "unlist"
>> >> > method on RangedDataList is a bit strange: it does a do.call(c, list)
>> >> > instead of do.call(rbind, list). I'm thinking about changing that.
>> >> >
>> >> > Michael
>> >> >
>> >> >>
>> >> >> Again, thank you.
>> >> >>
>> >> >> Ivan
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> On Wed, Jan 5, 2011 at 3:23 PM, Martin Morgan <mtmorgan at fhcrc.org>
>> >> >> wrote:
>> >> >> > On 01/05/2011 12:12 PM, Ivan Gregoretti wrote:
>> >> >> >> Hello BioC listers,
>> >> >> >>
>> >> >> >> Is there a function that will take a list of RangedData instances
>> >> >> >> and
>> >> >> >> consolidate them into a large RangedData instance?
>> >> >> >
>> >> >> > do.call(rbind, LargeListOfSmallRangedData)
>> >> >> >
>> >> >> > ?
>> >> >> > Martin
>> >> >> >>
>> >> >> >> I'm looking for this:
>> >> >> >>
>> >> >> >> bigRangedData <- someFunction( LargeListOfSmallRangedData )
>> >> >> >>
>> >> >> >> 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
>> >> >> >
>> >> >>
>> >> >> _______________________________________________
>> >> >> Bioc-sig-sequencing mailing list
>> >> >> Bioc-sig-sequencing at r-project.org
>> >> >> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
>> >> >
>> >> >
>> >
>> >
>
>



More information about the Bioc-sig-sequencing mailing list