Skip to content

Commit

Permalink
Fix NA issue in calculate_sequence_coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
jpquast committed Aug 17, 2023
1 parent 0c23e58 commit 5b3da33
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/calculate_sequence_coverage.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ sequence_coverage <- function(...) {
#' @importFrom magrittr %>%
#' @importFrom stringr str_count
#' @importFrom rlang .data as_name enquo
#' @importFrom tidyr drop_na
#' @export
#'
#' @examples
Expand All @@ -49,6 +50,9 @@ sequence_coverage <- function(...) {
calculate_sequence_coverage <-
function(data, protein_sequence, peptides) {
result <- data %>%
dplyr::ungroup() %>%
# drop_na prevents function from failing if a protein group contains only NA peptide sequences.
tidyr::drop_na({{ peptides }}) %>%
dplyr::distinct({{ protein_sequence }}, {{ peptides }}) %>%
dplyr::group_by({{ protein_sequence }}) %>%
find_peptide({{ protein_sequence }}, {{ peptides }}) %>%
Expand Down

0 comments on commit 5b3da33

Please sign in to comment.