Mercurial > repos > recetox > isolib
diff isolib.R @ 6:f0fe957df1cc draft default tip
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/isolib commit 148c6b04fff1cedd890d33e98d4fd787026a8628
author | recetox |
---|---|
date | Thu, 12 Jun 2025 09:17:20 +0000 |
parents | 964b4559eb1b |
children |
line wrap: on
line diff
--- a/isolib.R Thu May 15 16:42:56 2025 +0000 +++ b/isolib.R Thu Jun 12 09:17:20 2025 +0000 @@ -148,7 +148,7 @@ # select all columns which describe the elemental composition # remove all 12C, 35Cl etc. # remove isotopes which don't occur - compositions <- as.data.frame(patterns[[i]][, -c(1, 2)]) |> + compositions <- as.data.frame(patterns[[i]][, -c(1, 2), drop = FALSE]) |> dplyr::select(-tidyselect::any_of(monoisotopic$isotope)) |> dplyr::select_if(~ !all(. == 0)) @@ -198,7 +198,11 @@ if (append_isotopes) { result <- result |> dplyr::mutate(result, - full_formula = paste0(formula, " (", isotopes, ")") + full_formula = ifelse( + is.na(isotopes) | isotopes == "", + formula, + paste0(formula, " (", isotopes, ")") + ) ) |> dplyr::select(-all_of(c("formula", "isotopes"))) |> dplyr::rename(formula = full_formula) |>