Search
Question: edgeR/DGEList add assays to a DGEList like in SummarizedExperiment
0
gravatar for aljoscha.leusmann
7 months ago by
aljoscha.leusmann0 wrote:

Hi,

I would like to add a matrix to the DGEList in a similar way assays can be added to a SummarizedExperiment.

I calculated the log transformed cpm values of a DGEList and I would like to store them in the DGEList, so subsetting this object would subset the log transformed cpm values too.

here is my code:

query <- GDCquery(project = "TCGA-BLCA",  # project-code for Bladder Cancer
                  data.category = "Transcriptome Profiling",  # catogry for RNA-Seq Data
                  data.type = "Gene Expression Quantification", # raw reads, or , aligned data
                  workflow.type = "HTSeq - Counts") # FPKM / HTSeq-Count / etc.

GDCdownload(query, # name of the filtered dataset assigned above
            method = "api", # needs to be set in order to download from the api
            files.per.chunk = 10, # this should minimise prob. of corruption
            directory = "GDCdata") # save files to a seperate directory

TCGA_BLCA <- GDCprepare(query,
                        summarizedExperiment = TRUE) # Downloads also clinical data

TCGA_BLCA_DGEList <- DGEList(TCGA_BLCA)

keep <- rowSums(cpm(TCGA_BLCA_DGEList)>0.25) >= 217

TCGA_BLCA_DGEList <- TCGA_BLCA_DGEList[keep, , 
                                       keep.lib.sizes = FALSE]

TCGA_BLCA_DGEList <- calcNormFactors(TCGA_BLCA_DGEList, 
                                     method = 'upperquartile', 
                                     p = 0.75)

TCGA_BLCA_DGEList = estimateCommonDisp(TCGA_BLCA_DGEList, 
                                       verbose = TRUE)

TCGA_BLCA_DGEList$log2ps_counts <- cpm(TCGA_BLCA_DGEList$pseudo.counts,
                                             log = TRUE)

When I now subset my DGEList, log2cpm won´t be subsetted

tumor_tcga <- TCGA_BLCA_DGEList[, 
                                TCGA_BLCA_DGEList$samples$shortLetterCode == "TP"]
> dim(tumor_tcga$samples)
[1] 414 234
> dim(tumor_tcga$log2cpm)
[1] 18476   433
> dim(tumor_tcga$counts)
[1] 18476   414

I hope you can help me with that.

Thanks and best regards, Aljosch Leusmann  

 

ADD COMMENTlink modified 7 months ago • written 7 months ago by aljoscha.leusmann0
1
gravatar for Aaron Lun
7 months ago by
Aaron Lun21k
Cambridge, United Kingdom
Aaron Lun21k wrote:

I don't believe this is possible. The DGEList class was not designed to be a general-purpose container, and it will not recognize arbitrary user-specified fields. Perhaps there is an argument for adding direct support for SummarizedExperiment input to various edgeR functions - and indeed, this would clearly benefit a few of my packages (e.g., csaw, diffHic, cydar) - but this would involve a fair amount of work.

ADD COMMENTlink modified 7 months ago • written 7 months ago by Aaron Lun21k
0
gravatar for aljoscha.leusmann
7 months ago by
aljoscha.leusmann0 wrote:

Thanks for the fast response.

Is it possible to transform a DGEList into a SummarizedExperiment?

 

ADD COMMENTlink written 7 months ago by aljoscha.leusmann0

Please respond to existing answers with "Add comment", unless you are answering your own question.

If you want to do it, you'll have to do it manually, e.g.,

se <- SummarizedExperiment(list(counts=d$counts), colData=d$samples)

Of course, this doesn't account for all the other fields that may be of interest, e.g., aveLogCPM, dispersions.

ADD REPLYlink modified 7 months ago • written 7 months ago by Aaron Lun21k

Okay, than I´ll have to do it manually, thank you for the hints!

ADD REPLYlink written 7 months ago by aljoscha.leusmann0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 362 users visited in the last hour