[Bioc-devel] S4Vectors::DataFrame, S4Vectors::cbind() and non-elementwise metadata

Hervé Pagès hpages at fredhutch.org
Wed Oct 25 17:35:37 CEST 2017


Hi Robert,

The object-wise metadata doesn't follow any convention and is typically
used to keep track of things like the file the object is coming from
(if any), the date/time it was created, by who, the call that was used
to create it, plus any other relevant information about the object.

It's not clear to me how n-ary operations should combine the object-wise
metadata in general, or that it would make sense to try to propagate
this information from all the input objects to the output object.

Note that AFAIK most unary operations on Annotated derivatives (e.g.
shift()) propagate the object-wise metadata, even though it's not
clear that this information will still be relevant for the transformed
object.

Cheers,
H.


On 10/25/2017 07:39 AM, Robert Castelo wrote:
> hi,
>
> i've the following question on how 'S4Vectors::cbind()' works on
> 'DataFrame' objects.
>
> let's say i have the following two toy 'DataFrame' objects, each of them
> including some elementwise and non-elementwise metadata (i hope i'm
> using the right terminology!):
>
> library(S4Vectors)
>
> dtf1 <- DataFrame(col1=1:10)
> mcols(dtf1) <- DataFrame(ElementwiseMeta="This is column1")
> metadata(dtf1) <- list(Meta1="Object storing column1")
>
> dtf2 <- DataFrame(col2=1:10)
> mcols(dtf2) <- DataFrame(ElementwiseMeta="This is column2")
> metadata(dtf2) <- list(Meta2="Object storing column2")
>
> now use 'cbind()' to combine the two 'DataFrame' objects:
>
> dtf <- cbind(dtf1, dtf2)
>
> the elementwise metadata is also combined:
>
> mcols(dtf)
> DataFrame with 2 rows and 1 column
>    ElementwiseMeta
>        <character>
> 1 This is column1
> 2 This is column2
>
> but the non-elementwise metadata is not:
>
> metadata(dtf)
> list()
>
> is there a particular reason why the non-elementwise metadata is not
> also combined?
>
> please find my session information below.
>
> thanks!!!
>
> robert.
> ps: sessionInfo()
> R version 3.4.0 (2017-04-21)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: CentOS Linux 7 (Core)
>
> Matrix products: default
> BLAS: /opt/R/R-3.4.0_BioCdevel/lib64/R/lib/libRblas.so
> LAPACK: /opt/R/R-3.4.0_BioCdevel/lib64/R/lib/libRlapack.so
>
> locale:
>   [1] LC_CTYPE=en_US.UTF8       LC_NUMERIC=C
>   [3] LC_TIME=en_US.UTF8        LC_COLLATE=en_US.UTF8
>   [5] LC_MONETARY=en_US.UTF8    LC_MESSAGES=en_US.UTF8
>   [7] LC_PAPER=en_US.UTF8       LC_NAME=C
>   [9] LC_ADDRESS=C              LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] parallel  stats4    stats     graphics  grDevices utils     datasets
> [8] methods   base
>
> other attached packages:
> [1] S4Vectors_0.15.14   BiocGenerics_0.23.4 colorout_1.1-2
>
> loaded via a namespace (and not attached):
> [1] compiler_3.4.0
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_bioc-2Ddevel&d=DwICAg&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=A-QAZvhpPY0ytgF8msL4_W8jBMlWkyL7yLBW4QwXFqw&s=DgYYXQl-0a3XcBf-IKJUPox3jKkiPCmqVNQTFAq0XdA&e=
>

-- 
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 at fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the Bioc-devel mailing list