-
Notifications
You must be signed in to change notification settings - Fork 52
Removed deep-copy data.table ops from the dataProcess pipeline #208
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
Open
tonywu1999
wants to merge
7
commits into
devel
Choose a base branch
from
MSstats/work/20260514_avoid-deep-copy-ops
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
16edbd5
Removed deep-copy data.table ops from the dataProcess pipeline
tonywu1999 b64b004
Updating the comments.
Rudhik1904 e2bd771
Updating some more comments.
Rudhik1904 65df2b5
Responding to the comments.
Rudhik1904 0764b34
Responding to comments- 2
Rudhik1904 27d5f7c
Responding to Tony's suggestions
Rudhik1904 50a30da
Adressing Matt's comments
Rudhik1904 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -414,19 +414,19 @@ MSstatsSummarizeSingleLinear = function(single_protein, | |
| }] | ||
|
|
||
| if (is_labeled_reference) { | ||
| single_protein[, predicted := ifelse(censored & is_labeled_ref == FALSE, predicted, NA)] | ||
| single_protein[, newABUNDANCE := ifelse(censored & is_labeled_ref == FALSE, predicted, newABUNDANCE)] | ||
| single_protein[!(censored & is_labeled_ref == FALSE), predicted := NA] | ||
| single_protein[(censored) & is_labeled_ref == FALSE, | ||
| newABUNDANCE := predicted] | ||
| } else { | ||
| single_protein[, predicted := ifelse(censored, predicted, NA)] | ||
| single_protein[, newABUNDANCE := ifelse(censored, predicted, newABUNDANCE)] | ||
| single_protein[!(censored), predicted := NA] | ||
| single_protein[(censored), newABUNDANCE := predicted] | ||
| } | ||
|
|
||
| survival = single_protein[, intersect(c(cols, "LABEL", "predicted"), colnames(single_protein)), with = FALSE] | ||
| } else { | ||
| survival = single_protein[, intersect(c(cols, "LABEL"), colnames(single_protein)), with = FALSE] | ||
| survival[, predicted := NA] | ||
| } | ||
|
|
||
| if (all(!is.na(single_protein$ANOMALYSCORES))) { | ||
| single_protein[, weights := | ||
| anomaly_weights_z_vec(ANOMALYSCORES), | ||
|
|
@@ -569,11 +569,13 @@ MSstatsSummarizeSingleTMP = function(single_protein, impute, censored_symbol, | |
| } | ||
|
|
||
| if (is_labeled_reference) { | ||
| single_protein[, predicted := ifelse(censored & is_labeled_ref == FALSE, predicted, NA)] | ||
| single_protein[, newABUNDANCE := ifelse(censored & is_labeled_ref == FALSE, predicted, newABUNDANCE)] | ||
| single_protein[!(censored & is_labeled_ref == FALSE), predicted := NA] | ||
| single_protein[(censored) & is_labeled_ref == FALSE, | ||
| newABUNDANCE := predicted] | ||
| } else { | ||
| single_protein[, predicted := ifelse(censored, predicted, NA)] | ||
| single_protein[, newABUNDANCE := ifelse(censored, predicted, newABUNDANCE)] | ||
| single_protein[!(censored), predicted := NA] | ||
| single_protein[(censored), | ||
| newABUNDANCE := predicted] | ||
| } | ||
| survival = single_protein[, intersect(c(cols, "LABEL", "predicted"), colnames(single_protein)), with = FALSE] | ||
| } else { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. save as above
|
||
|
|
||
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 |
|---|---|---|
|
|
@@ -211,9 +211,10 @@ MSstatsPrepareForDataProcess = function(input, log_base, fix_missing) { | |
| cols = toupper(cols) | ||
| cols = intersect(c(cols, "FRACTION", "TECHREPLICATE"), | ||
| colnames(input)) | ||
| input = input[, cols, with = FALSE] | ||
|
|
||
| input$PEPTIDE = paste(input$PEPTIDESEQUENCE, | ||
| drop_cols = setdiff(colnames(input), cols) | ||
| for (col in drop_cols) data.table::set(input, j = col, value = NULL) | ||
|
|
||
| input$PEPTIDE = paste(input$PEPTIDESEQUENCE, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "$" assignments should go. Line 215 is the way to go |
||
| input$PRECURSORCHARGE, sep = "_") | ||
| input$TRANSITION = paste(input$FRAGMENTION, | ||
| input$PRODUCTCHARGE, sep = "_") | ||
|
|
@@ -322,8 +323,8 @@ setMethod(".checkDataValidity", "MSstatsValidated", .prepareForDataProcess) | |
| input[, PROTEIN := factor(PROTEIN)] | ||
| input[, PEPTIDE := factor(PEPTIDE)] | ||
| input[, TRANSITION := factor(TRANSITION)] | ||
| input = input[order(LABEL, GROUP_ORIGINAL, SUBJECT_ORIGINAL, | ||
| RUN, PROTEIN, PEPTIDE, TRANSITION), ] | ||
| data.table::setorder(input, LABEL, GROUP_ORIGINAL, SUBJECT_ORIGINAL, | ||
| RUN, PROTEIN, PEPTIDE, TRANSITION) | ||
| input[, GROUP := factor(GROUP)] | ||
| input[, SUBJECT := factor(SUBJECT)] | ||
| input[, FEATURE := factor(FEATURE)] | ||
|
|
||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done — replaced all six is_labeled_ref == FALSE comparisons with !is_labeled_ref (in both MSstatsSummarizeSingleLinear and MSstatsSummarizeSingleTMP).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked with address() — single_protein[, keep, with = FALSE] does materialize a copy of the selected columns (they get new addresses, not shared). But it's a per-protein slice (a handful of columns × one protein's rows), not a whole-dataset copy, so the size is negligible relative to the copies this PR targets. It's also a necessary copy: survival is returned separately and, in the no-impute branch, gets survival[, predicted := NA] — sharing storage with single_protein would corrupt it. So I'd leave it as-is, but happy to revisit