S4Vectors icon indicating copy to clipboard operation
S4Vectors copied to clipboard

A better home for my AnnotatedLogical and AnnotatedMatrix classes?

Open LTLA opened this issue 4 years ago • 0 comments

I have several applications where I have a matrix or a vector and I just want to slap some metadata on them without changing the object. To this end, I have started to create an AnnotatedMatrix subclass that inherits from matrix and Annotated; similarly for AnnotatedLogical, which inherits from logical and Annotated. These objects allow me to store metadata in a more robust way than using the attributes (where they disappear upon subsetting) while retaining the generality of base structures.

Currently these classes are implemented all over the place - AnnotatedMatrix in SingleCellExperiment, where it is used to store metadata associated with dimensionality reduction results; and AnnotatedLogical in scuttle, where it is used to store threshold information after QC filtering. But I imagine that these would be of more general utility than just those packages.

Would S4Vectors be interested in being a better home for these things?

LTLA avatar Feb 14 '21 02:02 LTLA