Skip to content

Add AlphaDIA v2+ format compatibility to loader#29

Merged
mlorenz49 merged 3 commits intomainfrom
feature/alphadia-v2-compatibility
Mar 19, 2026
Merged

Add AlphaDIA v2+ format compatibility to loader#29
mlorenz49 merged 3 commits intomainfrom
feature/alphadia-v2-compatibility

Conversation

@mlorenz49
Copy link
Collaborator

  • Support both v1 and v2+ AlphaDIA column naming conventions
  • Implement automatic format detection based on available columns
  • Add column mappings for new dot notation format (e.g., precursor.mz.observed)
  • Maintain full backward compatibility with existing v1 format files
  • Enhance error messages to show both old and new expected column names

Resolves compatibility issues with AlphaDIA v2.0.0+ breaking changes while preserving support for legacy v1 format datasets.

- Support both v1 and v2+ AlphaDIA column naming conventions
- Implement automatic format detection based on available columns
- Add column mappings for new dot notation format (e.g., precursor.mz.observed)
- Maintain full backward compatibility with existing v1 format files
- Enhance error messages to show both old and new expected column names
- Support all file formats: CSV, parquet, and TSV

Resolves compatibility issues with AlphaDIA v2.0.0+ breaking changes
while preserving support for legacy v1 format datasets.

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds compatibility in the AlphaDIA loader for both legacy v1 column names and AlphaDIA v2.0.0+ “dot notation” columns, aiming to automatically detect the available schema and keep backward compatibility.

Changes:

  • Document v1 vs v2+ AlphaDIA column expectations in __parse_alphadia.
  • Add a v1/v2+ column mapping table and auto-detection to select the present columns.
  • Improve missing-column error reporting to reference both v1 and v2+ expected names.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Major improvements addressing all PR review feedback:

- Extend existing ColumnMapper class with AlphaDIA column variants instead of separate function
- Add comprehensive column mappings for both v1 and v2+ formats in COLUMN_VARIANTS
- Remove redundant _detect_alphadia_columns function for cleaner codebase
- Implement proper ion mobility width validation when require_im=True
- Improve error message formatting with clear line breaks
- Update documentation: V1/V2+ → "alphadia version < 2.0.0" / ">= 2.0.0"
- Follow established codebase patterns for better maintainability

This approach leverages existing infrastructure, provides better error messages,
and maintains consistency with other software parsers in the codebase.

Addresses all feedback from @mschwoer and GitHub Copilot review.

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
@mlorenz49 mlorenz49 requested a review from mschwoer March 18, 2026 12:03
Improvements requested by @mschwoer:

- Add version comments to all AlphaDIA entries in COLUMN_VARIANTS
  (# alphadia < 2, # alphadia >= 2) to distinguish input formats clearly
- Add assumption comment explaining why observed values are used instead
  of calibrated values for v2+ (window placement assumption)
- Extract error handling logic to dedicated _raise_alphadia_missing_columns_error()
  method for better code organization and maintainability

These changes improve code readability, documentation, and organization
while maintaining all existing functionality.

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
@mlorenz49 mlorenz49 merged commit 24083dc into main Mar 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants