MultiAssayExperiment: Error in dimnames(x) <- dn : length of 'dimnames' [2] not equal to array extent
1
1
Entering edit mode
@mariozanfardino-15232
Last seen 4.3 years ago
Naples (Italy)

I have the following MAE:​

> data
A MultiAssayExperiment object of 4 listed
experiments with user-defined names and respective classes.
Containing an ExperimentList class object of length 4:
[1] BRCA_miRNASeqGene-20160128: SummarizedExperiment with 500 rows and 65 columns
[2] BRCA_RNASeqGene-20160128: SummarizedExperiment with 500 rows and 187 columns
[3] exp_1: SummarizedExperiment with 500 rows and 65 columns
[4] exp_2: SummarizedExperiment with 500 rows and 65 columns 

When i run wideformat function on data i have the following error (but only when patients are > 107):

 > wideFormat(data[1:20, 1:108, ])
 Error in dimnames(x) <- dn : length of 'dimnames' [2] not equal to array extent

Any suggestions?

multiassayexperiment wide format TCGA • 7.0k views
ADD COMMENT
0
Entering edit mode

This sounds like a corner case that we'll need to have either the object itself or reproducible code that generates it, in order to debug. Would appreciate that very much if you can provide it.

ADD REPLY
1
Entering edit mode
#CODE TO GENERATE MY DATA

library("curatedTCGAData")

library("SummarizedExperiment")

library("MultiAssayExperiment")



## Downolad MAE BRCA data

BRCA_TCGA <- curatedTCGAData(diseaseCode = "BRCA", 

                             assays      = c("miRNASeqGene", "RNASeqGene"), 

                             dry.run = FALSE)


## Create a test data frame for experiment at timepoint_1

nrows <- 500

ncols <- 200

l1_timepoint_1 <- matrix(runif(nrows * ncols, 1, 1e3), nrows)

rownames(l1_timepoint_1) <- paste("f", 1:500,sep="")


## Create a test data frame for experiment at timepoint_2

nrows <- 500

ncols <- 200

l1_timepoint_2 <- matrix(runif(nrows * ncols, 1, 1e3), nrows)

rownames(l1_timepoint_2) <- paste("f", 1:500,sep="")


## Create a test data frame for experiment at timepoint_1

nrows <- 500

ncols <- 200

l2_timepoint_1 <- matrix(runif(nrows * ncols, 1, 1e3), nrows)

rownames(l2_timepoint_1) <- paste("f", 1:500,sep="")


## Create a test data frame for experiment at timepoint_2

nrows <- 500

ncols <- 200

l2_timepoint_2 <- matrix(runif(nrows * ncols, 1, 1e3), nrows)

rownames(l2_timepoint_2) <- paste("f", 1:500,sep="")


## Create colData

M <- rep_len("M", 100)

F <- rep_len("F", 100)

sex <- c(M, F)

patientID_list <-BRCA_TCGA@ExperimentList$`BRCA_miRNASeqGene-20160128`@colData@rownames[1:200]

colData <- DataFrame(sex=sex, row.names=patientID_list)


## Create summarizedExperiment 

exp_1 <- SummarizedExperiment(assays=list(timepoint_1=l1_timepoint_1, timepoint_2=l1_timepoint_2), colData=colData)


## Create summarizedExperiment 

exp_2 <- SummarizedExperiment(assays=list(timepoint_1=l2_timepoint_1, timepoint_2=l2_timepoint_2), colData=colData)


## Add new summarized experiment to exisiting MultiAssayExperiment

data <- c(BRCA_TCGA, exp_1 = exp_1, exp_2 = exp_2)
ADD REPLY
0
Entering edit mode

Actually, can I request that you first do your subsetting alone in a step, before trying wideFormat()? I see that you are attempting to select columns (1:108) that do not exist in some of your experiments (three have only 65 columns), which is likely the cause of your error.

ADD REPLY
0
Entering edit mode

With only subsetting no error is generated! but with 1:107 wideformat runs! (and also this  do not exist in some of my experiments) !

ADD REPLY
1
Entering edit mode
Sorry I made a wrong statement before: the second position of square bracket subsetting acts on the rows of `colData` of your MultiAssayExperiment, not directly on the experimental data matrix columns. But I'm afraid I won't be able to figure out what's going on for you without a reproducible example.
ADD REPLY
0
Entering edit mode
#CODE TO GENERATE MY DATA

library("curatedTCGAData")

library("SummarizedExperiment")

library("MultiAssayExperiment")



## Downolad MAE BRCA data

BRCA_TCGA <- curatedTCGAData(diseaseCode = "BRCA", 

                             assays      = c("miRNASeqGene", "RNASeqGene"), 

                             dry.run = FALSE)


## Create a test data frame for experiment at timepoint_1

nrows <- 500

ncols <- 200

l1_timepoint_1 <- matrix(runif(nrows * ncols, 1, 1e3), nrows)

rownames(l1_timepoint_1) <- paste("f", 1:500,sep="")


## Create a test data frame for experiment at timepoint_2

nrows <- 500

ncols <- 200

l1_timepoint_2 <- matrix(runif(nrows * ncols, 1, 1e3), nrows)

rownames(l1_timepoint_2) <- paste("f", 1:500,sep="")


## Create a test data frame for experiment at timepoint_1

nrows <- 500

ncols <- 200

l2_timepoint_1 <- matrix(runif(nrows * ncols, 1, 1e3), nrows)

rownames(l2_timepoint_1) <- paste("f", 1:500,sep="")


## Create a test data frame for experiment at timepoint_2

nrows <- 500

ncols <- 200

l2_timepoint_2 <- matrix(runif(nrows * ncols, 1, 1e3), nrows)

rownames(l2_timepoint_2) <- paste("f", 1:500,sep="")


## Create colData

M <- rep_len("M", 100)

F <- rep_len("F", 100)

sex <- c(M, F)

patientID_list <-BRCA_TCGA@ExperimentList$`BRCA_miRNASeqGene-20160128`@colData@rownames[1:200]

colData <- DataFrame(sex=sex, row.names=patientID_list)


## Create summarizedExperiment 

exp_1 <- SummarizedExperiment(assays=list(timepoint_1=l1_timepoint_1, timepoint_2=l1_timepoint_2), colData=colData)


## Create summarizedExperiment 

exp_2 <- SummarizedExperiment(assays=list(timepoint_1=l2_timepoint_1, timepoint_2=l2_timepoint_2), colData=colData)


## Add new summarized experiment to exisiting MultiAssayExperiment

data <- c(BRCA_TCGA, exp_1 = exp_1, exp_2 = exp_2)
ADD REPLY
2
Entering edit mode
@marcel-ramos-7325
Last seen 2 days ago
United States

Ciao Mario, Thanks for reporting this.

This should be fixed in MultiAssayExperiment version 1.7.21.

Best regards, Marcel

ADD COMMENT
0
Entering edit mode

Good! thank you again Marcel! This version is already available?

ADD REPLY
2
Entering edit mode

You can check in devel at http://bioconductor.org/packages/devel/bioc/html/MultiAssayExperiment.html (no it isn't), but if you want it immediately you can install directly from GitHub:

BiocManager::install("waldronlab/MultiAssayExperiment")

It should propagate to devel by tomorrow.

ADD REPLY
0
Entering edit mode

Hi Marcel, 

the 1.7.21 version returns with the same error:

Error in dimnames(x) <- dn : length of 'dimnames' [2] not equal to array extent
ADD REPLY
0
Entering edit mode

Hi Mario, Are you sure you have the latest version? It just re-ran it and it works for me.

> sessionInfo()

R version 3.5.1 Patched (2018-09-23 r75356)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] curatedTCGAData_1.3.5       MultiAssayExperiment_1.7.21 SummarizedExperiment_1.11.6 DelayedArray_0.7.42        
 [5] BiocParallel_1.15.12        matrixStats_0.54.0          Biobase_2.41.2              GenomicRanges_1.33.14      
 [9] GenomeInfoDb_1.17.1         IRanges_2.15.18             S4Vectors_0.19.19           BiocGenerics_0.27.1        

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.18                  pillar_1.3.0                  later_0.7.5                   compiler_3.5.1               
 [5] BiocManager_1.30.2            XVector_0.21.3                AnnotationHub_2.13.6          bitops_1.0-6                 
 [9] tools_3.5.1                   zlibbioc_1.27.0               digest_0.6.17                 bit_1.1-14                   
[13] tibble_1.4.2                  RSQLite_2.1.1                 memoise_1.1.0                 lattice_0.20-35              
[17] rlang_0.2.2                   pkgconfig_2.0.2               Matrix_1.2-14                 rstudioapi_0.7               
[21] shiny_1.1.0                   DBI_1.0.0                     curl_3.2                      yaml_2.2.0                   
[25] GenomeInfoDbData_1.1.0        httr_1.3.1                    tidyselect_0.2.4              bit64_0.9-7                  
[29] grid_3.5.1                    glue_1.3.0                    R6_2.2.2                      AnnotationDbi_1.43.1         
[33] purrr_0.2.5                   tidyr_0.8.1                   ExperimentHub_1.7.6           magrittr_1.5                 
[37] blob_1.1.1                    promises_1.0.1                htmltools_0.3.6               xtable_1.8-3                 
[41] mime_0.5                      interactiveDisplayBase_1.19.2 httpuv_1.4.5                  RCurl_1.95-4.11              
[45] crayon_1.3.4

```

ADD REPLY
1
Entering edit mode

Now run. After R session restarting. Thank you!

ADD REPLY

Login before adding your answer.

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