need to clarify RangedData documentation?
1
0
Entering edit mode
@michael-dondrup-3849
Last seen 9.7 years ago
Hi, I am trying to create a RangedData object and then add a DataFrame of extra annotation columns in a second step.
Annotation Annotation • 592 views
ADD COMMENT
0
Entering edit mode
@steve-lianoglou-2771
Last seen 14 months ago
United States
Hi, On Wed, Nov 3, 2010 at 10:35 AM, Michael Dondrup <michael.dondrup at="" uni.no=""> wrote: > Hi, > > I am trying to create a RangedData object and then add a DataFrame of extra annotation columns in a second step. > From the documentation of the method columnMetadata, I was assuming this function was meant to do this, > but it doesn't seem to work. The documentation says: > > "columnMetadata(x): Get the DataFrame of metadata along the value columns, i.e., where each column in x is represented by a row in the metadata. Note that calling elementMetadata(x)returns the metadata on each space in x. > columnMetadata(x) <- value: Set the DataFrame of metadata for the columns." > > After reading this more closely, I wasn't able to figure what this really means, and I didn't get it to work at all. > Can someone clarify what this is for? I think you want to be using elementMetadata() or its alias values(). I guess columnMetadata is supposed to hold information about the columns(?) but I'm not quite sure ... I've never used it before. For example: R> rd = RangedData(ranges=IRanges(start=1:2, width=1), space=1, somedata=1:2) R> values(rd) <- DataFrame(something.else=100:101) R> rd RangedData with 2 rows and 1 value column across 1 space space ranges | something.else <character> <iranges> | <integer> 1 1 [1, 1] | 100 2 1 [2, 2] | 101 Hope that helps, -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology ?| Memorial Sloan-Kettering Cancer Center ?| Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact
ADD COMMENT
0
Entering edit mode
Hi Steve, yes values() was what I was looking for, thank you, I am getting confused about the IRanges objects ever now and then. As for elementMetadata(), maybe it was changed for the latest bioc release but it doesn't do the same thing: >rd = RangedData(ranges=IRanges(start=1:2, width=1), space=1) > values(rd) = DataFrame(somedata=1:2) > rd RangedData with 2 rows and 1 value column across 1 space space ranges | somedata <character> <iranges> | <integer> 1 1 [1, 1] | 1 2 1 [2, 2] | 2 > elementMetadata(rd) = DataFrame(somedata=1:2) Error in .local(x, ..., value) : the number of rows in elementMetadata 'value' (if non-NULL) must match the length of 'x' Now I even more think the documentation needs some clarifications. I would like to help, if I understood what was really going on. Cheers Michael On Nov 3, 2010, at 4:38 PM, Steve Lianoglou wrote: > Hi, > > On Wed, Nov 3, 2010 at 10:35 AM, Michael Dondrup <michael.dondrup at="" uni.no=""> wrote: >> Hi, >> >> I am trying to create a RangedData object and then add a DataFrame of extra annotation columns in a second step. >> From the documentation of the method columnMetadata, I was assuming this function was meant to do this, >> but it doesn't seem to work. The documentation says: >> >> "columnMetadata(x): Get the DataFrame of metadata along the value columns, i.e., where each column in x is represented by a row in the metadata. Note that calling elementMetadata(x)returns the metadata on each space in x. >> columnMetadata(x) <- value: Set the DataFrame of metadata for the columns." >> >> After reading this more closely, I wasn't able to figure what this really means, and I didn't get it to work at all. >> Can someone clarify what this is for? > > I think you want to be using elementMetadata() or its alias values(). > > I guess columnMetadata is supposed to hold information about the > columns(?) but I'm not quite sure ... I've never used it before. > > For example: > > R> rd = RangedData(ranges=IRanges(start=1:2, width=1), space=1, somedata=1:2) > R> values(rd) <- DataFrame(something.else=100:101) > R> rd > RangedData with 2 rows and 1 value column across 1 space > space ranges | something.else > <character> <iranges> | <integer> > 1 1 [1, 1] | 100 > 2 1 [2, 2] | 101 > > Hope that helps, > -steve > > -- > Steve Lianoglou > Graduate Student: Computational Systems Biology > | Memorial Sloan-Kettering Cancer Center > | Weill Medical College of Cornell University > Contact Info: http://cbio.mskcc.org/~lianos/contact
ADD REPLY
0
Entering edit mode
On Wed, Nov 3, 2010 at 11:50 AM, Michael Dondrup <michael.dondrup at="" uni.no=""> wrote: > Hi Steve, > > yes ?values() was what I was looking for, thank you, I am getting confused about the IRanges objects ever now and then. > As for elementMetadata(), maybe it was changed for the latest bioc release but it doesn't do the same thing: > >>rd = RangedData(ranges=IRanges(start=1:2, width=1), space=1) >> values(rd) = DataFrame(somedata=1:2) >> rd > RangedData with 2 rows and 1 value column across 1 space > ? ? ? ?space ? ?ranges | ?somedata > ?<character> <iranges> | <integer> > 1 ? ? ? ? ? 1 ? ?[1, 1] | ? ? ? ? 1 > 2 ? ? ? ? ? 1 ? ?[2, 2] | ? ? ? ? 2 >> elementMetadata(rd) = DataFrame(somedata=1:2) > Error in .local(x, ..., value) : > ?the number of rows in elementMetadata 'value' (if non-NULL) must match the length of 'x' > > Now I even more think the documentation needs some clarifications. I would like to help, if I understood what > was really going on. I see ... strange. So I know that values is an alias for elementMetadata for IRanges and GRanges, since they inherit this from sequence: R> getMethod('values', 'Sequence') Method Definition: function (x, ...) elementMetadata(x, ...) <environment: namespace:iranges=""> Signatures: x target "Sequence" defined "Sequence" I thought this was universal throughout the classes defined in IRanges ... I'm not quite sure why values() becomes "the primary" function for RangedData (ie. it returns the RangedData at values object) ... maybe this slot was added to RangedData afterwards and didn't bring the baggage of the originally named elementMetadata slot/method with it? I'll let the core devs field that Q. -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology ?| Memorial Sloan-Kettering Cancer Center ?| Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact
ADD REPLY
0
Entering edit mode
On Wed, Nov 3, 2010 at 9:07 AM, Steve Lianoglou < mailinglist.honeypot@gmail.com> wrote: > On Wed, Nov 3, 2010 at 11:50 AM, Michael Dondrup <michael.dondrup@uni.no> > wrote: > > Hi Steve, > > > > yes values() was what I was looking for, thank you, I am getting > confused about the IRanges objects ever now and then. > > As for elementMetadata(), maybe it was changed for the latest bioc > release but it doesn't do the same thing: > > > >>rd = RangedData(ranges=IRanges(start=1:2, width=1), space=1) > >> values(rd) = DataFrame(somedata=1:2) > >> rd > > RangedData with 2 rows and 1 value column across 1 space > > space ranges | somedata > > <character> <iranges> | <integer> > > 1 1 [1, 1] | 1 > > 2 1 [2, 2] | 2 > >> elementMetadata(rd) = DataFrame(somedata=1:2) > > Error in .local(x, ..., value) : > > the number of rows in elementMetadata 'value' (if non-NULL) must match > the length of 'x' > > > > Now I even more think the documentation needs some clarifications. I > would like to help, if I understood what > > was really going on. > > I see ... strange. So I know that values is an alias for > elementMetadata for IRanges and GRanges, since they inherit this from > sequence: > > R> getMethod('values', 'Sequence') > Method Definition: > > function (x, ...) > elementMetadata(x, ...) > <environment: namespace:iranges=""> > > Signatures: > x > target "Sequence" > defined "Sequence" > > I thought this was universal throughout the classes defined in IRanges > ... I'm not quite sure why values() becomes "the primary" function for > RangedData (ie. it returns the RangedData@values object) ... maybe > this slot was added to RangedData afterwards and didn't bring the > baggage of the originally named elementMetadata slot/method with it? > > I'll let the core devs field that Q. > > RangedData used values() before it became an alias for elementMetadata(). A RangedData is a sequence along the chromosomes (spaces), so the elementMetadata of a RangedData is chromosome-level metadata. Thus, RangedData gives you metadata on your ranges (the values, although I don't really think of this as metadata.. that's more the GRanges mindset), the chromsomes, and the variables in values(). Make sense? Michael -steve > > -- > Steve Lianoglou > Graduate Student: Computational Systems Biology > | Memorial Sloan-Kettering Cancer Center > | Weill Medical College of Cornell University > Contact Info: http://cbio.mskcc.org/~lianos/contact<http: cbio.mskc="" c.org="" %7elianos="" contact=""> > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > [[alternative HTML version deleted]]
ADD REPLY

Login before adding your answer.

Traffic: 549 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6