Skip to content
Open
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ repos:
- id: check-json
# spell check
- repo: https://github.com/codespell-project/codespell
rev: v2.4.2
rev: v2.4.3
hooks:
- id: codespell
args: [-I, .github/WORDLIST]
# Python formatting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.12
rev: v0.16.8
hooks:
- id: ruff-check
args: [--fix]
Expand Down
30 changes: 15 additions & 15 deletions src/galaxysynth/galaxy_xml_synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
Galaxy XML Synthesizer - Generates Galaxy tool XML from blueprint JSON files.
"""

import json
import xml.etree.ElementTree as ET
from xml.dom import minidom
from pathlib import Path
from typing import Dict, List, Any, Optional
import argparse
import json
import os
import re
import sys
import subprocess
import sys
import xml.etree.ElementTree as ET
from collections import OrderedDict
from pathlib import Path
from typing import Any
from xml.dom import minidom

from .util import get_version, match_semver

Expand All @@ -35,7 +35,7 @@ class GalaxyXMLSynthesizer:

def __init__(
self,
blueprint: Dict[str, Any],
blueprint: dict[str, Any],
docker_image: str = "nciccbr/mosuite:latest",
citation_doi: str = "10.5281/zenodo.16371580",
repo_name: str = "CCBR/MOSuite-Galaxy",
Expand Down Expand Up @@ -112,7 +112,7 @@ def _clean_text(self, text: str) -> str:
text = text.replace("\\n", " ")
return text.strip()

def _extract_docker_tag(self, docker_image: str) -> Optional[str]:
def _extract_docker_tag(self, docker_image: str) -> str | None:
"""Grab the tag portion from the docker image string."""
if not docker_image:
return None
Expand All @@ -125,10 +125,10 @@ def _extract_docker_tag(self, docker_image: str) -> Optional[str]:
# No explicit tag present; assume latest
return "latest"

def _get_git_short_sha(self) -> Optional[str]:
def _get_git_short_sha(self) -> str | None:
"""Return short git SHA using repo root, cwd, then GITHUB_SHA fallback."""

def normalize_short_sha(value: Optional[str]) -> Optional[str]:
def normalize_short_sha(value: str | None) -> str | None:
if not value:
return None
candidate = value.strip()
Expand Down Expand Up @@ -166,7 +166,7 @@ def _add_sanitizer(
self,
param: ET.Element,
param_key: str,
custom_config: Optional[Dict[str, Any]] = None,
custom_config: dict[str, Any] | None = None,
):
"""
Add sanitizer configuration to a parameter.
Expand Down Expand Up @@ -275,7 +275,7 @@ def _add_command(self, tool: ET.Element, tool_id: str):
command.set("detect_errors", "exit_code")
command.text = f"<![CDATA[{full_command}]]>"

def _group_parameters(self) -> Dict[Optional[str], List[Dict]]:
def _group_parameters(self) -> dict[str | None, list[dict]]:
"""Group parameters by their paramGroup field."""
groups = OrderedDict()

Expand Down Expand Up @@ -421,7 +421,7 @@ def _add_inputs(self, tool: ET.Element):
elif item_type == "column":
self._add_column(section, item)

def _add_dataset_param(self, parent: ET.Element, dataset: Dict[str, Any]):
def _add_dataset_param(self, parent: ET.Element, dataset: dict[str, Any]):
"""Add dataset parameter."""
param = ET.SubElement(parent, "param")
param.set("name", dataset["key"])
Expand All @@ -441,7 +441,7 @@ def _add_dataset_param(self, parent: ET.Element, dataset: Dict[str, Any]):
if dataset.get("description"):
param.set("help", dataset["description"])

def _add_parameter(self, parent: ET.Element, param_def: Dict[str, Any]):
def _add_parameter(self, parent: ET.Element, param_def: dict[str, Any]):
"""Add parameter based on type with proper datatype handling and sanitizer support."""
param_type = param_def.get("paramType", "STRING")
param_key = param_def.get("key")
Expand Down Expand Up @@ -599,7 +599,7 @@ def _add_parameter(self, parent: ET.Element, param_def: Dict[str, Any]):
# Check if this STRING parameter needs special sanitizer
self._add_sanitizer(param, param_key, sanitizer_config)

def _add_column(self, parent: ET.Element, column: Dict[str, Any]):
def _add_column(self, parent: ET.Element, column: dict[str, Any]):
"""Add column parameter - using repeat for multi-value columns with sanitizer support."""
param_key = column.get("key")
display_name = column.get("displayName", param_key)
Expand Down
2 changes: 1 addition & 1 deletion src/galaxysynth/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Utility functions for the package
"""

import re
import pathlib
import re


def repo_base(*paths):
Expand Down
2 changes: 1 addition & 1 deletion templates/3_galaxy-tools/batch_correction.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Perform batch correction using sva::ComBat()
**Version info**

- Docker: nciccbr/mosuite:v0.3.0
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/fa69b26)
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/b40e00d)

]]></help>
<citations>
Expand Down
2 changes: 1 addition & 1 deletion templates/3_galaxy-tools/clean_raw_counts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ corrected. If your sample names are corrected here, be sure to make equivalent c
**Version info**

- Docker: nciccbr/mosuite:v0.3.0
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/fa69b26)
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/b40e00d)

]]></help>
<citations>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Construct a multiOmicDataSet object from text files (e.g. TSV, CSV).
**Version info**

- Docker: nciccbr/mosuite:v0.3.0
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/fa69b26)
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/b40e00d)

]]></help>
<citations>
Expand Down
2 changes: 1 addition & 1 deletion templates/3_galaxy-tools/differential_analysis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Differential expression analysis
**Version info**

- Docker: nciccbr/mosuite:v0.3.0
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/fa69b26)
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/b40e00d)

]]></help>
<citations>
Expand Down
2 changes: 1 addition & 1 deletion templates/3_galaxy-tools/filter_differential_features.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ estimates and for sub-setting of contrasts and groups included in the output gen
**Version info**

- Docker: nciccbr/mosuite:v0.3.0
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/fa69b26)
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/b40e00d)

]]></help>
<citations>
Expand Down
2 changes: 1 addition & 1 deletion templates/3_galaxy-tools/filter_low_counts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ another based on unsupervised clustering.
**Version info**

- Docker: nciccbr/mosuite:v0.3.0
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/fa69b26)
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/b40e00d)

]]></help>
<citations>
Expand Down
2 changes: 1 addition & 1 deletion templates/3_galaxy-tools/normalization.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Normalize counts
**Version info**

- Docker: nciccbr/mosuite:v0.3.0
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/fa69b26)
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/b40e00d)

]]></help>
<citations>
Expand Down
2 changes: 1 addition & 1 deletion templates/3_galaxy-tools/pca_2d.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Perform and plot a 2D Principal Components Analysis
**Version info**

- Docker: nciccbr/mosuite:v0.3.0
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/fa69b26)
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/b40e00d)

]]></help>
<citations>
Expand Down
2 changes: 1 addition & 1 deletion templates/3_galaxy-tools/pca_3d.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Runs `MOSuite::plot_pca_3d()` - https://ccbr.github.io/MOSuite/reference/plot_pc
**Version info**

- Docker: nciccbr/mosuite:v0.3.0
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/fa69b26)
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/b40e00d)

]]></help>
<citations>
Expand Down
2 changes: 1 addition & 1 deletion templates/3_galaxy-tools/plot_expression_heatmap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ this heatmap if you explore the advanced options.
**Version info**

- Docker: nciccbr/mosuite:v0.3.0
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/fa69b26)
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/b40e00d)

]]></help>
<citations>
Expand Down
2 changes: 1 addition & 1 deletion templates/3_galaxy-tools/plot_volcano_-_enhanced.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ list(list("https://bioconductor.org/packages/release/bioc/html/EnhancedVolcano.h
**Version info**

- Docker: nciccbr/mosuite:v0.3.0
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/fa69b26)
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/b40e00d)

]]></help>
<citations>
Expand Down
2 changes: 1 addition & 1 deletion templates/3_galaxy-tools/plot_volcano_-_summary.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4777,7 +4777,7 @@ useful to the Venn diagram template downstream.
**Version info**

- Docker: nciccbr/mosuite:v0.3.0
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/fa69b26)
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/b40e00d)

]]></help>
<citations>
Expand Down
2 changes: 1 addition & 1 deletion templates/3_galaxy-tools/venn_diagram.xml
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ specified intersections.
**Version info**

- Docker: nciccbr/mosuite:v0.3.0
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/fa69b26)
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/b40e00d)

]]></help>
<citations>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Properties that are data frames are saved as CSV files, while all other objects
**Version info**

- Docker: nciccbr/mosuite:v0.3.0
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/fa69b26)
- GitHub: [CCBR/MOSuite-Galaxy 0.1.0-alpha](https://github.com/CCBR/MOSuite-Galaxy/tree/b40e00d)

]]></help>
<citations>
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tests/test_cli.py
import shutil
import subprocess
import sys
import shutil

from galaxysynth.util import get_version

Expand Down
11 changes: 6 additions & 5 deletions tests/test_format_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@
"""

import json
import pytest
import sys
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import patch

import pytest

# Import the format_values module
sys.path.insert(0, str(Path(__file__).parent.parent / "templates" / "3_galaxy-tools"))
from format_values import (
normalize_boolean,
extract_list_from_repeat,
parse_delimited_text,
inject_output_configuration,
process_galaxy_params,
flatten_json,
inject_output_configuration,
main,
normalize_boolean,
parse_delimited_text,
process_galaxy_params,
)


Expand Down
13 changes: 7 additions & 6 deletions tests/test_galaxy_xml_synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
- Edge cases
"""

import pytest
import json
import xml.etree.ElementTree as ET
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import patch

import pytest

from galaxysynth.galaxy_xml_synthesizer import (
GalaxyXMLSynthesizer,
process_blueprint,
batch_process,
process_blueprint,
)


Expand Down Expand Up @@ -572,8 +573,8 @@ def test_generate_help_release_links_to_version_tag(self):
class _MatchNoPrerelease:
def group(self, name):
if name == "prerelease":
return None
return None
return
return

synth = GalaxyXMLSynthesizer(
{
Expand Down Expand Up @@ -647,8 +648,8 @@ def test_generate_help_without_git_sha_uses_plain_text(self):
class _MatchNoPrerelease:
def group(self, name):
if name == "prerelease":
return None
return None
return
return

synth = GalaxyXMLSynthesizer(
{
Expand Down
5 changes: 3 additions & 2 deletions tests/test_needs_regeneration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
- Edge cases and error handling
"""

import pytest
import json
import time
import xml.etree.ElementTree as ET
from pathlib import Path
from tempfile import TemporaryDirectory
import time

import pytest

from galaxysynth.galaxy_xml_synthesizer import (
needs_regeneration,
Expand Down
Loading