Conversation
update README
update README
Add filtering for files not in SDRF
Minor update
WalkthroughDocumentation updates rename CLI references and citation details. Peptide normalization now warns and drops rows where SDRF Run is missing before calculations. Quantification type classification recognizes “lfq” in addition to “label free” for single-label inputs, with an updated error message. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Pipeline as PeptideNormalization
participant SDRF as SDRF Data
User->>Pipeline: Start normalization
Pipeline->>SDRF: Load references/runs
alt Any Run == NA
Pipeline->>Pipeline: Collect References with NA Run
Note right of Pipeline: Warn: Missing SDRF Run for listed References
Pipeline->>SDRF: Drop rows with NA Run
end
Pipeline->>Pipeline: Proceed with calculations on remaining rows
Pipeline-->>User: Normalized results
sequenceDiagram
autonumber
actor User
participant QT as QuantificationType.classify
User->>QT: classify(labels)
alt Single label contains "lfq" or "label free"
QT-->>User: Return LFQ classification
else if TMT/iTRAQ patterns
QT-->>User: Return respective classification
else
QT-->>User: Error: Expect label free (or lfq) or supported multiplex
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
ibaqpy/model/quantification_type.py (1)
69-71: Harden LFQ detection against hyphen/underscore and non-string labelsCurrent check misses "label-free"/"label_free" and can raise on non-strings. Normalize and string-coerce.
Apply this diff:
- if len(labels) == 1 and any( - keyword in s.lower() for s in labels for keyword in ["lfq", "label free"] - ): + if len(labels) == 1 and any( + k in str(s).lower().replace("-", " ").replace("_", " ") + for s in labels + for k in ("lfq", "label free") + ):README.md (1)
226-226: Fix markdownlint MD034 (bare URL) in citationSwitch DOI to a markdown link to satisfy linter.
Apply this diff:
-> Zheng P, Audain E, Webel H, Dai C, Klein J, Hitz MP, Sachsenberg T, Bai M, Perez-Riverol Y. Ibaqpy: A scalable Python package for baseline quantification in proteomics leveraging SDRF metadata. J Proteomics. 2025 Jun 15;317:105440. doi: https://doi.org/10.1016/j.jprot.2025.105440. Epub 2025 Apr 21. PMID: 40268243. +> Zheng P, Audain E, Webel H, Dai C, Klein J, Hitz MP, Sachsenberg T, Bai M, Perez-Riverol Y. Ibaqpy: A scalable Python package for baseline quantification in proteomics leveraging SDRF metadata. J Proteomics. 2025 Jun 15;317:105440. doi: [10.1016/j.jprot.2025.105440](https://doi.org/10.1016/j.jprot.2025.105440). Epub 2025 Apr 21. PMID: 40268243.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
README.md(3 hunks)ibaqpy/ibaq/peptide_normalization.py(1 hunks)ibaqpy/model/quantification_type.py(2 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
README.md
226-226: Bare URL used
(MD034, no-bare-urls)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: build
- GitHub Check: build
🔇 Additional comments (4)
ibaqpy/model/quantification_type.py (1)
101-102: Clearer error message — LGTMUpdated message reads better and reflects LFQ synonyms.
README.md (3)
164-165: Option descriptions — LGTMUpdated help text aligns with new CLI usage.
195-195: Duplicate of CLI verificationSame concern as Line 157 regarding
ibaqpycexposure.
157-157: Packaging entry point foribaqpycis configured
Defined under[tool.poetry.scripts]inpyproject.tomlandentry_pointsinrecipe/meta.yaml—no changes needed.
| # "Run" is NA for reference files not found in the SDRF file. | ||
| if data_df[RUN].isna().any(): | ||
|
|
||
| missing_files = data_df.loc[ | ||
| data_df[RUN].isna(), "Reference" | ||
| ].drop_duplicates().tolist() | ||
|
|
||
| logger.warning( | ||
| f"Reference files {missing_files} are not present in the SDRF file. Skipping calculation." | ||
| ) | ||
| data_df.dropna(subset=[RUN], inplace=True) | ||
|
|
There was a problem hiding this comment.
Avoid KeyError on missing 'Reference' column; make warning robust and drop non-existent RUN rows safely
"Reference" may not exist post-renaming (parquet_map). Use a fallback to available columns (e.g., "reference_file_name", SAMPLE_ID) and include the missing count in the log. Also avoid inplace to prevent chained-assignment pitfalls.
Apply this diff:
- # "Run" is NA for reference files not found in the SDRF file.
- if data_df[RUN].isna().any():
-
- missing_files = data_df.loc[
- data_df[RUN].isna(), "Reference"
- ].drop_duplicates().tolist()
-
- logger.warning(
- f"Reference files {missing_files} are not present in the SDRF file. Skipping calculation."
- )
- data_df.dropna(subset=[RUN], inplace=True)
+ # "Run" is NA for reference files not found in the SDRF file.
+ if data_df[RUN].isna().any():
+ n_missing = int(data_df[RUN].isna().sum())
+ ref_col = next(
+ (c for c in ("Reference", "reference_file_name", SAMPLE_ID) if c in data_df.columns),
+ None,
+ )
+ missing_files = []
+ if ref_col:
+ missing_files = (
+ data_df.loc[data_df[RUN].isna(), ref_col].dropna().drop_duplicates().tolist()
+ )
+ logger.warning(
+ f"{n_missing} rows have NA Run; {ref_col} values {missing_files} are not present in the SDRF. Skipping calculation for them."
+ )
+ else:
+ logger.warning(
+ f"{n_missing} rows have NA Run but no reference column found among "
+ f"('Reference', 'reference_file_name', '{SAMPLE_ID}'). Dropping those rows."
+ )
+ data_df = data_df.dropna(subset=[RUN])📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # "Run" is NA for reference files not found in the SDRF file. | |
| if data_df[RUN].isna().any(): | |
| missing_files = data_df.loc[ | |
| data_df[RUN].isna(), "Reference" | |
| ].drop_duplicates().tolist() | |
| logger.warning( | |
| f"Reference files {missing_files} are not present in the SDRF file. Skipping calculation." | |
| ) | |
| data_df.dropna(subset=[RUN], inplace=True) | |
| # "Run" is NA for reference files not found in the SDRF file. | |
| if data_df[RUN].isna().any(): | |
| n_missing = int(data_df[RUN].isna().sum()) | |
| ref_col = next( | |
| (c for c in ("Reference", "reference_file_name", SAMPLE_ID) if c in data_df.columns), | |
| None, | |
| ) | |
| missing_files = [] | |
| if ref_col: | |
| missing_files = ( | |
| data_df.loc[data_df[RUN].isna(), ref_col] | |
| .dropna() | |
| .drop_duplicates() | |
| .tolist() | |
| ) | |
| logger.warning( | |
| f"{n_missing} rows have NA Run; {ref_col} values {missing_files} are not present in the SDRF. " | |
| "Skipping calculation for them." | |
| ) | |
| else: | |
| logger.warning( | |
| f"{n_missing} rows have NA Run but no reference column found among " | |
| f"('Reference', 'reference_file_name', '{SAMPLE_ID}'). Dropping those rows." | |
| ) | |
| data_df = data_df.dropna(subset=[RUN]) |
🤖 Prompt for AI Agents
In ibaqpy/ibaq/peptide_normalization.py around lines 211-222, the code assumes a
"Reference" column exists and uses inplace drop, which can raise KeyError or
cause chained-assignment issues; update it to first detect an available
identifier column by checking for "Reference", then "reference_file_name", then
"SAMPLE_ID" (use the first that exists), build a list of missing identifiers and
count (handle case where none of these columns exist by using indices or an
empty list), log a warning that includes the missing count and the identifier
list, and avoid inplace operations by assigning the result of
dropna(subset=[RUN]) back to data_df (e.g., data_df =
data_df.dropna(subset=[RUN])).
PR Type
Bug fix, Enhancement, Documentation
Description
Add filtering for missing SDRF files with warning
Expand label-free quantification detection to include "lfq"
Update README with corrected commands and citation
Improve error handling for reference files
Diagram Walkthrough
File Walkthrough
peptide_normalization.py
Add SDRF file filtering with warningsibaqpy/ibaq/peptide_normalization.py
quantification_type.py
Enhance label-free quantification detectionibaqpy/model/quantification_type.py
README.md
Update documentation and citationREADME.md
ibaqpytoibaqpycSummary by CodeRabbit
New Features
Bug Fixes
Documentation