For one mass_dataset class object, we can get the summary information of it.

Data preparation

library(massdataset)
library(tidyverse)

data("expression_data")
data("sample_info")
data("variable_info")

object =
  create_mass_dataset(
    expression_data = expression_data,
    sample_info = sample_info,
    variable_info = variable_info
  )

Summary information

Just type this object in the R session.

object
#> -------------------- 
#> massdataset version: 1.0.12 
#> -------------------- 
#> 1.expression_data:[ 1000 x 8 data.frame]
#> 2.sample_info:[ 8 x 4 data.frame]
#> 3.variable_info:[ 1000 x 3 data.frame]
#> 4.sample_info_note:[ 4 x 2 data.frame]
#> 5.variable_info_note:[ 3 x 2 data.frame]
#> 6.ms2_data:[ 0 variables x 0 MS2 spectra]
#> -------------------- 
#> Processing information (extract_process_info())
#> 1 processings in total
#> create_mass_dataset ---------- 
#>       Package         Function.used                Time
#> 1 massdataset create_mass_dataset() 2022-08-07 19:36:22

We can just basic information of the object.

Use functions to get the summary information

##dim of object
dim(object)
#> variables   samples 
#>      1000         8
##row number
nrow(object)
#> variables 
#>      1000
##column number
ncol(object)
#> samples 
#>       8
##sample number
get_sample_number(object)
#> [1] 8
#variable number
get_variable_number(object)
#> [1] 1000
##sample id
colnames(object)
#> [1] "Blank_3" "Blank_4" "QC_1"    "QC_2"    "PS4P1"   "PS4P2"   "PS4P3"  
#> [8] "PS4P4"
##variable id
rownames(object) %>% 
  head()
#> [1] "M136T55_2_POS" "M79T35_POS"    "M307T548_POS"  "M183T224_POS" 
#> [5] "M349T47_POS"   "M182T828_POS"
##sample id
get_sample_id(object)
#> [1] "Blank_3" "Blank_4" "QC_1"    "QC_2"    "PS4P1"   "PS4P2"   "PS4P3"  
#> [8] "PS4P4"
##variable id
get_variable_id(object) %>% 
  head()
#> [1] "M136T55_2_POS" "M79T35_POS"    "M307T548_POS"  "M183T224_POS" 
#> [5] "M349T47_POS"   "M182T828_POS"

Explore

###show mz rt plot
object %>%
  show_mz_rt_plot()

###should log
object %>%
  `+`(1) %>% 
  log(10) %>%
  show_mz_rt_plot()

###use hex
object %>%
  show_mz_rt_plot(hex = TRUE)

Missing values

##show missing values plot
show_missing_values(object)


show_missing_values(object[1:10,], cell_color = "white")


###only show subject samples
object %>%
  activate_mass_dataset(what = "sample_info") %>%
  filter(class == "Subject") %>%
  show_missing_values()


###only show QC samples
object %>%
  activate_mass_dataset(what = "expression_data") %>%
  dplyr::select(contains("QC")) %>%
  show_missing_values()


###only show features with mz < 100
object %>%
  activate_mass_dataset(what = "variable_info") %>%
  dplyr::filter(mz < 100) %>%
  show_missing_values(cell_color = "white",
                      show_row_names = TRUE,
                      row_names_side = "left")


##show missing values plot
show_sample_missing_values(object)

show_sample_missing_values(object, color_by = "class")

show_sample_missing_values(object, color_by = "class", order_by = "na")

show_sample_missing_values(object, color_by = "class", order_by = "na",
                           desc = TRUE)


##show missing values plot
show_variable_missing_values(object)

show_variable_missing_values(object, color_by = "mz")


show_variable_missing_values(object, color_by = "rt") +
  scale_color_gradient(low = "skyblue", high = "red") 


show_variable_missing_values(object, color_by = "mz", 
                             order_by = "na")

show_variable_missing_values(object, color_by = "mz", 
                             order_by = "na",
                           desc = TRUE, percentage = TRUE)

Session information

sessionInfo()
#> R version 4.2.1 (2022-06-23)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Big Sur ... 10.16
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.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] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#>  [1] masstools_1.0.2    plyr_1.8.7         forcats_0.5.1.9000 stringr_1.4.0     
#>  [5] dplyr_1.0.9        purrr_0.3.4        readr_2.1.2        tidyr_1.2.0       
#>  [9] tibble_3.1.7       ggplot2_3.3.6      tidyverse_1.3.1    magrittr_2.0.3    
#> [13] tinytools_0.9.1    massdataset_1.0.12
#> 
#> loaded via a namespace (and not attached):
#>   [1] readxl_1.4.0                backports_1.4.1            
#>   [3] circlize_0.4.15             systemfonts_1.0.4          
#>   [5] lazyeval_0.2.2              BiocParallel_1.30.3        
#>   [7] GenomeInfoDb_1.32.2         Rdisop_1.56.0              
#>   [9] digest_0.6.29               foreach_1.5.2              
#>  [11] yulab.utils_0.0.5           htmltools_0.5.2            
#>  [13] magick_2.7.3                fansi_1.0.3                
#>  [15] memoise_2.0.1               cluster_2.1.3              
#>  [17] doParallel_1.0.17           tzdb_0.3.0                 
#>  [19] openxlsx_4.2.5              limma_3.52.2               
#>  [21] ComplexHeatmap_2.12.0       modelr_0.1.8               
#>  [23] matrixStats_0.62.0          pkgdown_2.0.5              
#>  [25] colorspace_2.0-3            rvest_1.0.2                
#>  [27] textshaping_0.3.6           haven_2.5.0                
#>  [29] xfun_0.31                   hexbin_1.28.2              
#>  [31] crayon_1.5.1                RCurl_1.98-1.7             
#>  [33] jsonlite_1.8.0              impute_1.70.0              
#>  [35] iterators_1.0.14            glue_1.6.2                 
#>  [37] gtable_0.3.0                zlibbioc_1.42.0            
#>  [39] XVector_0.36.0              GetoptLong_1.0.5           
#>  [41] DelayedArray_0.22.0         shape_1.4.6                
#>  [43] BiocGenerics_0.42.0         scales_1.2.0               
#>  [45] vsn_3.64.0                  DBI_1.1.3                  
#>  [47] Rcpp_1.0.8.3                mzR_2.30.0                 
#>  [49] viridisLite_0.4.0           clue_0.3-61                
#>  [51] gridGraphics_0.5-1          preprocessCore_1.58.0      
#>  [53] stats4_4.2.1                MsCoreUtils_1.8.0          
#>  [55] htmlwidgets_1.5.4           httr_1.4.3                 
#>  [57] RColorBrewer_1.1-3          ellipsis_0.3.2             
#>  [59] farver_2.1.1                pkgconfig_2.0.3            
#>  [61] XML_3.99-0.10               sass_0.4.1                 
#>  [63] dbplyr_2.2.1                utf8_1.2.2                 
#>  [65] labeling_0.4.2              ggplotify_0.1.0            
#>  [67] tidyselect_1.1.2            rlang_1.0.3                
#>  [69] munsell_0.5.0               cellranger_1.1.0           
#>  [71] tools_4.2.1                 cachem_1.0.6               
#>  [73] cli_3.3.0                   generics_0.1.3             
#>  [75] broom_1.0.0                 evaluate_0.15              
#>  [77] fastmap_1.1.0               mzID_1.34.0                
#>  [79] yaml_2.3.5                  ragg_1.2.2                 
#>  [81] knitr_1.39                  fs_1.5.2                   
#>  [83] zip_2.2.0                   ncdf4_1.19                 
#>  [85] pbapply_1.5-0               xml2_1.3.3                 
#>  [87] compiler_4.2.1              rstudioapi_0.13            
#>  [89] plotly_4.10.0               png_0.1-7                  
#>  [91] affyio_1.66.0               reprex_2.0.1               
#>  [93] bslib_0.3.1                 stringi_1.7.6              
#>  [95] highr_0.9                   desc_1.4.1                 
#>  [97] MSnbase_2.22.0              lattice_0.20-45            
#>  [99] ProtGenerics_1.28.0         Matrix_1.4-1               
#> [101] ggsci_2.9                   vctrs_0.4.1                
#> [103] pillar_1.7.0                lifecycle_1.0.1            
#> [105] BiocManager_1.30.18         jquerylib_0.1.4            
#> [107] MALDIquant_1.21             GlobalOptions_0.1.2        
#> [109] data.table_1.14.2           bitops_1.0-7               
#> [111] GenomicRanges_1.48.0        R6_2.5.1                   
#> [113] pcaMethods_1.88.0           affy_1.74.0                
#> [115] IRanges_2.30.0              codetools_0.2-18           
#> [117] MASS_7.3-57                 assertthat_0.2.1           
#> [119] SummarizedExperiment_1.26.1 rprojroot_2.0.3            
#> [121] rjson_0.2.21                withr_2.5.0                
#> [123] S4Vectors_0.34.0            GenomeInfoDbData_1.2.8     
#> [125] parallel_4.2.1              hms_1.1.1                  
#> [127] grid_4.2.1                  rmarkdown_2.14             
#> [129] MatrixGenerics_1.8.1        Cairo_1.6-0                
#> [131] Biobase_2.56.0              lubridate_1.8.0