Is this an issue? "Error in (function (x) : attempt to apply non-function" when calling tximeta::summarizeToGene(se) for the first time with some datasets.
1
0
Entering edit mode
kalavattam ▴ 10
@kalavattam-21708
Last seen 17 months ago
United States

Hi,

I observed this error when working with tximeta::summarizeToGene for the first time with some datasets.

> gse <- summarizeToGene(se)
loading existing TxDb created: 2020-04-15 15:05:07
Loading required package: GenomicFeatures
Loading required package: AnnotationDbi

Attaching package: 'AnnotationDbi'

The following object is masked from 'package:dplyr':

    select

obtaining transcript-to-gene mapping from TxDb
generating gene ranges
Error in (function (x)  : attempt to apply non-function
summarizing abundance
summarizing counts
summarizing length

Not sure if this is an issue—the gse object seems to be O.K.

Thanks, Kris

Code

#  Load libraries (if commented out, then done above)
load_pack <- c("airway", "tximeta", "DESeq2", "tidyverse")
lapply(load_pack, library, character.only = TRUE)

#  Set working directory
setwd("/Users/ala1zp/Dropbox/professional/_experiments_projects/2020_0324_0400_work_notes_H3K9me3_RNAseq/code_log/tmp_current/RNAseq_work_041020")

#  Load the sample table as a data frame
st <- read.csv("sample_table_041320.csv", row.names = 1, stringsAsFactors = FALSE)

#  Locate and download relevant annotation data, perform transcript-level quantifications
se <- tximeta(st)  # Remember, tximeta "wants" two of the columns to be "files", "names"

#  Examine the structure of the se generated fr/t/Mcaf2 data
dim(se)  #> [1] 140948 4
head(rownames(se))

#  Summarize the transcript-level quantifications to the gene level
gse <- summarizeToGene(se)

#  Examine the structure, features of the gse generated fr/t/Mcaf2 data
dim(gse)  #> [1] 54331 4
head(rownames(gse))

Terminal

> #  Load libraries (if commented out, then done above)
> load_pack <- c("airway", "tximeta", "DESeq2", "tidyverse")
> lapply(load_pack, library, character.only = TRUE)
Loading required package: SummarizedExperiment
Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: ‘BiocGenerics’

The following objects are masked from ‘package:parallel’:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB,
    parRapply, parSapply, parSapplyLB

The following objects are masked from ‘package:stats’:

    IQR, mad, sd, var, xtabs

The following objects are masked from ‘package:base’:

    anyDuplicated, append, as.data.frame, basename, cbind, colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min

Loading required package: S4Vectors

Attaching package: ‘S4Vectors’

The following object is masked from ‘package:base’:

    expand.grid

Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with 'browseVignettes()'. To cite Bioconductor, see 'citation("Biobase")', and for
    packages 'citation("pkgname")'.

Loading required package: DelayedArray
Loading required package: matrixStats

Attaching package: ‘matrixStats’

The following objects are masked from ‘package:Biobase’:

    anyMissing, rowMedians

Loading required package: BiocParallel

Attaching package: ‘DelayedArray’

The following objects are masked from ‘package:matrixStats’:

    colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges

The following objects are masked from ‘package:base’:

    aperm, apply, rowsum

── Attaching packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
✓ ggplot2 3.3.0     ✓ purrr   0.3.3
✓ tibble  3.0.0     ✓ dplyr   0.8.5
✓ tidyr   1.0.2     ✓ stringr 1.4.0
✓ readr   1.3.1     ✓ forcats 0.5.0
── Conflicts ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
x dplyr::collapse()   masks IRanges::collapse()
x dplyr::combine()    masks Biobase::combine(), BiocGenerics::combine()
x dplyr::count()      masks matrixStats::count()
x dplyr::desc()       masks IRanges::desc()
x tidyr::expand()     masks S4Vectors::expand()
x dplyr::filter()     masks stats::filter()
x dplyr::first()      masks S4Vectors::first()
x dplyr::lag()        masks stats::lag()
x ggplot2::Position() masks BiocGenerics::Position(), base::Position()
x purrr::reduce()     masks GenomicRanges::reduce(), IRanges::reduce()
x dplyr::rename()     masks S4Vectors::rename()
x purrr::simplify()   masks DelayedArray::simplify()
x dplyr::slice()      masks IRanges::slice()

## * + * + (to decrease the character count for Bioconductor, I cut [[1]], [[2]], and [[3]]) + * + * ##

[[4]]
 [1] "forcats"              "stringr"              "dplyr"                "purrr"                "readr"                "tidyr"               
 [7] "tibble"               "ggplot2"              "tidyverse"            "DESeq2"               "tximeta"              "airway"              
[13] "SummarizedExperiment" "DelayedArray"         "BiocParallel"         "matrixStats"          "Biobase"              "GenomicRanges"       
[19] "GenomeInfoDb"         "IRanges"              "S4Vectors"            "BiocGenerics"         "parallel"             "stats4"              
[25] "stats"                "graphics"             "grDevices"            "utils"                "datasets"             "methods"             
[31] "base"                

> #  Set working directory
> setwd("/Users/ala1zp/Dropbox/professional/_experiments_projects/2020_0324_0400_work_notes_H3K9me3_RNAseq/code_log/tmp_current/RNAseq_work_041020")
> #  Load the sample table as a data frame
> st <- read.csv("sample_table_041320.csv", row.names = 1, stringsAsFactors = FALSE)
> #  Locate and download relevant annotation data, perform transcript-level quantifications
> se <- tximeta(st)  # Remember, tximeta "wants" two of the columns to be "files", "names"
importing quantifications
reading in files with read_tsv
1 2 3 4 

tximeta needs a BiocFileCache directory to access and save TxDb objects.
Do you wish to use the default directory: '/Users/ala1zp/Library/Caches/BiocFileCache'?
If not, a temporary directory that is specific to this R session will be used.

You can always change this directory later by running: setTximetaBFC()
Or enter [0] to exit and set this directory manually now. 

1: Yes (use default)
2: No (use temp)

Selection: 1
/Users/ala1zp/Library/Caches/BiocFileCache
  does not exist, create directory? (yes/no): yes
found matching transcriptome:
[ GENCODE - Mus musculus - release M24 ]
building TxDb with 'GenomicFeatures' package
Import genomic features from the file as a GRanges object ... trying URL 'ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_mouse/release_M24/gencode.vM24.annotation.gtf.gz'
Content type 'unknown' length 28499422 bytes (27.2 MB)
==================================================
OK
Prepare the 'metadata' data frame ... OK
Make the TxDb object ... OK
generating transcript ranges
fetching genome info for GENCODE
Warning message:
In .get_cds_IDX(mcols0$type, mcols0$phase) :
  The "phase" metadata column contains non-NA values for features of type stop_codon. This information was ignored.
> #  Examine the structure of the se generated fr/t/Mcaf2 data
> dim(se)  #> [1] 140948 4
[1] 140948      4
> head(rownames(se))
[1] "ENSMUST00000193812.1" "ENSMUST00000082908.1" "ENSMUST00000162897.1" "ENSMUST00000159265.1" "ENSMUST00000070533.4" "ENSMUST00000192857.1"
> #  Summarize the transcript-level quantifications to the gene level
> gse <- summarizeToGene(se)
loading existing TxDb created: 2020-04-15 15:05:07
Loading required package: GenomicFeatures
Loading required package: AnnotationDbi

Attaching package: 'AnnotationDbi'

The following object is masked from 'package:dplyr':

    select

obtaining transcript-to-gene mapping from TxDb
generating gene ranges
Error in (function (x)  : attempt to apply non-function
summarizing abundance
summarizing counts
summarizing length
> #  Examine the structure, features of the gse generated fr/t/Mcaf2 data
> dim(gse)  #> [1] 54331 4
[1] 54331     4

traceback()

> traceback()
1: (function (x) 
   x$.self$finalize())(<environment>)

sessionInfo()

> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Catalina 10.15.2

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Users/ala1zp/anaconda3/envs/r3-6-2_test_env/lib/libopenblasp-r0.3.7.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
 [1] GenomicFeatures_1.38.0      AnnotationDbi_1.48.0        forcats_0.5.0               stringr_1.4.0               dplyr_0.8.5                
 [6] purrr_0.3.3                 readr_1.3.1                 tidyr_1.0.2                 tibble_3.0.0                ggplot2_3.3.0              
[11] tidyverse_1.2.1             DESeq2_1.26.0               tximeta_1.4.3               airway_1.6.0                SummarizedExperiment_1.16.0
[16] DelayedArray_0.12.0         BiocParallel_1.20.0         matrixStats_0.56.0          Biobase_2.46.0              GenomicRanges_1.38.0       
[21] GenomeInfoDb_1.22.0         IRanges_2.20.0              S4Vectors_0.24.0            BiocGenerics_0.32.0        

loaded via a namespace (and not attached):
  [1] colorspace_1.4-1         ellipsis_0.3.0           htmlTable_1.13.3         XVector_0.26.0           base64enc_0.1-3         
  [6] rstudioapi_0.11          bit64_0.9-7              fansi_0.4.1              lubridate_1.7.8          xml2_1.3.1              
 [11] splines_3.6.3            tximport_1.14.0          geneplotter_1.64.0       knitr_1.28               Formula_1.2-3           
 [16] jsonlite_1.6.1           Rsamtools_2.2.0          broom_0.5.5              annotate_1.64.0          cluster_2.1.0           
 [21] dbplyr_1.4.2             png_0.1-7                compiler_3.6.3           httr_1.4.1               backports_1.1.6         
 [26] assertthat_0.2.1         Matrix_1.2-18            lazyeval_0.2.2           cli_2.0.2                acepack_1.4.1           
 [31] htmltools_0.4.0          prettyunits_1.1.1        tools_3.6.3              gtable_0.3.0             glue_1.4.0              
 [36] GenomeInfoDbData_1.2.2   rappdirs_0.3.1           Rcpp_1.0.4.6             cellranger_1.1.0         vctrs_0.2.4             
 [41] Biostrings_2.54.0        nlme_3.1-147             rtracklayer_1.46.0       xfun_0.13                rvest_0.3.5             
 [46] lifecycle_0.2.0          ensembldb_2.10.0         XML_3.99-0.3             zlibbioc_1.32.0          scales_1.1.0            
 [51] hms_0.5.3                ProtGenerics_1.18.0      AnnotationFilter_1.10.0  RColorBrewer_1.1-2       yaml_2.2.1              
 [56] curl_4.3                 memoise_1.1.0            gridExtra_2.3            biomaRt_2.42.0           rpart_4.1-15            
 [61] latticeExtra_0.6-29      stringi_1.4.6            RSQLite_2.2.0            genefilter_1.68.0        checkmate_2.0.0         
 [66] rlang_0.4.5              pkgconfig_2.0.3          bitops_1.0-6             lattice_0.20-41          GenomicAlignments_1.22.0
 [71] htmlwidgets_1.5.1        bit_1.1-15.2             tidyselect_1.0.0         magrittr_1.5             R6_2.4.1                
 [76] generics_0.0.2           Hmisc_4.4-0              DBI_1.1.0                withr_2.1.2              pillar_1.4.3            
 [81] haven_2.2.0              foreign_0.8-76           survival_3.1-12          RCurl_1.98-1.1           nnet_7.3-13             
 [86] modelr_0.1.6             crayon_1.3.4             BiocFileCache_1.10.0     jpeg_0.1-8.1             progress_1.2.2          
 [91] readxl_1.3.1             locfit_1.5-9.4           grid_3.6.3               data.table_1.12.8        blob_1.2.1              
 [96] digest_0.6.25            xtable_1.8-4             openssl_1.4.1            munsell_0.5.0            askpass_1.1
software error tximeta • 1.7k views
ADD COMMENT
1
Entering edit mode
@mikelove
Last seen 17 hours ago
United States

The final object looks fine to me

I'm not sure where the error is coming from x$.self$finalize(). That may be part of SummarizedExperiment, but I'm not certain.

ADD COMMENT
0
Entering edit mode

Thanks, will keep an eye on it when moving forward.

ADD REPLY

Login before adding your answer.

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