-
Notifications
You must be signed in to change notification settings - Fork 46
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
rewrite topN and remove getTopIdx/subsetBy #199
Conversation
Codecov Report
@@ Coverage Diff @@
## master #199 +/- ##
==========================================
- Coverage 71.8% 71.75% -0.06%
==========================================
Files 67 67
Lines 7182 7165 -17
==========================================
- Hits 5157 5141 -16
+ Misses 2025 2024 -1
Continue to review full report at Codecov.
|
@sgibb thank you very much! Could you document this in the news file, please, possibly with the PR number. That will make it easier if, in the future, we need to track that change back. |
From: Sebastian Gibb <mail@sebastiangibb.de> git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/MSnbase@127877 bc3139a8-67e5-0310-9ffc-ced21a209358
From: Sebastian Gibb <mail@sebastiangibb.de> git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/MSnbase@127877 bc3139a8-67e5-0310-9ffc-ced21a209358
This PR replaces
getTopIdx
andsubsetBy
by.topIdx
..topIdx
runs the summarise function just once over the whole matrix (instead of groupwise asgetTopIdx
did) and returns global row indicies that could be directly used to subset the matrix (no need forsubsetBy
anymore).The code is much easier to read and it greatly improves the runtime (in this example 4x but in our current synapter set with 30000 peptides it is nearly 40x):
Obviously the
MSnSet
are not identical anymore because I use subset instead of recreation now (but recreation would also be possible if wished).There is also a new function
.summariseRow
that just runapply(x, 1, fun, ...)
in most cases. But if the user want to usesum
/mean
it usesrowSums
/rowMeans
. We could use.summariseRow
in other places too (if you like). Please note thatsummariseRow
could easily be fouled:summariseRow(x, fun=function(y)sum(y))
will useapply
instead ofrowSums
.