dist_mass_dataset
mass_dataset class
sample or variable
the distance measure to be used. This must be one of "euclidean", "maximum", "manhattan", "canberra", "binary" or "minkowski". Any unambiguous substring can be given.
logical value indicating whether the diagonal of the distance matrix should be printed by print.dist.
logical value indicating whether the upper triangle of the distance matrix should be printed by print.dist.
The power of the Minkowski distance.
dist returns an object of class "dist".
library(massdataset)
library(magrittr)
data("expression_data")
data("sample_info")
data("sample_info_note")
data("variable_info")
data("variable_info_note")
object =
create_mass_dataset(
expression_data = expression_data,
sample_info = sample_info,
variable_info = variable_info,
sample_info_note = sample_info_note,
variable_info_note = variable_info_note
)
object
#> --------------------
#> massdataset version: 1.0.18
#> --------------------
#> 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-09-19 16:36:55
x =
object %>%
log(2) %>%
scale()
variable_distance <-
dist_mass_dataset(x = x, margin = "variable")
head(as.matrix(variable_distance)[, 1:5])
#> M136T55_2_POS M79T35_POS M307T548_POS M183T224_POS M349T47_POS
#> M136T55_2_POS 0.000000 2.595449 4.743621 4.708308 1.940902
#> M79T35_POS 2.595449 0.000000 4.219588 3.106812 1.620770
#> M307T548_POS 4.743621 4.219588 0.000000 2.568996 3.986112
#> M183T224_POS 4.708308 3.106812 2.568996 0.000000 3.082528
#> M349T47_POS 1.940902 1.620770 3.986112 3.082528 0.000000
#> M182T828_POS 3.010099 2.743352 3.139591 2.175595 2.895630
sample_distance <-
dist_mass_dataset(x = x, margin = "sample")
head(as.matrix(sample_distance)[, 1:5])
#> Blank_3 Blank_4 QC_1 QC_2 PS4P1
#> Blank_3 0.00000 46.24363 46.22024 54.26607 47.31000
#> Blank_4 46.24363 0.00000 53.89434 60.88273 55.83349
#> QC_1 46.22024 53.89434 0.00000 40.44652 39.65971
#> QC_2 54.26607 60.88273 40.44652 0.00000 46.26019
#> PS4P1 47.31000 55.83349 39.65971 46.26019 0.00000
#> PS4P2 47.06702 55.78646 38.33452 49.76545 39.14705