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
2 changes: 1 addition & 1 deletion .github/auto_assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ numberOfReviewers: 0

# A list of keywords to be skipped the process that add reviewers if pull requests include it
# skipKeywords:
# - wip
# - wip
4 changes: 1 addition & 3 deletions .github/workflows/auto_assign_reviewers.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
---
name: Auto Assign Reviewers

on:
pull_request:
types: [opened, ready_for_review]
pull_request_target:
types: [opened, ready_for_review]

jobs:
assign-reviewer:
uses: khanlab/actions/.github/workflows/workflow-pr_task-assignReviewer.yml@v0.3.4

12 changes: 3 additions & 9 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
---
name: Build and Push Docker Image

on:
push:
branches:
- main
branches: [main]
workflow_dispatch:

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Docker image
run: docker build -t jclauneurolab/autoafids:latest .

- name: Push Docker image
run: docker push jclauneurolab/autoafids:latest
run: docker push jclauneurolab/autoafids:latest
26 changes: 4 additions & 22 deletions .github/workflows/lint-and-dryrun-testing.yml
Original file line number Diff line number Diff line change
@@ -1,85 +1,67 @@
---
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Lint and test workflow
on:
push:
workflow_dispatch:

jobs:
quality:
name: Lint code
runs-on: ubuntu-latest

steps:
- name: Install non-python dependencies
run: |
sudo apt-get install -y graphviz-dev

- name: Setup Python environment
uses: khanlab/actions/.github/actions/action-setup_task-installPyProject@v0.3.6
with:
python-version: "3.10"

python-version: '3.10'
- name: yamlfix
run: poetry run poe yamlfix-check

- name: ruff
run: poetry run poe ruff-lint-check

- name: snakefmt
run: poetry run poe snakefmt-check

test:
runs-on: ubuntu-latest
needs: ["quality"]
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
with:
miniforge-variant: Miniforge3
miniforge-version: latest
mamba-version: "*"
mamba-version: '*'
use-mamba: true
conda-solver: libmamba
auto-activate-base: true

- name: Install snakebids
run: |
mamba install snakebids -c bioconda -c conda-forge -y

- 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 001 -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 001 --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: |
run: |-
./autoafids/run.py test_data/bids_T1w test_out participant --participant-label 001 --fidqc -np
21 changes: 5 additions & 16 deletions .github/workflows/push_conda.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,41 @@
---
# .github/workflows/build-conda.yml

name: Build and Upload Conda Package

on:
push:
branches:
- main
branches: [main]
workflow_dispatch:

jobs:
build-and-upload:
runs-on: ubuntu-latest

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

- name: Cache conda build cache
uses: actions/cache@v3
with:
path: /home/runner/miniconda3/conda-bld
key: ${{ runner.os }}-conda-bld-${{ hashFiles('recipe/meta.yaml') }}
restore-keys: |
${{ runner.os }}-conda-bld-

- name: Setup Miniforge and mamba
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Miniforge3
miniforge-version: latest
mamba-version: "*"
mamba-version: '*'
use-mamba: true
conda-solver: libmamba
auto-activate-base: true

- name: Install dependencies
run: |
mamba install -y -c conda-forge conda-build anaconda-client boa

- name: Get latest commit SHA from main
id: get_sha
run: |
echo "Fetching latest commit on main branch..."
COMMIT_SHA=$(git ls-remote origin refs/heads/main | cut -f1)
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV

- name: Update meta.yaml with latest ref and sha256
run: |
echo "Updating meta.yaml with commit: $COMMIT_SHA"
Expand All @@ -60,22 +51,20 @@ jobs:

# 3) Replace the literal 'sha256:' line under source:
sed -i "s|^\(\s*sha256:\s*\).*|\1$SHA256_SUM|" ./recipe/meta.yaml

- name: Build & capture path
id: build
run: |
cd recipe
OUT=$(conda build . -c conda-forge -c bioconda --output 2>/dev/null)
echo "PACKAGE_PATH=$OUT" >> $GITHUB_ENV
conda mambabuild . -c conda-forge -c bioconda

- name: Upload package to Khanlab channel
shell: bash -l {0}
run: |
run: |-
conda activate base
anaconda login \
--username ${{ secrets.ANACONDA_USERNAME }} \
--password ${{ secrets.ANACONDA_PASSWORD }}
anaconda upload "$PACKAGE_PATH" \
--label main \
--force \
--force \
19 changes: 5 additions & 14 deletions .github/workflows/wetrun-testing.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,57 @@
name: test workflow with wet run
---
name: test workflow with wet run
on:
pull_request:
workflow_dispatch:

jobs:
wetrun_test:
runs-on: ubuntu-latest

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

- name: Setup Miniforge and mamba
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Miniforge3
miniforge-version: latest
mamba-version: "*"
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

- 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
- 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: |
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 @@ -22,4 +22,4 @@ python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
path: .
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Below is a high-level summary of the AutoAFIDs processing pipeline:

- `gen_fcsv` rule is currently sequential and may benefit from AFID-level parallelization
- T1w-like scan synthesis is available (via SynthSR [Iglesias et al., 2023](https://www-science-org.proxy1.lib.uwo.ca/doi/10.1126/sciadv.add3607)) but requires millimetric validation and may not work for all operating systems
- AutoAFIDs does not currently filter for the `desc` entity in BIDS input files, since it outputs files with a fixed, custom `desc` value. Therefore, BIDS input filenames must not include a `desc` field, or the pipeline may fail to resolve inputs correctly.

---

Expand Down
8 changes: 3 additions & 5 deletions autoafids-dev.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
name: autoafids-dev
channels:
- conda-forge
- bioconda
- defaults
channels: [conda-forge, bioconda, defaults]
dependencies:
- python=3.10
- snakebids=0.14.0
Expand All @@ -13,4 +11,4 @@ dependencies:
- snakefmt >=0.8.4,<0.9.0
- yamlfix >=1.11.0,<2.0.0
- pygraphviz ==1.7
- jinja2 >=3.0.3,<4.0.0
- jinja2 >=3.0.3,<4.0.0
4 changes: 1 addition & 3 deletions autoafids/workflow/envs/synthsr.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
name: synthsr
channels: [khanlab, anaconda, conda-forge, defaults]
dependencies:
- python=3.8
- synthsr
dependencies: [python=3.8, synthsr]
5 changes: 3 additions & 2 deletions autoafids/workflow/profiles/default/config.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
use-conda: True
conda-frontend: conda
---
use-conda: true
conda-frontend: conda
5 changes: 3 additions & 2 deletions autoafids/workflow/profiles/docker-conda/config.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
use-conda: True
conda-prefix: /src/conda-envs
---
use-conda: true
conda-prefix: /src/conda-envs
Loading