edgeR/DGEList add assays to a DGEList like in SummarizedExperiment
2
0
Entering edit mode
@aljoschaleusmann-15597
Last seen 6.6 years ago

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  

 

edgeR summarizedexperiment dgelist • 2.4k views
ADD COMMENT
1
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 5 hours ago
The city by the bay

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 COMMENT
0
Entering edit mode
@aljoschaleusmann-15597
Last seen 6.6 years ago

Thanks for the fast response.

Is it possible to transform a DGEList into a SummarizedExperiment?

 

ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 519 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6