diff 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
line wrap: on
line diff
--- a/main.R	Tue Mar 22 16:09:47 2022 +0000
+++ b/main.R	Thu May 26 16:46:13 2022 +0000
@@ -27,7 +27,7 @@
     col_base <- c("feature", "mz", "rt")
     output_table <- peak_table %>% distinct(across(any_of(col_base)))
 
-    for (level in levels(peak_table$sample)) {
+    for (level in levels(factor(peak_table$sample))) {
         subdata <- peak_table %>%
             filter(sample == level) %>%
             select(any_of(c(col_base, "sample_intensity"))) %>%
@@ -101,3 +101,15 @@
   save_aligned_feature_table(res$aligned_feature_sample_table, aligned_file)
   save_recovered_feature_table(res$recovered_feature_sample_table, recovered_file, out_format)
 }
+
+two_step_hybrid_main <- function(sample_files, known_table_file, updated_known_table_file, recovered_file, aligned_file, out_format, metadata, ...) {
+  sample_files <- sort_samples_by_acquisition_number(sample_files)
+  metadata <- read.table(metadata, sep = ",", header = TRUE)
+
+  known_table <- read_known_table(known_table_file)
+  res <- two.step.hybrid(filenames = sample_files, known.table = known_table, work_dir = getwd(), metadata = metadata, ...)
+
+  save_known_table(res$known_table, updated_known_table_file)
+  save_aligned_feature_table(res$aligned_features, aligned_file)
+  save_recovered_feature_table(res$final_features, recovered_file, out_format)
+}