I am attempting to do a DEA analysis of matched paired BRCA normal tumour samples using TCGAbiolinks. When I do an analysis of my samples using this formula
dataDEGsMatched <- TCGAanalyze_DEA(mat1 = MatchedTPdataFilt,
                                   mat2 = MatchedNTdataFilt,
                                   Cond1type = "Tumor",
                                   Cond2type = "Normal",
                                   fdr.cut = 0.01,
                                   logFC.cut = 1.5,
                                   method = "glmLRT")
It works and returns a DEG, however, I do not believe it is matched paired. When I add in the line paired = TRUE I get the following error.
> dataDEGsMatched <- TCGAanalyze_DEA(mat1 = MatchedTPdataFilt,
+                                    mat2 = MatchedNTdataFilt,
+                                    Cond1type = "Tumor",
+                                    Cond2type = "Normal",
+                                    pipeline = "edgeR",
+                                    fdr.cut = 0.01,
+                                    logFC.cut = 1.5,
+                                    method = "glmLRT",
+                                    paired = TRUE)
Batch correction skipped since no factors provided
----------------------- DEA -------------------------------
there are Cond1 type Tumor in  113 samples
there are Cond2 type Normal in  113 samples
there are  14477 features as miRNA or genes 
I Need about  0 seconds for this DEA. [Processing 30k elements /s]  
Error in dimnames(x) <- dn : 
  length of 'dimnames' [2] not equal to array extent
I don't really understand what is causing this error. I have tried to ensure the matrices are both in the correct order so the corresponding columns are paired using -
MatchedTPdataFilt <- MatchedTPdataFilt[, order(colnames(MatchedTPdataFilt))]
MatchedNTdataFilt <- MatchedNTdataFilt[, order(colnames(MatchedNTdataFilt))]
But this doesn't fix the problem.
I also attempted to then change the column names for the matrices so the corresponding names match, but this then returned a different error.
colnames(MatchedTPdataFilt) <- (1:113)
colnames(MatchedNTdataFilt) <- (1:113)
> dataDEGsMatched <- TCGAanalyze_DEA(mat1 = sort(AllMatcheddataFilt[,samplesMatchedTP]),
+                                    mat2 = sort(AllMatcheddataFilt[,samplesMatchedNT]),
+                                    Cond1type = "Tumor",
+                                    Cond2type = "Normal",
+                                    pipeline = "edgeR",
+                                    fdr.cut = 0.01,
+                                    logFC.cut = 1.5,
+                                    method = "glmLRT",
+                                    paired = TRUE)
Error in names(x) <- value : 
  'names' attribute [7] must be the same length as the vector [1]
I have also checked that the dimensions for both matrices are the same -
> dim(MatchedNTdataFilt)
[1] 14477   113
> dim(MatchedTPdataFilt)
[1] 14477   113
I have read the manuals and user guides for TCGAbiolinks and haven't managed to shed any light on the issue, I would appreciate any help.
Thank you.
Hello again, can you show how you create the MatchedTPdataFilt and MatchedNTdataFilt objects? I just want to re-create the error on my own system. Is it somewhat a continuation of the issue in your other question ( A: Matched Paired Tumour-Normal DEA of BRCA using data downloaded using TCGAbiolink )?
Hello! Yes it is a continuation from that. I used a workflow for TCGAbiolinks to process the matched data. I have used it before for unmatched normal-tumour samples and it has worked.
Here is what I have used -
Okay, I have managed to reproduce the exact same error.... now let me see if I can solve it.
Posted an answer below