Tximport error message - colnames
1
0
Entering edit mode
@ae57026f
Last seen 2 days ago
Australia

RStudio, R and all packages downloaded and installed this week

Following along with DIYtranscriptomics https://diytranscriptomics.com/scripts (lesson 1) which is superb (highly recommended), but I'm having issues. I know the key part of the error is "attempt to set 'colnames' on an object with less than two dimensions" but I don't know what that's referring to or what I can do to fix it. I have run this programme previously with success (~9 months ago) but I'm trying with my own samples now, and it's not working.

# copy the abundance files to the working directory and rename so that each sample has a unique name
> Txi_gene.D.labrax <- tximport(path.D.labrax.all,
+                      type = "kallisto", 
+                      tx2gene = "Tx", 
+                      txOut = FALSE, 
+                      countsFromAbundance = "lengthScaledTPM",
+                      ignoreTxVersion = TRUE)
Note: importing `abundance.h5` is typically faster than `abundance.tsv`
reading in files with read_tsv
1 2 3 4 5 6 7 8 9 10 11 12 
Error in `colnames<-`(`*tmp*`, value = c("tx", "gene")) : 
  attempt to set 'colnames' on an object with less than two dimensions

I have checked the file paths:

> all(file.exists(path.D.labrax.all)) 
[1] TRUE

And that all seems fine, and everything up until this point has worked. Googling the error hasn't helped though. Having looked at ?colnames the issue seems to be what is the *tmp* variable is and where it comes from. The tximport reads in the files OK I think (12 files, and it counts them in, so I'm guessing that's OK)

colnames(x, do.NULL=TRUE, prefix="col")

colnames(x) <- value

Arguments

x A matrix-like object.

do.NULL, prefix See ?base::rownames for a description of these arguments.

value Either NULL or a character vector equal of length equal to the appropriate dimension.

Session info included below.


> sessionInfo( )
R version 4.0.4 (2021-02-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252    LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.1252    

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

other attached packages:
 [1] tximport_1.18.0        forcats_0.5.1          stringr_1.4.0          dplyr_1.0.6            purrr_0.3.4            readr_1.4.0            tibble_3.1.2          
 [8] ggplot2_3.3.3          tidyverse_1.3.1        tidyr_1.1.3            biomaRt_2.46.3         clusterProfiler_3.18.1 cowplot_1.1.1          beepr_1.3             
[15] BiocManager_1.30.15    Biobase_2.50.0         BiocGenerics_0.36.1    magrittr_2.0.1        

loaded via a namespace (and not attached):
  [1] fgsea_1.16.0         colorspace_2.0-1     ellipsis_0.3.2       qvalue_2.22.0        fs_1.5.0             rstudioapi_0.13      farver_2.1.0        
  [8] audio_0.1-7          graphlayouts_0.7.1   ggrepel_0.9.1        bit64_4.0.5          AnnotationDbi_1.52.0 fansi_0.5.0          scatterpie_0.1.6    
 [15] lubridate_1.7.10     xml2_1.3.2           splines_4.0.4        cachem_1.0.5         GOSemSim_2.16.1      knitr_1.33           polyclip_1.10-0     
 [22] jsonlite_1.7.2       broom_0.7.6          GO.db_3.12.1         dbplyr_2.1.1         ggforce_0.3.3        compiler_4.0.4       httr_1.4.2          
 [29] rvcheck_0.1.8        backports_1.2.1      assertthat_0.2.1     Matrix_1.3-3         fastmap_1.1.0        cli_2.5.0            tweenr_1.0.2        
 [36] htmltools_0.5.1.1    prettyunits_1.1.1    tools_4.0.4          igraph_1.2.6         gtable_0.3.0         glue_1.4.2           reshape2_1.4.4      
 [43] DO.db_2.9            rappdirs_0.3.3       tinytex_0.32         fastmatch_1.1-0      Rcpp_1.0.6           enrichplot_1.10.2    cellranger_1.1.0    
 [50] rhdf5filters_1.2.1   vctrs_0.3.8          ggraph_2.0.5         xfun_0.23            rvest_1.0.0          lifecycle_1.0.0      XML_3.99-0.6        
 [57] DOSE_3.16.0          MASS_7.3-54          scales_1.1.1         tidygraph_1.2.0      hms_1.1.0            rhdf5_2.34.0         RColorBrewer_1.1-2  
 [64] yaml_2.2.1           curl_4.3.1           memoise_2.0.0        gridExtra_2.3        downloader_0.4       stringi_1.5.3        RSQLite_2.2.7       
 [71] S4Vectors_0.28.1     BiocParallel_1.24.1  rlang_0.4.11         pkgconfig_2.0.3      evaluate_0.14        lattice_0.20-44      Rhdf5lib_1.12.1     
 [78] shadowtext_0.0.8     bit_4.0.4            tidyselect_1.1.1     plyr_1.8.6           R6_2.5.0             IRanges_2.24.1       generics_0.1.0      
 [85] DBI_1.1.1            pillar_1.6.1         haven_2.4.1          withr_2.4.2          modelr_0.1.8         crayon_1.4.1         utf8_1.2.1          
 [92] BiocFileCache_1.14.0 rmarkdown_2.8        viridis_0.6.1        progress_1.2.2       grid_4.0.4           readxl_1.3.1         data.table_1.14.0   
 [99] blob_1.2.1           reprex_2.0.0         digest_0.6.27        openssl_1.4.4        stats4_4.0.4         munsell_0.5.0        viridisLite_0.4.0   
[106] askpass_1.1
tximport • 91 views
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 6 hours ago
United States

See the help file for tximport:

?tximport

And then read about what you should provide to the argument tx2gene.

You can also read the tximport vignette for more help.

ADD COMMENT
0
Entering edit mode

?tximport - I've tried this, but the colnames error isn't present. I don't seem to be able to find anything.

The tx2gene = Tx to tx2gene = "Tx" was just to highlight the code itself is outdated, not an issue I'm currently facing. I'll remove it from the question.

having looked at ?colnames the issue seems to be what is the *tmp* bit is and where it comes from. The tximport reads in the files OK I think (12 files, and it counts them in, so I'm guessing that's OK)

colnames(x, do.NULL=TRUE, prefix="col")

colnames(x) <- value

Arguments

x A matrix-like object.

do.NULL, prefix See ?base::rownames for a description of these arguments.

value Either NULL or a character vector equal of length equal to the appropriate dimension.

ADD REPLY
0
Entering edit mode

The tx2gene argument of tximport() is supposed to be a data.frame according to the man page and as shown in the vignette. This is what I'm trying to get at.

Are you providing a data.frame to that argument? I'm not convinced you supplying a two column data.frame that has transcript IDs in the first column and gene IDs in the second column. See the vignette for examples.

ADD REPLY

Login before adding your answer.

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