0

I installed a R package named "GeoTcgaData", libraried it and wanted to use the function "fpkmToTPM_matrix" to convert my data. But this message came out:

Error in fpkmToTpm_matrix(J_Rseq) : could not find function "fpkmToTpm_matrix"

Wondering where the problem is.

(The version of the package is 1.1.0)

NPC
  • 21
  • 3

1 Answers1

1

You may need to install some of the dependencies separately via Bioconductor. If you install the packages using:

install.packages("BiocManager")
BiocManager::install(pkgs = c('DESeq2', 'impute', 'edgeR', 'cqn', 'topconfects', 'ChAMP', 'clusterProfiler',
'org.Hs.eg.db', 'minfi', 'IlluminaHumanMethylation450kanno.ilmn12.hg19',
'dearseq', 'NOISeq'))

You can then (hopefully) install and run GeoTcgaData as expected:

install.packages("GeoTcgaData", type = "source")
library(GeoTcgaData)
#>  =============================================================
#>  Hello, friend! welcome to use GeoTcgaData!                   
#>  -------------------------------------------------------------
#>  Version:1.1.0
#>  =============================================================

lung_squ_count2 <- matrix(c(0.11,0.22,0.43,0.14,0.875,0.66,0.77,0.18,0.29),ncol=3)
rownames(lung_squ_count2) <- c("DISC1","TCOF1","SPPL3")
colnames(lung_squ_count2) <- c("sample1","sample2","sample3")
lung_squ_count2
#>       sample1 sample2 sample3
#> DISC1    0.11   0.140    0.77
#> TCOF1    0.22   0.875    0.18
#> SPPL3    0.43   0.660    0.29

result <- fpkmToTpm_matrix(lung_squ_count2)
result
#>        sample1   sample2  sample3
#> DISC1 144736.8  83582.09 620967.7
#> TCOF1 289473.7 522388.06 145161.3
#> SPPL3 565789.5 394029.85 233871.0

sessionInfo()
#> R version 4.1.3 (2022-03-10)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Big Sur/Monterey 10.16
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
#> 
#> locale:
#> [1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] GeoTcgaData_1.1.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.9        plyr_1.8.7        pillar_1.8.0      compiler_4.1.3   
#>  [5] highr_0.9         R.methodsS3_1.8.2 R.utils_2.12.0    tools_4.1.3      
#>  [9] digest_0.6.29     evaluate_0.15     lifecycle_1.0.1   tibble_3.1.8     
#> [13] R.cache_0.16.0    pkgconfig_2.0.3   rlang_1.0.4       reprex_2.0.1     
#> [17] DBI_1.1.3         cli_3.3.0         rstudioapi_0.13   yaml_2.3.5       
#> [21] xfun_0.31         fastmap_1.1.0     withr_2.5.0       styler_1.7.0     
#> [25] stringr_1.4.0     dplyr_1.0.9       knitr_1.39        generics_0.1.3   
#> [29] fs_1.5.2          vctrs_0.4.1       tidyselect_1.1.2  glue_1.6.2       
#> [33] R6_2.5.1          fansi_1.0.3       rmarkdown_2.14    purrr_0.3.4      
#> [37] magrittr_2.0.3    htmltools_0.5.3   splines_4.1.3     assertthat_0.2.1 
#> [41] utf8_1.2.2        nor1mix_1.3-0     stringi_1.7.8     cqn_1.38.0       
#> [45] R.oo_1.25.0

Created on 2022-08-08 by the reprex package (v2.0.1)


If installing the dependencies separately doesn't solve the issue, another potential alternative is to define the function yourself. From the source code:

fpkmToTpm <- function(fpkm)
{
    exp(log(fpkm) - log(sum(fpkm)) + log(1e6))
}

fpkmToTpm_matrix <- function(fpkm_matrix) {
    fpkm_matrix_new <- apply(fpkm_matrix, 2, fpkmToTpm)  
}

fpkmToTpm_matrix(J_Rseq)

Does this work?

Also, please edit your question to include the output of the command sessionInfo()

jared_mamrot
  • 22,354
  • 4
  • 21
  • 46