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

silent fail when metadata did not merge with cluster_df in the picking function #6

Closed
cpauvert opened this issue Apr 17, 2023 · 1 comment

Comments

@cpauvert
Copy link
Member

No description provided.

@cpauvert
Copy link
Member Author

from the example of the picking function:

clusters <- readRDS(system.file("clusters_tibble.RDS", package = "maldipickr"))
# Simulate OD600 values with uniform distribution
#  for each of the colonies we measured with
#  the Bruker MALDI Biotyper
set.seed(104)
metadata <- dplyr::transmute(clusters, name = name, OD600 = runif(n = nrow(clusters)))

# Pick the spectra based on the highest OD600 value per cluster
pick_spectra(clusters, metadata, "OD600")

gives correctly:

# A tibble: 6 × 8
  name         membership cluster_size   SNR peaks is_reference OD600 to_pick
  <chr>             <int>        <int> <dbl> <dbl> <lgl>        <dbl> <lgl>  
1 species1_G2           1            4  5.09    21 FALSE        0.364 FALSE  
2 species2_E11          2            2  5.54    22 FALSE        0.772 TRUE   
3 species2_E12          2            2  5.63    23 TRUE         0.735 FALSE  
4 species3_F7           1            4  4.89    26 FALSE        0.973 TRUE   
5 species3_F8           1            4  5.56    25 TRUE         0.740 FALSE  
6 species3_F9           1            4  5.40    25 FALSE        0.201 FALSE 

However, when the provided metadata cannot be merged,there is no warning but NA in the column:

altered_metadata <- dplyr::mutate(metadata, name = gsub("species","",name))
pick_spectra(clusters, altered_metadata, "OD600")
# A tibble: 6 × 8
  name         membership cluster_size   SNR peaks is_reference OD600 to_pick
  <chr>             <int>        <int> <dbl> <dbl> <lgl>        <dbl> <lgl>  
1 species1_G2           1            4  5.09    21 FALSE           NA TRUE   
2 species2_E11          2            2  5.54    22 FALSE           NA TRUE   
3 species2_E12          2            2  5.63    23 TRUE            NA FALSE  
4 species3_F7           1            4  4.89    26 FALSE           NA FALSE  
5 species3_F8           1            4  5.56    25 TRUE            NA FALSE  
6 species3_F9           1            4  5.40    25 FALSE           NA FALSE  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant