Skip to contents
library(MiscMetabar)
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.4.2 (2024-10-31)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Debian GNU/Linux 12 (bookworm)
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.11.0 
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.11.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] MiscMetabar_0.11.0 purrr_1.0.2        dplyr_1.1.4        dada2_1.32.0      
#> [5] Rcpp_1.0.13-1      ggplot2_3.5.1      phyloseq_1.48.0   
#> 
#> loaded via a namespace (and not attached):
#>   [1] bitops_1.0-9                pbapply_1.7-2              
#>   [3] deldir_2.0-4                permute_0.9-7              
#>   [5] rlang_1.1.4                 magrittr_2.0.3             
#>   [7] ade4_1.7-22                 matrixStats_1.4.1          
#>   [9] compiler_4.4.2              mgcv_1.9-1                 
#>  [11] png_0.1-8                   systemfonts_1.1.0          
#>  [13] vctrs_0.6.5                 reshape2_1.4.4             
#>  [15] stringr_1.5.1               pwalign_1.0.0              
#>  [17] pkgconfig_2.0.3             crayon_1.5.3               
#>  [19] fastmap_1.2.0               XVector_0.44.0             
#>  [21] utf8_1.2.4                  Rsamtools_2.20.0           
#>  [23] rmarkdown_2.29              UCSC.utils_1.0.0           
#>  [25] ragg_1.3.3                  xfun_0.49                  
#>  [27] zlibbioc_1.50.0             cachem_1.1.0               
#>  [29] GenomeInfoDb_1.40.1         jsonlite_1.8.9             
#>  [31] biomformat_1.32.0           rhdf5filters_1.16.0        
#>  [33] DelayedArray_0.30.1         Rhdf5lib_1.26.0            
#>  [35] BiocParallel_1.38.0         jpeg_0.1-10                
#>  [37] parallel_4.4.2              cluster_2.1.6              
#>  [39] R6_2.5.1                    RColorBrewer_1.1-3         
#>  [41] bslib_0.8.0                 stringi_1.8.4              
#>  [43] GenomicRanges_1.56.2        jquerylib_0.1.4            
#>  [45] SummarizedExperiment_1.34.0 iterators_1.0.14           
#>  [47] knitr_1.49                  IRanges_2.38.1             
#>  [49] Matrix_1.7-1                splines_4.4.2              
#>  [51] igraph_2.1.2                tidyselect_1.2.1           
#>  [53] rstudioapi_0.17.1           abind_1.4-8                
#>  [55] yaml_2.3.10                 vegan_2.6-8                
#>  [57] codetools_0.2-20            hwriter_1.3.2.1            
#>  [59] lattice_0.22-6              tibble_3.2.1               
#>  [61] plyr_1.8.9                  Biobase_2.64.0             
#>  [63] withr_3.0.2                 ShortRead_1.62.0           
#>  [65] evaluate_1.0.1              desc_1.4.3                 
#>  [67] survival_3.7-0              RcppParallel_5.1.9         
#>  [69] Biostrings_2.72.1           pillar_1.9.0               
#>  [71] MatrixGenerics_1.16.0       foreach_1.5.2              
#>  [73] stats4_4.4.2                generics_0.1.3             
#>  [75] S4Vectors_0.42.1            munsell_0.5.1              
#>  [77] scales_1.3.0                glue_1.8.0                 
#>  [79] tools_4.4.2                 interp_1.1-6               
#>  [81] data.table_1.16.4           GenomicAlignments_1.40.0   
#>  [83] fs_1.6.5                    rhdf5_2.48.0               
#>  [85] grid_4.4.2                  ape_5.8                    
#>  [87] latticeExtra_0.6-30         colorspace_2.1-1           
#>  [89] nlme_3.1-166                GenomeInfoDbData_1.2.12    
#>  [91] cli_3.6.3                   textshaping_0.4.1          
#>  [93] fansi_1.0.6                 S4Arrays_1.4.1             
#>  [95] gtable_0.3.6                sass_0.4.9                 
#>  [97] digest_0.6.37               BiocGenerics_0.50.0        
#>  [99] SparseArray_1.4.8           htmlwidgets_1.6.4          
#> [101] htmltools_0.5.8.1           pkgdown_2.1.1              
#> [103] multtest_2.60.0             lifecycle_1.0.4            
#> [105] httr_1.4.7                  MASS_7.3-61