Skip to content

Commit

Permalink
refactor: merge calculateFragments and calculateFragments2 (#19)
Browse files Browse the repository at this point in the history
* Create fragments-calculate2.R

feat: calculateFragments2 
Provides modifications to the generated theoretical fragments

* Create test_fragments2.R

feat: tests for calculateFragments2

* Update fragments-calculate2.R

* Update fragments-calculate2.R

* Update fragments-calculate2.R

* Update documentation

* Update documentation

* Delete PSMatch.Rproj

* Update NEWS.md

* Update DESCRIPTION

* Update fragments-calculate2.R

Updates based on reviewed PR

* Update test_fragments2.R

Updates according to reviewed PR

* Update R/fragments-calculate2.R

Co-authored-by: Sebastian Gibb <[email protected]>

* Update fragments-calculate2.R

* Update fragments-calculate2.R

Corrected .cumsumFragmentMasses

* Update DESCRIPTION

* git ignore Rproj file

* update .cumsumFragmentMasses

* update: testthat .cumsumFragmentMasses

* update variable_modifications default to empty numeric

* Update fragments-calculate2.R

Change modified peptide layout into AGC[57.02]AK instead of AG[C]AK to specify the modified mass

* Add warning for modifications parameter

* Remove redundancy in strplit(sequence)

* Update documentation

* update documentation

* Merge calculateFragments and calculateFragments2 into one true calculateFragments

* Remove redundancies and update calculateFragments based on PR

* Updated failed unit test

* Update comments in addFragments

---------

Co-authored-by: Sebastian Gibb <[email protected]>
  • Loading branch information
guideflandre and sgibb authored Jan 22, 2025
1 parent b042157 commit 84df425
Show file tree
Hide file tree
Showing 8 changed files with 544 additions and 693 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export("reduced<-")
export(ConnectedComponents)
export(PSM)
export(addFragments)
export(calculateFragments2)
export(ccMatrix)
export(connectedComponents)
export(defaultNeutralLoss)
Expand Down
6 changes: 6 additions & 0 deletions R/fragments-add.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ addFragments <- function(x,
x_data <- Spectra::peaksData(x)[[1L]]
y_data <- calculateFragments(y, verbose = FALSE, ...)
y_data <- y_data[order(y_data$mz), ]

## stop if variable modifications used
## Temporary check to allow plotSpectra to work fine
## Will need to be removed once plotSpectra accepts variable modifications
## See issue: https://github.com/rformassspectrometry/Spectra/issues/346
stopifnot(length(unique(y_data[["peptide"]])) == 1)

## Find common peaks and prepare annotations
idx <- which(MsCoreUtils::common(x_data[, "mz"], y_data[, "mz"],
Expand Down
Loading

0 comments on commit 84df425

Please sign in to comment.