Skip to content

Commit

Permalink
Merge branch 'master' into sylph_tax
Browse files Browse the repository at this point in the history
  • Loading branch information
sofstam authored Feb 7, 2025
2 parents 9a8fd52 + c18de39 commit 964a531
Show file tree
Hide file tree
Showing 1,443 changed files with 6,525 additions and 1,465 deletions.
13 changes: 7 additions & 6 deletions .github/actions/get-shards/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ outputs:
total_shards:
description: "Total number of shards"
value: ${{ steps.shards.outputs.total_shards }}

runs:
using: "composite"
steps:
Expand All @@ -26,22 +25,24 @@ runs:
with:
version: ${{ env.NFT_VER }}
install-pdiff: true

- name: Get number of shards
id: shards
shell: bash
run: |
# Prepare tag parameter if tags are provided
TAGS=$([ -n "${{ inputs.tags }}" ] && echo "--tag ${{ inputs.tags }}" || echo "")
# Run nf-test with dynamic tag parameter
# Run nf-test with dynamic parameter
nftest_output=$(nf-test test \
--dry-run \
--profile docker \
${TAGS} \
--filter process,workflow \
${{ inputs.paths }})
${{ inputs.paths }}) || {
echo "nf-test command failed with exit code $?"
echo "Full output: $nftest_output"
exit 1
}
echo "nf-test dry-run output: $nftest_output"
# Default values for shard and total_shards
Expand Down
119 changes: 119 additions & 0 deletions .github/scripts/conda_env_sorter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "ruamel.yaml",
# ]
# ///

"""Sort dependencies in conda environment files."""
# Test with
# uv run --with pytest -- pytest -v .github/scripts/conda_env_sorter.py

import argparse
import sys
from pathlib import Path
from typing import Optional, Sequence

import ruamel.yaml

# Add pytest imports conditionally
if "pytest" in sys.modules:
import pytest

yaml = ruamel.yaml.YAML()
yaml.indent(mapping=2, sequence=2, offset=2) # Set indentation to 2 spaces


def main(argv: Optional[Sequence[str]] = None) -> None:
"""Sort dependencies in conda environment files."""
parser = argparse.ArgumentParser()
parser.add_argument("paths", nargs="*", type=Path)
args = parser.parse_args(argv)
for path in args.paths:
# Read the entire file content
with path.open() as f:
lines = f.readlines()

# Define the schema lines to be added if missing
schema_lines = [
"---\n",
"# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json\n",
]

# Check if the first two lines match the expected schema lines
if lines[:2] == schema_lines:
content = "".join(lines[2:]) # Skip schema lines when reading content
else:
content = "".join(lines) # Use all content if no schema lines present

# Parse the YAML content
doc = yaml.load(content)
dicts = []
others = []

for term in doc["dependencies"]:
if isinstance(term, dict):
dicts.append(term)
else:
others.append(term)
others.sort(key=str)
for dict_term in dicts:
for value in dict_term.values():
if isinstance(value, list):
value.sort(key=str)
dicts.sort(key=str)
doc["dependencies"].clear()
doc["dependencies"].extend(others)
doc["dependencies"].extend(dicts)

# Write back to file with headers
with path.open("w") as f:
# Always write schema lines first
f.writelines(schema_lines)
# Then dump the sorted YAML
yaml.dump(doc, f)


if __name__ == "__main__":
main()

# Pytest tests (only loaded when running pytest)
if "pytest" in sys.modules:

@pytest.mark.parametrize(
"input_content,expected",
[
# Test basic sorting
("dependencies:\n - zlib\n - python\n", ["python", "zlib"]),
# Test dict sorting
("dependencies:\n - pip:\n - b\n - a\n - python\n", ["python", {"pip": ["a", "b"]}]),
# Test existing headers
("---\n# yaml-language-server: $schema=...\ndependencies:\n - b\n - a\n", ["a", "b"]),
],
)
def test_conda_sorter(tmp_path, input_content, expected):
test_file = tmp_path / "environment.yml"
test_file.write_text(input_content)

# Run our sorter on the test file
main([str(test_file)])

# Read back the sorted file
result = test_file.read_text()

# Check schema headers are present
assert result.startswith("---\n# yaml-language-server: $schema=")

# Parse the sorted content (skip first 2 header lines)
parsed = yaml.load("".join(result.splitlines(True)[2:]))

# Compare the actual dependencies structure
assert parsed["dependencies"] == expected

def test_invalid_file(tmp_path):
test_file = tmp_path / "bad.yml"
test_file.write_text("invalid: yaml: here")

with pytest.raises(ruamel.yaml.scanner.ScannerError):
main([str(test_file)])
8 changes: 8 additions & 0 deletions .github/workflows/nf-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,11 @@ jobs:
echo "DEBUG: toJSON(needs.*.result) = ${{ toJSON(needs.*.result) }}"
echo "DEBUG: needs.nf-test.outputs.filtered_paths = ${{ needs.nf-test.outputs.filtered_paths }}"
echo "::endgroup::"
- name: Clean Workspace # Purge the workspace in case it's running on a self-hosted runner
if: always()
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
repos:
- repo: local
hooks:
- id: conda-env-sorter
name: Sort dependencies in conda environment files.
entry: ./.github/scripts/conda_env_sorter.py
language: python
files: environment
types: [yaml]
additional_dependencies: ["ruamel.yaml"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
hooks:
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/abacas/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/abricate/run/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/abricate/summary/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/abritamr/run/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/adapterremoval/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/adapterremovalfixprefix/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/admixture/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/affy/justrma/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/agat/convertbed2gff/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::agat=1.4.2"
- bioconda::agat=1.4.2
2 changes: 2 additions & 0 deletions modules/nf-core/agat/convertspgff2gtf/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/agat/convertspgff2tsv/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/agat/convertspgxf2gxf/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
4 changes: 3 additions & 1 deletion modules/nf-core/agat/spaddintrons/environment.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::agat=1.4.2"
- bioconda::agat=1.4.2
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::agat=1.4.2"
- bioconda::agat=1.4.2
2 changes: 1 addition & 1 deletion modules/nf-core/agat/spmergeannotations/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::agat=1.4.2"
- bioconda::agat=1.4.2
2 changes: 2 additions & 0 deletions modules/nf-core/agat/spstatistics/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/agat/sqstatbasic/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/agrvate/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/ale/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ channels:
- tanghaibao
dependencies:
# renovate: datasource=conda depName=bioconda/ale
- "bioconda::ale=20180904"
- bioconda::ale=20180904
2 changes: 2 additions & 0 deletions modules/nf-core/allelecounter/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/ampcombi/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/ampcombi2/cluster/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::ampcombi=2.0.1"
- bioconda::ampcombi=2.0.1
2 changes: 1 addition & 1 deletion modules/nf-core/ampcombi2/complete/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::ampcombi=2.0.1"
- bioconda::ampcombi=2.0.1
2 changes: 1 addition & 1 deletion modules/nf-core/ampcombi2/parsetables/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::ampcombi=2.0.1"
- bioconda::ampcombi=2.0.1
2 changes: 2 additions & 0 deletions modules/nf-core/ampir/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/amplify/predict/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/amps/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/amrfinderplus/run/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/amrfinderplus/update/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/angsd/contamination/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/angsd/docounts/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
4 changes: 2 additions & 2 deletions modules/nf-core/angsd/gl/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::angsd=0.940"
- "bioconda::htslib=1.17"
- bioconda::angsd=0.940
- bioconda::htslib=1.17
2 changes: 2 additions & 0 deletions modules/nf-core/anndata/barcodes/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/anndata/getsize/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/annotsv/annotsv/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
Loading

0 comments on commit 964a531

Please sign in to comment.