Skip to contents
library(MiscMetabar)
library(formattable)
data(data_fungi)
data(data_fungi_sp_known)

Export phyloseq object

You can export a phyloseq object to csv (and txt for phylogenetic tree) files in a folder. It is possible to export each table into one file or to merge all slot (except phytree) in one file (args one_file = TRUE). Finally, if rdata is set to TRUE, a rdata file containing the phyloseq object is also writed.

write_pq(data_fungi, path = "fungi_phyloseq")
write_pq(data_fungi, path = "fungi_phyloseq", one_file = TRUE)
write_pq(data_fungi, path = "fungi_phyloseq", rdata = TRUE)

Finally, you can use the function save_pq() to write the phyloseq object in all 3 versions (one table for each slot, a file merging each slot and an Rdata file).

save_pq(data_fungi)

Import

To import a Rdata file, just use load() base function. In order to import phyloseq object from a folder create using write_pq() or save_pq(), please use the function read_pq().

d <- read_pq(path = "fungi_phyloseq")

Tracking sequences, clusters and samples

In bioinformatic pipeline, we often need to track the number of samples, sequences and clusters across step in the pipeline. MiscMetabar propose two utilities to achieve this goal : track_wkflow() and a version to compute value per samples : track_wkflow_samples(). The function track_wkflow() can deal with (i) fastq and fastg.gz files, dada-class object, derep-class object, matrix of samples x clusters (e.g. otu_table) and phyloseq-class object.

track_wkflow(list(data_fungi, data_fungi_sp_known))
#>   nb_sequences nb_clusters nb_samples
#> 1      1839124        1420        185
#> 2      1106581         651        185

Session information

sessionInfo()
#> R version 4.3.3 (2024-02-29)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Debian GNU/Linux 11 (bullseye)
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.13.so;  LAPACK version 3.9.0
#> 
#> locale:
#>  [1] LC_CTYPE=fr_FR.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=fr_FR.UTF-8        LC_COLLATE=fr_FR.UTF-8    
#>  [5] LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=fr_FR.UTF-8   
#>  [7] LC_PAPER=fr_FR.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: Europe/Paris
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] formattable_0.2.1 MiscMetabar_0.9.1 purrr_1.0.2       dplyr_1.1.4      
#> [5] dada2_1.30.0      Rcpp_1.0.12       ggplot2_3.5.0     phyloseq_1.46.0  
#> 
#> loaded via a namespace (and not attached):
#>   [1] bitops_1.0-7                pbapply_1.7-2              
#>   [3] deldir_2.0-4                permute_0.9-7              
#>   [5] rlang_1.1.3                 magrittr_2.0.3             
#>   [7] ade4_1.7-22                 matrixStats_1.3.0          
#>   [9] compiler_4.3.3              mgcv_1.9-1                 
#>  [11] png_0.1-8                   systemfonts_1.0.6          
#>  [13] vctrs_0.6.5                 reshape2_1.4.4             
#>  [15] stringr_1.5.1               pkgconfig_2.0.3            
#>  [17] crayon_1.5.2                fastmap_1.1.1              
#>  [19] XVector_0.42.0              utf8_1.2.4                 
#>  [21] Rsamtools_2.18.0            rmarkdown_2.26             
#>  [23] ragg_1.3.0                  xfun_0.43                  
#>  [25] zlibbioc_1.48.2             cachem_1.0.8               
#>  [27] GenomeInfoDb_1.38.8         jsonlite_1.8.8             
#>  [29] biomformat_1.30.0           rhdf5filters_1.14.1        
#>  [31] DelayedArray_0.28.0         Rhdf5lib_1.24.2            
#>  [33] BiocParallel_1.36.0         jpeg_0.1-10                
#>  [35] parallel_4.3.3              cluster_2.1.6              
#>  [37] R6_2.5.1                    bslib_0.7.0                
#>  [39] stringi_1.8.3               RColorBrewer_1.1-3         
#>  [41] GenomicRanges_1.54.1        jquerylib_0.1.4            
#>  [43] SummarizedExperiment_1.32.0 iterators_1.0.14           
#>  [45] knitr_1.46                  IRanges_2.36.0             
#>  [47] Matrix_1.6-5                splines_4.3.3              
#>  [49] igraph_2.0.3                tidyselect_1.2.1           
#>  [51] rstudioapi_0.16.0           abind_1.4-5                
#>  [53] yaml_2.3.8                  vegan_2.6-4                
#>  [55] codetools_0.2-19            hwriter_1.3.2.1            
#>  [57] lattice_0.22-6              tibble_3.2.1               
#>  [59] plyr_1.8.9                  Biobase_2.62.0             
#>  [61] withr_3.0.0                 ShortRead_1.60.0           
#>  [63] evaluate_0.23               desc_1.4.3                 
#>  [65] survival_3.5-8              RcppParallel_5.1.7         
#>  [67] Biostrings_2.70.3           pillar_1.9.0               
#>  [69] MatrixGenerics_1.14.0       foreach_1.5.2              
#>  [71] stats4_4.3.3                generics_0.1.3             
#>  [73] RCurl_1.98-1.14             S4Vectors_0.40.2           
#>  [75] munsell_0.5.1               scales_1.3.0               
#>  [77] glue_1.7.0                  tools_4.3.3                
#>  [79] interp_1.1-6                data.table_1.15.4          
#>  [81] GenomicAlignments_1.38.2    fs_1.6.3                   
#>  [83] rhdf5_2.46.1                grid_4.3.3                 
#>  [85] ape_5.8                     latticeExtra_0.6-30        
#>  [87] colorspace_2.1-0            nlme_3.1-164               
#>  [89] GenomeInfoDbData_1.2.11     cli_3.6.2                  
#>  [91] textshaping_0.3.7           fansi_1.0.6                
#>  [93] S4Arrays_1.2.1              gtable_0.3.4               
#>  [95] sass_0.4.9                  digest_0.6.35              
#>  [97] BiocGenerics_0.48.1         SparseArray_1.2.4          
#>  [99] htmlwidgets_1.6.4           memoise_2.0.1              
#> [101] htmltools_0.5.8.1           pkgdown_2.0.7              
#> [103] multtest_2.58.0             lifecycle_1.0.4            
#> [105] MASS_7.3-60.0.1