Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,58 +10,63 @@ jobs:
name: Lint code
runs-on: ubuntu-latest
steps:
- name: Install non-python dependencies
run: |
sudo apt-get install -y graphviz-dev
- name: Clone repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.base_ref }}

- name: Setup Python environment
uses: khanlab/actions/.github/actions/action-setup_task-installPyProject@v0.3.6
uses: prefix-dev/setup-pixi@v0.8.14
with:
python-version: '3.10'
- name: yamlfix
run: poetry run poe yamlfix-check
- name: ruff
run: poetry run poe ruff-lint-check
environments: >-
dev-only
activate-environment: dev-only

- name: isort
run: isort autoafids/*.py -c

- name: Black
run: black autoafids --check

- name: snakefmt
run: poetry run poe snakefmt-check
run: snakefmt autoafids --check
test:
runs-on: ubuntu-latest
needs: [quality]
defaults:
run:
shell: bash -l {0}

steps:
- name: checkout repository
uses: actions/checkout@v4
- name: Setup Miniforge and mamba
uses: conda-incubator/setup-miniconda@v3

- name: Setup Pixi environment
uses: prefix-dev/setup-pixi@v0.8.14
with:
miniforge-variant: Miniforge3
miniforge-version: latest
mamba-version: '*'
use-mamba: true
conda-solver: libmamba
auto-activate-base: true
- name: Install snakebids
run: |
mamba install snakebids appdirs -c bioconda -c conda-forge -y
activate-environment: true

- name: Setup env for autoafids
run: |
echo "AUTOAFIDS_CACHE_DIR=`pwd`/test_data/autoafids_cache_dir" >> $GITHUB_ENV

- name: Test T1w modality
run: |
./autoafids/run.py test_data/bids_T1w test_out participant --participant-label 002 -np

- name: Test T2w modality
run: |
./autoafids/run.py test_data/bids_T2w test_out participant --modality T2w -np -c1

- name: Test CT modality
run: |
./autoafids/run.py test_data/bids_ct test_out participant --modality ct -np -c1

- name: Test stereotaxy feature with T1w modality
run: |
./autoafids/run.py test_data/bids_T1w test_out participant --participant-label 002 --stereotaxy STN -np

- name: Test stereotaxy feature with T2w modality
run: |
./autoafids/run.py test_data/bids_T2w test_out participant --stereotaxy STN --modality T2w -np -c1

- name: Test fidqc feature
run: |-
./autoafids/run.py test_data/bids_T1w test_out participant --participant-label 002 --fidqc -np
25 changes: 11 additions & 14 deletions .github/workflows/wetrun-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,49 +16,46 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Miniforge and mamba
uses: conda-incubator/setup-miniconda@v3


- name: Setup Pixi environment
uses: prefix-dev/setup-pixi@v0.8.14
with:
miniforge-variant: Miniforge3
miniforge-version: latest
mamba-version: '*'
use-mamba: true
conda-solver: libmamba
auto-activate-base: true
- name: Create environment with snakebids
run: |
mamba create -n snakebids-env snakebids scikit-learn pandas -c bioconda -c conda-forge -y
activate-environment: true

- name: Cache Snakemake Conda environments
uses: actions/cache@v4
with:
path: test_data/autoafids_cache_dir/conda
key: conda-env-${{ hashFiles('autoafids/workflow/envs/*.yaml') }}
restore-keys: |
conda-env-

- name: Restore cached CNN model
uses: actions/cache@v4
with:
path: test_data/autoafids_cache_dir/models
key: static-model-cache-v1

- name: Set AUTOAFIDS_CACHE_DIR
run: |
echo "AUTOAFIDS_CACHE_DIR=`pwd`/test_data/autoafids_cache_dir" >> $GITHUB_ENV

- name: Run wet-run test for T1w modality
shell: bash -l {0}
run: |
conda activate snakebids-env
./autoafids/run.py test_data/bids_wetrun_testing/bids_T1w test_out participant \
--cores all --force-output --stereotaxy STN --fidqc --conda-frontend mamba | tee autoafids_output.log

- name: Model accuracy check
shell: bash -l {0}
run: |
conda activate snakebids-env
python ./tests/test_fcsv_output.py \
--autoafids_fcsv ./test_out/sub-001/afids-cnn/*.fcsv \
--baseline_fcsv ./test_data/bids_wetrun_testing/bids_T1w/sub-001/anat/sub-001*.fcsv | tee test_fcsv_output.log

- name: Run wet-run test for T2w modality
shell: bash -l {0}
run: |-
conda activate snakebids-env
./autoafids/run.py test_data/bids_wetrun_testing/bids_T2w test_out participant \
--modality T2w --cores all --force-output --conda-frontend mamba
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ formats: [pdf]
build:
os: ubuntu-20.04
tools:
python: '3.10'
python: '3.11'
python:
install:
- requirements: docs/requirements.txt
Expand Down
9 changes: 3 additions & 6 deletions autoafids/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
from snakebids import bidsapp, plugins

try:
from autoafids.workflow.lib import (
utils as utils, # Works when run as a package
)
from autoafids.workflow.lib import utils as utils # Works when run as a package
except ImportError:
from workflow.lib import utils as utils # Works when run directly

Expand All @@ -27,14 +25,13 @@
conda_prefix = Path(utils.get_download_dir()) / "conda"

# Set templateflow directory
os.environ['TEMPLATEFLOW_HOME'] = str(
Path(utils.get_download_dir()) / "templateflow"
)
os.environ["TEMPLATEFLOW_HOME"] = str(Path(utils.get_download_dir()) / "templateflow")

# Set the environment variable SNAKEMAKE_CONDA_PREFIX if not already set
if "SNAKEMAKE_CONDA_PREFIX" not in os.environ:
os.environ["SNAKEMAKE_CONDA_PREFIX"] = str(conda_prefix)


def get_parser():
"""Exposes parser for sphinx doc generation, cwd is the docs dir"""
return app.build_parser().parser
Expand Down
Loading
Loading