-
Notifications
You must be signed in to change notification settings - Fork 2
Fix error when calling multiple Spectra objects in addFragments #20
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
Merged
Merged
Changes from 49 commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
11d943c
Create fragments-calculate2.R
guideflandre 32dd91b
Create test_fragments2.R
guideflandre ab01551
Update fragments-calculate2.R
guideflandre d1951bb
Update fragments-calculate2.R
guideflandre d505a3d
Update fragments-calculate2.R
guideflandre b75af03
Update documentation
guideflandre f3b7ba7
Update documentation
guideflandre ea262a0
Delete PSMatch.Rproj
guideflandre dfeaa2e
Update NEWS.md
guideflandre 7c8f6c9
Update DESCRIPTION
guideflandre 9d1ea08
Update fragments-calculate2.R
guideflandre befd86a
Update test_fragments2.R
guideflandre 046cca0
Update R/fragments-calculate2.R
guideflandre ebb8673
Update fragments-calculate2.R
guideflandre 5c4ce49
Update fragments-calculate2.R
guideflandre 7c8afd6
Update DESCRIPTION
guideflandre 6d25915
git ignore Rproj file
guideflandre f5b8b06
update .cumsumFragmentMasses
guideflandre 9d5b9ff
update: testthat .cumsumFragmentMasses
guideflandre 5c0344e
update variable_modifications default to empty numeric
guideflandre a39cbee
Update fragments-calculate2.R
guideflandre 0525f86
Add warning for modifications parameter
guideflandre f4a5d0f
Remove redundancy in strplit(sequence)
guideflandre 2526ccd
Update documentation
guideflandre bdd7cd8
update documentation
guideflandre 3d6bc0c
update documentaton
guideflandre 7107718
Merge calculateFragments and calculateFragments2 into one true calcul…
guideflandre 4f5795a
Remove redundancies and update calculateFragments based on PR
guideflandre 5f46152
Updated failed unit test
guideflandre 56aec17
Update comments in addFragments
guideflandre 11834aa
Merge branch 'main' of https://github.com/guideflandre/PSMatch
guideflandre 775859c
Update addFragments to generate a list
guideflandre 8203f6d
Remove check for variable modifications as they are now included in S…
guideflandre f0b1f2a
Update documentation
guideflandre a3c3ada
addFragments correcion
guideflandre 264390c
Update tests addFragments
guideflandre 7c3c368
Remove attribute in addFragments
guideflandre b07d1a4
add PlotSpectraPTM
guideflandre 868918d
remove plotting function for PR
guideflandre b2b12d9
Update R/fragments-add.R
guideflandre 8a62849
Update test_addFragments.R
guideflandre 898d8f5
Update documentation
guideflandre df39f37
Remove unnecessary test
guideflandre 70edf96
Update based on PR review
guideflandre 7b1d929
Add attribute
guideflandre fb4403d
deprecate addLabels
guideflandre f97c14b
remove old addFragments test and R
guideflandre a7367d0
Replace addFragments documentation with labelFragments
guideflandre aedbcbd
Change addFragments name and update NEWS
guideflandre 302ab52
Update documentations
guideflandre 10071d1
Update documentations
guideflandre 924cb46
Resolved merge conflict in <file>
guideflandre 21c2f30
fix indent
guideflandre d8d8239
Decprecate addFragments correctly
guideflandre 54f2d5c
Merge branch 'main' into main
guideflandre fd4d384
Update addFragments
guideflandre 80178e2
Call labelFragments when addFragments is called
guideflandre e668386
Call labelFragments when addFragments is called
guideflandre 33a149e
Merge branch 'main' of https://github.com/guideflandre/PSMatch
guideflandre 3aaa30f
update documentation
guideflandre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| test_that("labelFragments() works", { | ||
| library("Spectra") | ||
| seq <- "PQR" | ||
| frags <- calculateFragments(seq) | ||
| o <- order(frags$mz) | ||
| sp <- DataFrame(msLevel = 2L, rtime = 2345, sequence = seq) | ||
| sp$mz <- list(frags$mz[o]) | ||
| sp$intensity <- list(rep(1, 7)) | ||
| sp <- Spectra(sp) | ||
| ## all fragments | ||
| ans <- labelFragments(sp)[[1]] | ||
| exp <- frags$ion[o] | ||
| ## Remove attribute | ||
| expect_identical(ans[1:length(ans)], exp) | ||
| ## 2nd fragment missing | ||
| sp$mz[[1]][2] <- sp$mz[[1]][2] * 1.1 | ||
| exp[2] <- NA | ||
| ans <- labelFragments(sp)[[1]] | ||
| expect_identical(ans[1:length(ans)], exp) | ||
| ## 7th fragment missing | ||
| sp$mz[[1]][7] <- sp$mz[[1]][7] * 1.1 | ||
| exp[7] <- NA | ||
| ans <- labelFragments(sp)[[1]] | ||
| expect_identical(ans[1:length(ans)], exp) | ||
| }) | ||
|
|
||
|
|
||
| test_that("labelFragments() works with multiple Spectra", { | ||
| library("Spectra") | ||
| seq <- c("PQR", "ACE") | ||
| frags_pqr <- calculateFragments(seq)[1:7,] | ||
| frags_ace <- calculateFragments(seq)[8:13,] | ||
| o_pqr <- order(frags_pqr$mz) | ||
| o_ace <- order(frags_ace$mz) | ||
| sp <- DataFrame(msLevel = c(2L, 2L), rtime = c(2345, 2346), sequence = seq) | ||
| sp$mz <- c(list(frags_pqr$mz[o_pqr]), list(frags_ace$mz[o_ace])) | ||
| sp$intensity <- c(list(rep(1, 7)), list(rep(1, 6))) | ||
| sp <- Spectra(sp) | ||
| ## all fragments | ||
| ans <- labelFragments(sp) | ||
| ## Number of elements equal the possibilities of peptide sequences | ||
| ## This instance: no mod, 1 mod on Q: 2 possibilities | ||
| expect_equal(length(ans), 2) | ||
| expect_identical(names(ans), seq) | ||
| }) | ||
|
|
||
| test_that("labelFragments() works with modifications", { | ||
| library("Spectra") | ||
| seq <- "PQR" | ||
| frags <- calculateFragments(seq) | ||
| o <- order(frags$mz) | ||
| sp <- DataFrame(msLevel = 2L, rtime = 2345, sequence = seq) | ||
| sp$mz <- list(frags$mz[o]) | ||
| sp$intensity <- list(rep(1, 7)) | ||
| sp <- Spectra(sp) | ||
| ## all fragments | ||
| ans <- labelFragments(sp, variable_modifications = c(Q = 45)) | ||
| ## Number of elements equal the possibilities of peptide sequences | ||
| ## This instance: no mod, 1 mod on Q: 2 possibilities | ||
| expect_equal(length(ans), 2) | ||
| }) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.