This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| hours=6 | |
| mem=128000 | |
| gpus=1 | |
| cpus=32 | |
| if [ "$#" -lt 2 ] | |
| then | |
| echo "Usage $0 RULE_NAME NUM_BATCHES <optional snakemake args>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| input_images = ['A','B','C'] | |
| shell('touch {input_images}') | |
| max_iters = 4 | |
| #need this to make sure iterations don't go below 0! | |
| wildcard_constraints: | |
| iteration="[0-9]+" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from os.path import join | |
| configfile: 'config.yml' | |
| container: config['container'] | |
| rule create_protocol: | |
| input: | |
| bvec = join(config['in_dir'],config['bvec']), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def bids (root=None, prefix=None, suffix=None, subject=None, session=None,include_subject_dir=True,include_session_dir=True,**entities): | |
| """Helper function for generating bids paths for snakemake workflows | |
| File path is of the form: | |
| [root]/[sub-{subject}]/[ses-{session]/[prefix]_[sub-{subject}]_[ses-{session}]_[{key}-{val}_ ... ]_[suffix] | |
| root -- root folder to include in the path (e.g. 'results')) | |
| prefix -- string to prepend to the file name (typically not defined, unless you want tpl-{tpl}, or a subfolder) | |
| suffix -- bids suffix including extension (e.g. 'T1w.nii.gz') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bids_dir: '/path/to/bids_dir' | |
| output_dir: '/path/to/output_dir' | |
| #enable printing debug statements during parsing -- disable if generating dag visualization | |
| debug: False | |
| derivatives: False #will search in bids/derivatives if True; can also be path(s) to derivatives datasets | |
| #list of analysis levels in the bids app | |
| analysis_levels: &analysis_levels |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from snakebids.utils.snakemake_io import glob_wildcards | |
| configfile: 'config.yml' | |
| subject,session,task = glob_wildcards(config['bold']) | |
| print(subject) | |
| print(session) | |
| print(task) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import nibabel as nib | |
| subjects = ['01'] | |
| hemis = ['L','R'] | |
| subfield_labels={1:'Sub',2:'CA1',3:'CA2',4:'CA3',5:'CA4'} | |
| hipp_metrics = ['thickness','gyrification'] | |
| dentate_metrics = ['gyrification'] | |
| with open('table.csv','w') as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| subjects,=glob_wildcards('sub-{subject}/qc.html') | |
| print(subjects) | |
| snaps,=glob_wildcards(f'sub-{subjects[0]}/{{snap}}.png') | |
| print(snaps) | |
| rule all: | |
| input: | |
| expand('{ext}s/{snap}.{ext}',ext=['gif','pdf'],snap=snaps) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rule screenshot_unfold: | |
| input: | |
| surf_gii=bids( | |
| root=work, | |
| datatype="surf", | |
| suffix="midthickness.surf.gii", | |
| desc="nostruct", | |
| space="unfold", | |
| hemi="{hemi}", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| shopt -s expand_aliases | |
| alias osf='uvx --from osfclient osf' | |
| CACHE_DIR=".osfcli.cache" | |
| CACHE_FILE="${CACHE_DIR}/filelist.txt" | |
| CACHE_TTL=3600 |
OlderNewer