From 70728b3944cc1eaece5b9df572818e8726a5f378 Mon Sep 17 00:00:00 2001 From: mackenziesnyder Date: Fri, 20 Jun 2025 11:51:55 -0400 Subject: [PATCH 1/2] Add sentence to readme about desc in input file issue --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2208b16..082387a 100644 --- a/README.md +++ b/README.md @@ -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. --- From 9429e89c6eab1de89f138de87fbef1ac05a99b7c Mon Sep 17 00:00:00 2001 From: mackenziesnyder Date: Fri, 20 Jun 2025 11:53:22 -0400 Subject: [PATCH 2/2] run poe quality --- .github/auto_assign.yml | 2 +- .github/workflows/auto_assign_reviewers.yml | 4 +-- .github/workflows/build_docker.yml | 12 +++------ .github/workflows/lint-and-dryrun-testing.yml | 26 +++---------------- .github/workflows/push_conda.yml | 21 ++++----------- .github/workflows/wetrun-testing.yml | 19 ++++---------- .readthedocs.yaml | 2 +- autoafids-dev.yml | 8 +++--- autoafids/workflow/envs/synthsr.yaml | 4 +-- .../workflow/profiles/default/config.yaml | 5 ++-- .../profiles/docker-conda/config.yaml | 5 ++-- 11 files changed, 30 insertions(+), 78 deletions(-) diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml index f284363..0ba2e3a 100644 --- a/.github/auto_assign.yml +++ b/.github/auto_assign.yml @@ -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 \ No newline at end of file +# - wip diff --git a/.github/workflows/auto_assign_reviewers.yml b/.github/workflows/auto_assign_reviewers.yml index a5ef41d..1ad7cec 100644 --- a/.github/workflows/auto_assign_reviewers.yml +++ b/.github/workflows/auto_assign_reviewers.yml @@ -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 - diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index 7a4b30f..d78130a 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -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 \ No newline at end of file + run: docker push jclauneurolab/autoafids:latest diff --git a/.github/workflows/lint-and-dryrun-testing.yml b/.github/workflows/lint-and-dryrun-testing.yml index 5d2c56f..c10af65 100644 --- a/.github/workflows/lint-and-dryrun-testing.yml +++ b/.github/workflows/lint-and-dryrun-testing.yml @@ -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 diff --git a/.github/workflows/push_conda.yml b/.github/workflows/push_conda.yml index 6c203e4..0e2fb8b 100644 --- a/.github/workflows/push_conda.yml +++ b/.github/workflows/push_conda.yml @@ -1,21 +1,16 @@ +--- # .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: @@ -23,28 +18,24 @@ jobs: 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" @@ -60,7 +51,6 @@ 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: | @@ -68,14 +58,13 @@ jobs: 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 \ \ No newline at end of file + --force \ diff --git a/.github/workflows/wetrun-testing.yml b/.github/workflows/wetrun-testing.yml index 9bad3f3..28da489 100644 --- a/.github/workflows/wetrun-testing.yml +++ b/.github/workflows/wetrun-testing.yml @@ -1,30 +1,26 @@ -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: @@ -32,35 +28,30 @@ jobs: 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 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index de0ec1b..8fa269d 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -22,4 +22,4 @@ python: install: - requirements: docs/requirements.txt - method: pip - path: . \ No newline at end of file + path: . diff --git a/autoafids-dev.yml b/autoafids-dev.yml index 6bb7071..ba145a6 100644 --- a/autoafids-dev.yml +++ b/autoafids-dev.yml @@ -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 @@ -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 \ No newline at end of file + - jinja2 >=3.0.3,<4.0.0 diff --git a/autoafids/workflow/envs/synthsr.yaml b/autoafids/workflow/envs/synthsr.yaml index 8d4d23c..e1ca879 100644 --- a/autoafids/workflow/envs/synthsr.yaml +++ b/autoafids/workflow/envs/synthsr.yaml @@ -1,6 +1,4 @@ --- name: synthsr channels: [khanlab, anaconda, conda-forge, defaults] -dependencies: - - python=3.8 - - synthsr +dependencies: [python=3.8, synthsr] diff --git a/autoafids/workflow/profiles/default/config.yaml b/autoafids/workflow/profiles/default/config.yaml index ff2790c..59a1be6 100644 --- a/autoafids/workflow/profiles/default/config.yaml +++ b/autoafids/workflow/profiles/default/config.yaml @@ -1,2 +1,3 @@ -use-conda: True -conda-frontend: conda \ No newline at end of file +--- +use-conda: true +conda-frontend: conda diff --git a/autoafids/workflow/profiles/docker-conda/config.yaml b/autoafids/workflow/profiles/docker-conda/config.yaml index dd55c85..df95328 100644 --- a/autoafids/workflow/profiles/docker-conda/config.yaml +++ b/autoafids/workflow/profiles/docker-conda/config.yaml @@ -1,2 +1,3 @@ -use-conda: True -conda-prefix: /src/conda-envs \ No newline at end of file +--- +use-conda: true +conda-prefix: /src/conda-envs