changeset 3:6b5dec818827 draft default tip

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/recetox-xmsannotator commit bc3445f7c41271b0062c7674108f57708d08dd28
author recetox
date Thu, 30 May 2024 14:53:48 +0000
parents 50ac7359ffe7
children
files utils.R
diffstat 1 files changed, 23 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/utils.R	Thu Oct 12 13:31:24 2023 +0000
+++ b/utils.R	Thu May 30 14:53:48 2024 +0000
@@ -2,36 +2,36 @@
 library(dplyr)
 
 load_table <- function(filename, filetype) {
-  if (filename == "None") {
-    return(NULL)
-  }
-  if (filetype == "csv") {
-    return(as.data.frame(read.csv(filename)))
-  } else {
-    return(as.data.frame(arrow::read_parquet(filename)))
-  }
+    if (filename == "None") {
+        return(NULL)
+    }
+    if (filetype == "csv") {
+        return(as.data.frame(read.csv(filename)))
+    } else {
+        return(as.data.frame(arrow::read_parquet(filename)))
+    }
 }
 
 save_table <- function(table, filename, filetype) {
-  if (filetype == "csv") {
-    write.csv(table, filename, row.names = FALSE)
-  } else {
-    arrow::write_parquet(table, filename)
-  }
+    if (filetype == "csv") {
+        write.csv(table, filename, row.names = FALSE)
+    } else {
+        arrow::write_parquet(table, filename)
+    }
 }
 
 create_filter_by_adducts <- function(comma_separated_values) {
-  if (comma_separated_values == "None") {
-    return(NA)
-  }
-  filter_by <- strsplit(trimws(comma_separated_values), ",")[[1]]
-  return(filter_by)
+    if (comma_separated_values == "None") {
+        return(NA)
+    }
+    filter_by <- strsplit(trimws(comma_separated_values), ",")[[1]]
+    return(filter_by)
 }
 
 create_peak_table <- function(metadata_table, intensity_table) {
-  metadata_table <- select(metadata_table, id, mz, rt)
-  peak_table <- inner_join(metadata_table, intensity_table, by = "id")
-  peak_table <- rename(peak_table, peak = id)
-  peak_table$peak <- as.integer(peak_table$peak)
-  return(peak_table)
+    metadata_table <- select(metadata_table, id, mz, rt)
+    peak_table <- inner_join(metadata_table, intensity_table, by = "id")
+    peak_table <- rename(peak_table, peak = id)
+    peak_table$peak <- as.integer(peak_table$peak)
+    return(peak_table)
 }