Question: Difficulty creating SummarizedExperiment
0
13 months ago by
C Ng0
C Ng0 wrote:

I've been able to create a summarized experiment but I'm having some difficulty subsetting and expressing my data. For example, I have arranged my summarizedexperiment by gene with RNA-seq (seq) and methylation data (methyl) See example code:

seq <- data.frame("GAPDH" = c(1,5,NA, NA), "ACTB" = c(10,15, NA, NA))

methyl <- data.frame("GAPDH" = c(10,20,0,0), "ACTB" = c(0,0,50,100))

A = SummarizedExperiment(assays=list(seq,methyl))

what I'd like to be able to do next is to pull both the seq and methyl data for "GAPDH".

I realize that this is probably simple but I've looked over the subsetting section and am still have some difficulty figuring it out.

summarizedexperiment • 240 views
modified 13 months ago by Aaron Lun23k • written 13 months ago by C Ng0
1
13 months ago by
Aaron Lun23k
Cambridge, United Kingdom
Aaron Lun23k wrote:

Typically in genomics, rows are features while columns are samples. So we would generally expect:

A <- SummarizedExperiment(assays=list(t(seq),t(methyl)))

... such that you can subset with:

subA <- A["GAPDH",]

... and then get the RNA-seq or methylation data with:

assay(subA, 1) # seq
assay(subA, 2) # methyl

You can also name the assays to make it easier for yourself when you're extracting the data, instead of having to remember that the first assay is RNA-seq and the second assay is methylation.