[Bioc-devel] SummarizedExperiment: duplication of metadata, when modifying colData

Felix Ernst felix.ernst at ulb.ac.be
Tue Dec 12 10:05:52 CET 2017


Hi all,

 

I got a bit of weird behaviour with SummarizedExperiments in Bioc 3.6 and
3.7. I suppose it is a bug, but I might be wrong, since the accession to the
SummarizedExperiment object is not really straight forward. Any suggestions?

library(GenomicRanges)

library(SummarizedExperiment)

 

nrows <- 200; ncols <- 6

counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows)

colnames(counts) <- LETTERS[1:6]

rownames(counts) <- 1:nrows

counts2 <- counts-floor(counts)

rowRanges <- GRanges(rep(c("chr1", "chr2"), c(50, 150)),

                     IRanges(floor(runif(200, 1e5, 1e6)), width=100),

                     strand=sample(c("+", "-"), 200, TRUE),

                     feature_id=sprintf("ID%03d", 1:200)) 

colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3),

                     row.names=LETTERS[1:6])

 

se <- SummarizedExperiment(assays=list(counts=counts),

                           rowRanges=rowRanges,

                           colData=colData)

colData(se)$xyz <- rep("",ncol(se))

metadata(se) <- list("meep" = "meep")

 

str(metadata(se))

colData(se[, 1])$xyz <- "abc"

str(metadata(se))

The first metadata() returns a list, length of 1, with the correct data. The
second call returns a list of two, with a duplicated entries and every
further colData modification (and replacing data) duplicates the entries in
the metadata further.

> str(metadata(se))

List of 1

$ meep: chr "meep"

> colData(se[, 1])$xyz <- "abc"

> str(metadata(se))

List of 2

$ meep: chr "meep"

$ meep: chr "meep"
> colData(se[, 2])$xyz <- "abc"

> str(metadata(se))

List of 4

$ meep: chr "meep"

$ meep: chr "meep"

$ meep: chr "meep"

$ meep: chr "meep"

> colData(se[, 2])$xyz <- "abc"

> str(metadata(se))

List of 8

$ meep: chr "meep"

$ meep: chr "meep"

$ meep: chr "meep"

$ meep: chr "meep"

$ meep: chr "meep"

$ meep: chr "meep"

$ meep: chr "meep"

$ meep: chr "meep"

Thanks for any advice and suggestions.

Felix



---



Felix Ernst, PhD

Université Libre de Bruxelles

RNA MOLECULAR BIOLOGY

BIOPARK Charleroi Brussels-South CAMPUS

Rue Profs Jeener & Brachet, 12

B-6041 Charleroi - Gosselies

BELGIUM

+32(2)650 9774 (office phone)

 <mailto:felix.ernst at ulb.ac.be> felix.ernst at ulb.ac.be

 






	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list