Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add function to gather spectra checks stats #45

Open
cpauvert opened this issue Apr 30, 2024 · 0 comments · May be fixed by #46
Open

add function to gather spectra checks stats #45

cpauvert opened this issue Apr 30, 2024 · 0 comments · May be fixed by #46
Labels
enhancement New feature or request

Comments

@cpauvert
Copy link
Member

Is your feature request related to a problem? Please describe.
I'm always frustrated when I need to compute how many raw spectra were analyzed, how many valid, and why they were rejected.

Describe the solution you'd like
This function below is an untested, undocumented attempt:

gather_spectra_stats <- function(check_vectors){
  # check_vectors from maldipickr::check_spectra
  # src: https://stackoverflow.com/a/51140480/21085566
  aggregated_checks <- Reduce(`|`, check_vectors)
  check_stats <- vapply(check_vectors, sum, FUN.VALUE = integer(1)) %>%
    tibble::as_tibble_row()
  tibble::tibble(
    "n_spectra" = length(aggregated_checks),
    "n_valid_spectra" = n_spectra - sum(aggregated_checks)
  ) %>%
    dplyr::bind_cols(check_stats) %>% 
    return()
}

@cpauvert cpauvert added the enhancement New feature or request label Apr 30, 2024
cpauvert added a commit that referenced this issue May 3, 2024
@cpauvert cpauvert linked a pull request Jun 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant