devtools::load_all()
MTandem_obj <- MetaboTandem$new() MTandem_obj$load_metadata(metadata_file = 'test_data/metadata.csv') MTandem_obj$metadata MTandem_obj$get_groups() MTandem_obj$load_spectra_data('test_data/minimal_test/') MTandem_obj$centroid_check()
# test_peak_picking(MTandem_obj$data, # mz_range = c(300, 310), # rt_range = c(440, 550), # p_width = c(20, 100), # snt = 3, # noise = 1e6, # cores = 10) MTandem_obj$apply_peak_picking(method = 'cw', ppm = 25, p_width = c(20, 50), snt = 3, noise = 1e6, prefilter = c(1, 100), mz_diff = 0.001, cores = 10) # MTandem_obj$apply_peak_refinement(expand_rt = 2, # expand_mz = 0, # ppm = 10, # min_prop = 0.75) xcms::hasChromPeaks(MTandem_obj$data) xcms::chromPeaks(MTandem_obj$data) %>% tidyr::as_tibble() %>% dplyr::group_by(sample) %>% dplyr::count() %>% cbind(SampleID = xcms::phenoData(MTandem_obj$data)@data$SampleID) %>% dplyr::ungroup() %>% dplyr::select(SampleID, Num_peaks = n)
MTandem_obj$apply_alignment(method = 'pg', group_by = 'treatment', bin_size = 0.25, ppm = 0, min_fraction = 0.9, extra_peaks = 1, smooth = 'loess', span = 1, family = 'gaussian') treatment_colors <- setNames(ggpubr::get_palette('Dark2', length(unique(MTandem_obj$metadata$treatment))), nm = unique(MTandem_obj$metadata$treatment)) col_vector <- treatment_colors[MTandem_obj$metadata$treatment] xcms::plotAdjustedRtime(MTandem_obj$data, col = col_vector, lwd = 1.5, cex = .7) legend('topleft', legend = names(treatment_colors), col = treatment_colors, lty = rep(1, length(treatment_colors)), cex = .8, lwd = rep(2, length(treatment_colors))) MTandem_obj$apply_correspondence(method = 'np', group_by = 'treatment', mzvsrtbal = 10, abs_mz = 0.2, abs_rt = 15, knn = 10)
MTandem_obj$apply_gap_filling(cores = 10) xcms::hasFilledChromPeaks(MTandem_obj$data)
MTandem_obj$extract_abundance_table() MTandem_obj$filter_and_normalize(min_perc_samples = 100, filter_method = 'iqr', perc_remove = 10, norm_method = 'global', log_transform = TRUE) MTandem_obj$calculate_ordination(method = 'nmds', distance = 'bray') MTandem_obj$plot_ordination(group_by = 'treatment')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.