Skip to content

Commit

Permalink
Adding SIRIUS feature tables support (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adafede committed Feb 3, 2025
1 parent 9a7ddbc commit 31f3413
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# tima

# tima 2.11.1

* Added `SIRIUS` feature tables support (#185)

# tima 2.11.0

* Added convenience function to change small parameters (#177)
Expand Down
2 changes: 1 addition & 1 deletion R/change_params_small.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @include load_yaml_files.R
#'
#' @param fil_pat The pattern identifying your whole job. You can put whatever you want. STRING
#' @param fil_fea_raw The path to the file containing your features' intensities. Can be generated by mzmine3 or SLAW. STRING
#' @param fil_fea_raw The path to the file containing your features' intensities. Can be generated by mzmine, SLAW, or SIRIUS. STRING
#' @param fil_met_raw The path to the file containing your metadata. If your experiment contains a single taxon, you can provide it below instead. STRING
#' @param fil_sir_raw The directory containing the sirius annotations. STRING
#' @param fil_spe_raw The path to the file containing your features' spectra. Can contain MS1 and/or MS2 spectra. STRING
Expand Down
11 changes: 10 additions & 1 deletion R/prepare_taxa.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,15 @@ prepare_taxa <-
log_debug(x = "... requires 'Peak area' or ':area'
in columns (mzmine format)")
log_debug(x = "... or 'quant_' in columns (SLAW format)")
log_debug(x = "... or 'Peak height' in columns (SIRIUS format)")

feature_table <- feature_table_0 |>
tidytable::select(
tidyselect::all_of(c(name_features)),
tidyselect::matches(" Peak area"),
tidyselect::matches(":area"),
tidyselect::matches("quant_")
tidyselect::matches("quant_"),
tidyselect::matches(" Peak height")
) |>
tidytable::select(-tidyselect::matches("quant_peaktable")) |>
tidyfst::col_rn(var = name_features)
Expand All @@ -132,6 +135,12 @@ prepare_taxa <-
replacement = "",
vectorize_all = FALSE
)
colnames(feature_table) <- colnames(feature_table) |>
stringi::stri_replace_all_fixed(
pattern = " Peak height",
replacement = "",
vectorize_all = FALSE
)
log_debug(x = "... filtering top K intensities per feature")
top_n <- feature_table |>
tidyfst::rn_col() |>
Expand Down
2 changes: 1 addition & 1 deletion inst/params/prepare_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ files:
pattern: example
features:
#' The path to the file containing your features' intensities.
#' Can be generated by mzmine3 or SLAW. STRING
#' Can be generated by mzmine, SLAW, or SIRIUS. STRING
raw: data/source/example_features.csv
metadata:
#' The path to the file containing your metadata.
Expand Down
2 changes: 1 addition & 1 deletion man/change_params_small.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 31f3413

Please sign in to comment.