Skip to content

Commit

Permalink
Merge branch 'developer' into fetch_pdb_improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
jpquast committed Oct 30, 2024
2 parents cdd6f04 + 8e61640 commit ee4f706
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
16 changes: 3 additions & 13 deletions R/assign_peptide_type.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ assign_peptide_type <- function(data,
aa_before = aa_before,
last_aa = last_aa,
aa_after = aa_after,
protein_id = protein_id,
protein_id = NULL,
start = start) {
# Check if there's any peptide starting at position 1 for each protein
start_summary <- data %>%
Expand All @@ -86,24 +86,14 @@ assign_peptide_type <- function(data,
TRUE,
FALSE
)) %>%
# Reassign peptides to be N_term_tryp if the protein starts on position 2
dplyr::mutate(N_term_tryp = ifelse({{ start }} == 2 & !.data$has_start_1, TRUE, .data$N_term_tryp)) %>%
# Assign peptide type based on N-term and C-term trypticity
dplyr::mutate(pep_type = dplyr::case_when(
.data$N_term_tryp & .data$C_term_tryp ~ "fully-tryptic",
.data$N_term_tryp | .data$C_term_tryp ~ "semi-tryptic",
TRUE ~ "non-tryptic"
)) %>%
# Reassign semi-tryptic peptides at position 2 to fully-tryptic if no start == 1
dplyr::mutate(pep_type = dplyr::if_else(
.data$pep_type == "semi-tryptic" & {{ start }} == 2 & !.data$has_start_1 & .data$C_term_tryp,
"fully-tryptic",
.data$pep_type
)) %>%
# Reassign non-tryptic peptides at position 2 to semi-tryptic if no start == 1
dplyr::mutate(pep_type = dplyr::if_else(
.data$pep_type == "non-tryptic" & {{ start }} == 2 & !.data$has_start_1 & !.data$C_term_tryp,
"fully-tryptic",
.data$pep_type
)) %>%
# Drop unnecessary columns
dplyr::select(-c("N_term_tryp", "C_term_tryp", "has_start_1"))

Expand Down
2 changes: 1 addition & 1 deletion man/assign_peptide_type.Rd

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

0 comments on commit ee4f706

Please sign in to comment.