Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
hechth committed Oct 25, 2024
1 parent efec3a8 commit cff766a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions tools/isolib/isolib.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ generate_isotope_spectra <- function(compound_table, adducts_to_use, append_addu
compositions <- compositions |>
dplyr::rowwise() |>
dplyr::mutate(isotopes = paste( # combine elemental composition into single string
purrr::map2_chr(names(compositions), dplyr::c_across(everything()), ~ paste(.x, .y, sep = ":")), collapse = ", ")
) |>
purrr::map2_chr(names(compositions), dplyr::c_across(everything()), ~ paste(.x, .y, sep = ":")),
collapse = ", ")) |>
dplyr::ungroup() |>
dplyr::select(isotopes)
isos <- append(isos, list(compositions$isotopes))
Expand Down Expand Up @@ -133,7 +133,12 @@ write_to_table <- function(spectra, file, append_isotopes) {

main <- function() {
args <- parse_args()
spectra <- generate_isotope_spectra(args$compound_table, args$adducts_to_use, args$append_adducts, args$threshold)
spectra <- generate_isotope_spectra(
args$compound_table,
args$adducts_to_use,
args$append_adducts,
args$threshold
)

if(args$out_format == "msp") {
write_to_msp(spectra, args$outfile)
Expand All @@ -144,7 +149,3 @@ main <- function() {

# Call the main function
main()

# > u <- dplyr::mutate(x, peaks = paste(unlist(mz), collapse=","))
# > res <- tidyr::separate_longer_delim(u, peaks, ",")
# > monoisotopic <- isotopes |> dplyr::group_by(element) |> dplyr::slice_max(abundance, n = 1) |> dplyr::filter(!stringr::str_detect(element, "\\[|\\]"))
2 changes: 1 addition & 1 deletion tools/isolib/isolib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</conditional>
</inputs>
<outputs>
<data name="isotope_library">
<data format="msp" name="isotope_library">
<change_format>
<when input="formatting.out_format" value="msp" format="msp" />
<when input="formatting.out_format" value="tabular" format="tabular" />
Expand Down

0 comments on commit cff766a

Please sign in to comment.