Mercurial > repos > recetox > recetox_aplcms_unsupervised
comparison main.R @ 1:4e6281945270 draft
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/recetox_aplcms commit b3e0c34f12c9c38fb34bf48197974620d60b50c5
author | recetox |
---|---|
date | Thu, 26 May 2022 16:46:13 +0000 |
parents | d740352d272a |
children | 10093dea9b3f |
comparison
equal
deleted
inserted
replaced
0:d740352d272a | 1:4e6281945270 |
---|---|
25 | 25 |
26 rcx_aplcms_to_rcx_xmsannotator <- function(peak_table) { | 26 rcx_aplcms_to_rcx_xmsannotator <- function(peak_table) { |
27 col_base <- c("feature", "mz", "rt") | 27 col_base <- c("feature", "mz", "rt") |
28 output_table <- peak_table %>% distinct(across(any_of(col_base))) | 28 output_table <- peak_table %>% distinct(across(any_of(col_base))) |
29 | 29 |
30 for (level in levels(peak_table$sample)) { | 30 for (level in levels(factor(peak_table$sample))) { |
31 subdata <- peak_table %>% | 31 subdata <- peak_table %>% |
32 filter(sample == level) %>% | 32 filter(sample == level) %>% |
33 select(any_of(c(col_base, "sample_intensity"))) %>% | 33 select(any_of(c(col_base, "sample_intensity"))) %>% |
34 rename(!!level := "sample_intensity") | 34 rename(!!level := "sample_intensity") |
35 output_table <- inner_join(output_table, subdata, by = col_base) | 35 output_table <- inner_join(output_table, subdata, by = col_base) |
99 save_all_corrected_features(res$corrected_features, sample_files) | 99 save_all_corrected_features(res$corrected_features, sample_files) |
100 | 100 |
101 save_aligned_feature_table(res$aligned_feature_sample_table, aligned_file) | 101 save_aligned_feature_table(res$aligned_feature_sample_table, aligned_file) |
102 save_recovered_feature_table(res$recovered_feature_sample_table, recovered_file, out_format) | 102 save_recovered_feature_table(res$recovered_feature_sample_table, recovered_file, out_format) |
103 } | 103 } |
104 | |
105 two_step_hybrid_main <- function(sample_files, known_table_file, updated_known_table_file, recovered_file, aligned_file, out_format, metadata, ...) { | |
106 sample_files <- sort_samples_by_acquisition_number(sample_files) | |
107 metadata <- read.table(metadata, sep = ",", header = TRUE) | |
108 | |
109 known_table <- read_known_table(known_table_file) | |
110 res <- two.step.hybrid(filenames = sample_files, known.table = known_table, work_dir = getwd(), metadata = metadata, ...) | |
111 | |
112 save_known_table(res$known_table, updated_known_table_file) | |
113 save_aligned_feature_table(res$aligned_features, aligned_file) | |
114 save_recovered_feature_table(res$final_features, recovered_file, out_format) | |
115 } |