Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 19, 2025

Adds Pythonic wrapper for OpenMS ExperimentalDesign to support multi-sample, fractionated experiment metadata management with pandas DataFrame integration and file storage capabilities.

Implementation

  • Py_ExperimentalDesign class with properties: n_samples, n_ms_files, n_fractions, n_fraction_groups, n_labels, is_fractionated, samples
  • Factory methods: from_file(), from_consensus_map(), from_feature_map(), from_identifications(), from_dataframe(), from_df()
  • DataFrame methods: to_dataframe(), get_df() for seamless pandas integration
  • Storage method: store() writes experimental designs to TSV files with full roundtrip support
  • Example file: experimental_design.tsv with 2-sample, 3-fraction fractionated design
  • Test suite: 21 tests covering load, store, properties, factory methods, DataFrame operations, edge cases
  • README section: Documentation and usage examples following idperformance pattern

Usage

from openms_python import Py_ExperimentalDesign
import pandas as pd

# Load from file
design = Py_ExperimentalDesign.from_file("design.tsv")
print(f"Samples: {design.n_samples}, Fractionated: {design.is_fractionated}")

# Create from pandas DataFrame
df = pd.DataFrame({
    'Fraction_Group': [1, 1, 2, 2],
    'Fraction': [1, 2, 1, 2],
    'Spectra_Filepath': ['f1.mzML', 'f2.mzML', 'f3.mzML', 'f4.mzML'],
    'Label': [1, 1, 1, 1],
    'Sample': [1, 1, 2, 2]
})
design = Py_ExperimentalDesign.from_dataframe(df)

# Convert to DataFrame for analysis
df = design.to_dataframe()

# Store to file
design.store("output_design.tsv")

# Create from existing objects
from openms_python import Py_ConsensusMap
consensus = Py_ConsensusMap.from_file("results.consensusXML")
design = Py_ExperimentalDesign.from_consensus_map(consensus)
design.print_summary()
Original prompt

Add support for experimentaldesign test and add to readme


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link

coderabbitai bot commented Nov 19, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 2 commits November 19, 2025 10:23
Co-authored-by: timosachsenberg <5803621+timosachsenberg@users.noreply.github.com>
Co-authored-by: timosachsenberg <5803621+timosachsenberg@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for experimentaldesign test and update README Add Py_ExperimentalDesign wrapper with tests and documentation Nov 19, 2025
@timosachsenberg
Copy link
Contributor

@copilot From a Pandas dataframe would be great

…aframe)

Co-authored-by: timosachsenberg <5803621+timosachsenberg@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 19, 2025

@copilot From a Pandas dataframe would be great

Added DataFrame support with from_dataframe(), from_df(), to_dataframe(), and get_df() methods. You can now create experimental designs from pandas DataFrames and convert them back for analysis. See commit e783d35.

Copilot AI changed the title Add Py_ExperimentalDesign wrapper with tests and documentation Add Py_ExperimentalDesign wrapper with pandas DataFrame support Nov 19, 2025
@timosachsenberg
Copy link
Contributor

@copilot also implement store

@timosachsenberg
Copy link
Contributor

@copilot do it! Julianus!!!

Co-authored-by: timosachsenberg <5803621+timosachsenberg@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 19, 2025

@copilot also implement store

Implemented store() method that writes experimental designs to TSV files with full roundtrip support. See commit f9cb0dc.

@copilot do it! Julianus!!!

Done! The store() method is now implemented. You can save experimental designs to TSV files and reload them perfectly. See commit f9cb0dc.

Copilot AI changed the title Add Py_ExperimentalDesign wrapper with pandas DataFrame support Add Py_ExperimentalDesign wrapper with pandas DataFrame and file storage support Nov 19, 2025
@timosachsenberg timosachsenberg marked this pull request as ready for review November 19, 2025 11:19
@timosachsenberg timosachsenberg merged commit 2440581 into master Nov 19, 2025
3 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.

2 participants