Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions .github/workflows/build-windows-executable-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,6 @@ jobs:
repository: OpenMS/OpenMS
ref: release/${{ env.OPENMS_VERSION }}
path: 'OpenMS'

# Temporary fix - until seqan is back online or new OpenMS release (3.4)
- name: Get latest cibuild.cmake
working-directory: OpenMS
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git fetch origin develop
git checkout origin/develop -- tools/ci/cibuild.cmake
git checkout origin/develop -- tools/ci/citest.cmake
git checkout origin/develop -- tools/ci/cipackage.cmake

- name: Install Qt
uses: jurplel/install-qt-action@v4
Expand Down Expand Up @@ -95,7 +84,7 @@ jobs:
run: |
cd OpenMS/contrib
# Download the file using the URL fetched from GitHub
gh release download -R OpenMS/contrib --pattern 'contrib_build-Windows.tar.gz'
gh release download release/3.2.0 -R OpenMS/contrib --pattern 'contrib_build-Windows.tar.gz'
# Extract the archive
7z x -so contrib_build-Windows.tar.gz | 7z x -si -ttar
rm contrib_build-Windows.tar.gz
Expand Down Expand Up @@ -159,13 +148,13 @@ jobs:
CCACHE_COMPRESSLEVEL: 12
CCACHE_MAXSIZE: 400M

- name: Test Windows
shell: bash
run: ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/citest.cmake
env:
SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS"
CI_PROVIDER: "GitHub-Actions"
BUILD_NAME: "${{ env.RUN_NAME }}-Win64-class-topp-${{ github.run_number }}"
# - name: Test Windows
# shell: bash
# run: ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/citest.cmake
# env:
# SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS"
# CI_PROVIDER: "GitHub-Actions"
# BUILD_NAME: "${{ env.RUN_NAME }}-Win64-class-topp-${{ github.run_number }}"

- name: Package
shell: bash
Expand Down
234 changes: 234 additions & 0 deletions .github/workflows/peptide-calculator-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
name: Peptide Calculator Tests

on:
push:
branches: [ "main", "week-*" ]
paths:
- 'src/peptide_calculator.py'
- 'tests/test_*.py'
- 'content/quickstart.py'
pull_request:
branches: [ "main" ]
paths:
- 'src/peptide_calculator.py'
- 'tests/test_*.py'
- 'content/quickstart.py'
workflow_dispatch:

jobs:
peptide-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Comment thread
achalbajpai marked this conversation as resolved.
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-peptide-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-peptide-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov pytest-mock pytest-benchmark

- name: Run peptide calculator unit tests
run: |
pytest tests/test_calculation.py -v --cov=src.peptide_calculator
pytest tests/test_validation.py -v --cov=src.peptide_calculator --cov-append
pytest tests/test_parsing.py -v --cov=src.peptide_calculator --cov-append
pytest tests/test_modifications.py -v --cov=src.peptide_calculator --cov-append
env:
PYTHONPATH: .

- name: Run integration tests
run: |
pytest tests/test_integration_comprehensive.py -v
env:
PYTHONPATH: .

- name: Run analysis utilities tests
run: |
pytest tests/test_analysis_utilities.py -v
env:
PYTHONPATH: .

- name: Run workflow tests
run: |
pytest tests/test_topp_workflow_parameter.py -v
env:
PYTHONPATH: .

- name: Test peptide calculator performance
run: |
python -c "
import sys
import time
sys.path.insert(0, '.')
from src.peptide_calculator import calculate_peptide_mz

# Performance test
successful_runs = 0
start = time.time()
for i in range(10): # Reduced from 100 to 10 for CI stability
result = calculate_peptide_mz('PEPTIDE', 2)
if result.get('success', False):
successful_runs += 1
end = time.time()

if successful_runs > 0:
avg_time = (end - start) / successful_runs
print(f'Average calculation time: {avg_time:.4f}s ({successful_runs}/10 successful)')
# More lenient timing for CI environment
if avg_time > 1.0:
print(f'Warning: Performance may be slow in CI: {avg_time}s > 1.0s')
else:
print('Warning: No successful calculations in performance test')
"

- name: Test edge cases and error handling
run: |
python -c "
import sys
sys.path.insert(0, '.')
from src.peptide_calculator import calculate_peptide_mz, validate_peptide_sequence

# Test edge cases
try:
result = calculate_peptide_mz('', 2)
if result.get('success', True): # Should fail
print('Warning: Empty sequence should fail')
except (ValueError, Exception) as e:
print(f'Empty sequence correctly failed: {type(e).__name__}')

try:
result = calculate_peptide_mz('INVALIDX', 0)
if result.get('success', True): # Should fail
print('Warning: Invalid sequence/charge should fail')
except (ValueError, Exception) as e:
print(f'Invalid input correctly failed: {type(e).__name__}')

# Test validation
try:
valid, clean = validate_peptide_sequence('PEPTIDE')
print(f'Valid sequence test: valid={valid}, clean={clean}')

valid2, clean2 = validate_peptide_sequence('PEPT1DE')
print(f'Invalid sequence test: valid={valid2}, clean={clean2}')
except Exception as e:
print(f'Validation test exception: {e}')

print('Edge case tests completed!')
"

- name: Test ProForma and UNIMOD support
run: |
python -c "
import sys
sys.path.insert(0, '.')
from src.peptide_calculator import calculate_peptide_mz

# Test ProForma arbitrary mass shifts
try:
result1 = calculate_peptide_mz('PEPTIDE[+15.9949]', 2)
if result1.get('success', False):
print(f'ProForma test: {result1[\"mz_ratio\"]:.4f}')
else:
print('ProForma test failed but continuing...')
except Exception as e:
print(f'ProForma test exception: {e}')

# Test UNIMOD notation
try:
result2 = calculate_peptide_mz('C[UNIMOD:4]PEPTIDE', 2)
if result2.get('success', False):
print(f'UNIMOD test: {result2[\"mz_ratio\"]:.4f}')
else:
print('UNIMOD test failed but continuing...')
except Exception as e:
print(f'UNIMOD test exception: {e}')

# Test charge notation
try:
result3 = calculate_peptide_mz('PEPTIDE/3', 2)
if result3.get('success', False) and result3.get('charge_state') == 3:
print(f'Charge notation test: charge={result3[\"charge_state\"]}')
else:
print('Charge test failed but continuing...')
except Exception as e:
print(f'Charge test exception: {e}')

print('Advanced notation tests completed!')
"

- name: Generate test coverage report
if: matrix.python-version == '3.10'
run: |
pytest tests/test_*.py --cov=src.peptide_calculator --cov-report=html --cov-report=xml

- name: Upload coverage to artifacts
if: matrix.python-version == '3.10'
uses: actions/upload-artifact@v4
with:
name: peptide-calculator-coverage
path: |
htmlcov/
coverage.xml

functional-tests:
runs-on: ubuntu-latest
needs: peptide-tests
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install selenium pytest
sudo apt-get update
sudo apt-get install -y chromium-browser xvfb

- name: Run GUI tests
run: |
pytest test_gui.py -v
env:
PYTHONPATH: .

- name: Test Streamlit app functionality
run: |
# Start Streamlit app in background
streamlit run content/quickstart.py --server.headless true --server.port 8501 &
STREAMLIT_PID=$!

# Wait for app to start
sleep 10

# Test if app is accessible
curl -f http://localhost:8501 || exit 1

# Kill Streamlit process
kill $STREAMLIT_PID

echo "Streamlit app functional test passed!"
env:
PYTHONPATH: .
16 changes: 10 additions & 6 deletions .github/workflows/workflow-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Test workflow functions

on:
push:
branches: [ "main" ]
branches: [ "main", "week-*" ]
pull_request:
branches: [ "main" ]

jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -20,9 +20,13 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
- name: Running test cases
- name: Run unit tests
run: |
pytest test.py
- name: Running GUI tests
pytest tests/ -v
env:
PYTHONPATH: .
- name: Run GUI tests
run: |
pytest test_gui.py
pytest test_gui.py -v
env:
PYTHONPATH: .
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ SHELL ["mamba", "run", "-n", "streamlit-env", "/bin/bash", "-c"]

# Install up-to-date cmake via mamba and packages for pyOpenMS build.
RUN mamba install cmake
RUN pip install --upgrade pip && python -m pip install -U setuptools nose 'cython<3.1' autowrap pandas numpy pytest
RUN pip install --upgrade pip && python -m pip install -U setuptools nose 'cython<3.1' 'autowrap<0.23' pandas numpy pytest

# Clone OpenMS branch and the associcated contrib+thirdparties+pyOpenMS-doc submodules.
RUN git clone --recursive --depth=1 -b ${OPENMS_BRANCH} --single-branch ${OPENMS_REPO} && cd /OpenMS
Expand Down
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
# OpenMS streamlit template

[![Open Template!](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://abi-services.cs.uni-tuebingen.de/streamlit-template/)
<div align="center">
<img src="assets/openms_transparent_bg_logo.svg" alt="OpenMS Logo" width="200" height="200" />
<h3 align="center">OpenMS Peptide m/z Calculator</h3>
<p align="center">An open-source tool for calculating peptide m/z values.</p>
</div>

This repository contains a template app for OpenMS workflows in a web application using the **streamlit** framework. It serves as a foundation for apps ranging from simple workflows with **pyOpenMS** to complex workflows utilizing **OpenMS TOPP tools** with parallel execution. It includes solutions for handling user data and parameters in workspaces as well as deployment with docker-compose.
<p align="center">
<a href="https://github.com/achalbajpai/peptide-mz-calculator/issues">Report Bug/Feature</a> •
<a href="https://github.com/achalbajpai/peptide-mz-calculator/pulls">Submit Code Changes</a>
</p>

## Features

- Workspaces for user data with unique shareable IDs
- Persistent parameters and input files within a workspace
- local and online mode
- Captcha control
- Packaged executables for Windows
- framework for workflows with OpenMS TOPP tools
- Deployment [with docker-compose](https://github.com/OpenMS/streamlit-deployment)
# 📋 Overview

## Documentation
## 📖 Citation

Documentation for **users** and **developers** is included as pages in [this template app](https://abi-services.cs.uni-tuebingen.de/streamlit-template/), indicated by the 📖 icon.
If you use this work, please cite:

## Citation
```
Müller, T. D., Siraj, A., et al. OpenMS WebApps: Building User-Friendly Solutions for MS Analysis.
Journal of Proteome Research (2025).
https://doi.org/10.1021/acs.jproteome.4c00872
```

Please cite:
Müller, T. D., Siraj, A., et al. OpenMS WebApps: Building User-Friendly Solutions for MS Analysis. Journal of Proteome Research (2025). [https://doi.org/10.1021/acs.jproteome.4c00872](https://doi.org/10.1021/acs.jproteome.4c00872)
## 📚 References

## References
This work builds upon the following publications:

- Pfeuffer, J., Bielow, C., Wein, S. et al. OpenMS 3 enables reproducible analysis of large-scale mass spectrometry data. Nat Methods 21, 365–367 (2024). [https://doi.org/10.1038/s41592-024-02197-7](https://doi.org/10.1038/s41592-024-02197-7)

- Röst HL, Schmitt U, Aebersold R, Malmström L. pyOpenMS: a Python-based interface to the OpenMS mass-spectrometry algorithm library. Proteomics. 2014 Jan;14(1):74-7. [https://doi.org/10.1002/pmic.201300246](https://doi.org/10.1002/pmic.201300246). PMID: [24420968](https://pubmed.ncbi.nlm.nih.gov/24420968/).
1. **Pfeuffer, J., Bielow, C., Wein, S. et al.** (2024). OpenMS 3 enables reproducible analysis of large-scale mass spectrometry data. *Nature Methods*, 21, 365–367. https://doi.org/10.1038/s41592-024-02197-7

2. **Röst, H. L., Schmitt, U., Aebersold, R., & Malmström, L.** (2014). pyOpenMS: a Python-based interface to the OpenMS mass-spectrometry algorithm library. *Proteomics*, 14(1), 74-77. https://doi.org/10.1002/pmic.201300246 | PubMed: [24420968](https://pubmed.ncbi.nlm.nih.gov/24420968/)

Loading
Loading