limmaFit error when comparing TCGA RNA-Seq data
1
0
Entering edit mode
9 weeks ago

I am trying to compare TCGA RNA-Seq data between platinum-sensitive and platinum-resistant samples.

I reference the workflow posted here: https://cran.r-project.org/web/packages/easybio/vignettes/example_limma.html

I have gotten so far:

query_ov = GDCquery(project = "TCGA-OV", 
                data.category = "Transcriptome Profiling",
                experimental.strategy = "RNA-Seq",
                access = "open",
                sample.type = c("Primary Tumor", "Solid Tissue Normal"))
data = GDCprepare(query = query_ov, summarizedExperiment = TRUE)
lt = prepare_tcga(data)    
pfi_tcga = read_excel("2010-09-11380C-Table_S1.2.xlsx") #this is to retrieve the clinical data from TCGA, and to label the samples as platinum-resistant/sensitive
lt$all$sampleInfo = left_join(lt$all$sampleInfo, pfi_tcga, by = c("patient" = "BCRPATIENTBARCODE"))
lt$all$sampleInfo = lt$all$sampleInfo|>
  filter(PlatinumStatus == "Resistant" | PlatinumStatus == "Sensitive")

lt$all$exprCount = lt$all$exprCount[,lt$all$sampleInfo$barcode]

rownames(lt$all$sampleInfo) = lt$all$sampleInfo$barcode

x = dgeList(lt$all$exprCount, lt$all$sampleInfo, lt$all$featuesInfo)
x = dprocess_dgeList(x, "PlatinumStatus", 10)
efit = limmaFit(x, "PlatinumStatus")
x$samples$PlatinumStatus = relevel(as.factor(x$samples$PlatinumStatus), ref= "Sensitive")

When I try to limmaFit, I get the following error:

Error in limma::makeContrasts() : 
  argument "levels" is missing, with no default

Does anyone know what is the error referring to? I am not using any makeContrasts, and the error still shows up even though I have established levels in PlatinumStatus

R TCGA LIMMA • 1.5k views
ADD COMMENT
1
Entering edit mode

Seriously, an ordinary limma-voom analysis between two groups is as little of 5 lines of code. Please read the limma user guide which covers this. These wrapper packages are blackboxes, you do not know (unless inspecting source code) if they're applying the current best practices as by the limma authors.

ADD REPLY
0
Entering edit mode

Thanks for the advice. Am still new to RNA seq and R programming in general, and will just do the analysis by myself.

ADD REPLY
2
Entering edit mode
21 days ago
Kevin Blighe ★ 90k

The error originates from within the limmaFit() function in the easybio package (not your code directly). There's a bug in its source code on line ~10: makeContrasts <- limma::makeContrasts().

This line calls limma::makeContrasts() due to the empty (), which requires a levels argument (with no default) and immediately fails. It should instead assign the function reference: makeContrasts <- limma::makeContrasts (no ()).

Quick Fixes

  1. Edit the package locally (if installed from source or you can reinstall):

    • Locate the file limma.R in your easybio installation (e.g., ~/R/x86_64-pc-linux-gnu-library/4.x/easybio/R/limma.R).
    • Remove the () from that line.
    • Restart R and reload the package.
  2. Work around by manual limma steps (recommended; follows the vignette logic but skips the buggy function):

    # Ensure PlatinumStatus is factor with desired levels *before* processing
    x$samples$PlatinumStatus <- relevel(as.factor(x$samples$PlatinumStatus), ref = "Sensitive")
    
    # Redo dprocess_dgeList if needed (it may rely on the factor)
    x <- dprocess_dgeList(x, "PlatinumStatus", 10)
    
    # Manual fit (replaces limmaFit)
    design <- model.matrix(~ 0 + x$samples$PlatinumStatus)
    colnames(design) <- gsub(".*\\]\\]", "", colnames(design))  # Clean names if needed
    
    v <- limma::voom(x, design, plot = TRUE)
    vfit <- limma::lmFit(v, design)
    
    # Contrasts: Resistant vs. Sensitive (adjust names to match colnames(design))
    cm <- limma::makeContrasts(Resistant_vs_Sensitive = Resistant - Sensitive, levels = design)  # Use actual colnames(design)
    vfit <- limma::contrasts.fit(vfit, contrasts = cm)
    efit <- limma::eBayes(vfit)
    limma::plotSA(efit, main = "Mean-variance trend")
    
    # Now use efit as before
    topTable(efit, coef = "Resistant_vs_Sensitive", number = Inf)
    

This should resolve it. If the package updates fix the bug, reinstall from CRAN. Report it to the maintainers via GitHub (search "easybio R package GitHub") for a permanent patch.

Kevin

ADD COMMENT

Login before adding your answer.

Traffic: 3254 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