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
58 changes: 28 additions & 30 deletions spimquant/config/snakebids.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,35 +63,12 @@ parse_args:
- MBMv3
- turone

--template_mri:
help: "Template to use for MRI registration to obtain brain mask\n"
default: MouseIn
choices:
- MouseIn
- DSURQE
- MBMv3
- turone

--atlas_segs:
help: "Atlas segmentations to use with the chosen template (default: use them all)"
help: "Atlas segmentations to use with the chosen template (default: predefined list or all)"
default: null
action: store
nargs: '+'

--patch_atlas_segs:
help: "Atlas segmentations to use for extracting patches (default: roi22)"
default:
- roi22
action: store
nargs: '+'



--template_negative_mask:
help: "Negative mask, in the template space, to highlight regions to avoid\n"
type: Path
default: placeholder

--template_crop:
help: "Crop template along X-axis to retain specific hemisphere for registration (default: %(default)s)"
choices:
Expand All @@ -105,13 +82,14 @@ parse_args:
- PI
- YOPRO
- YoPro
- YoPro1
- AutoF
- autof
action: store
nargs: '+'

--stains_for_seg:
help: "List of stains to use for segmentation and quantification\n (default: %(default)s)"
help: "List of stains to use for segmentation and quantification (will segment any that match the data)\n (default: %(default)s)"
default:
- abeta
- Abeta
Expand All @@ -123,19 +101,21 @@ parse_args:
nargs: '+'

--stains_for_vessels:
help: "List of stains to use for vessel segmentation and quantification\n (default: %(default)s)"
help: "List of stains to use for vessel segmentation and quantification (will choose first available, in order)\n (default: %(default)s)"
default:
- CD31
- Lectin
action: store
nargs: '+'

--registration_level:
help: "Downsampling level to use for registration (level 0 is full res, level 1 is 50% size, ...) (default: %(default)s)"
help: "Downsampling level to use for registration (level 0 is full res, level 1 is 50% size, ...) (default: 5)"
type: int
default: 5

--segmentation_level:
help: "Downsampling level to use for segmentation (level 0 is full res, level 1 is 50% size, ...) (default: %(default)s)"
help: "Downsampling level to use for segmentation (including vessels) (level 0 is full res, level 1 is 50% size, ...) (default: 0)"
type: int
default: 0

--no_segmentation:
Expand Down Expand Up @@ -179,6 +159,15 @@ parse_args:
action: store_true
default: False

--template_mri:
help: "Template to use for MRI registration to obtain brain mask\n"
default: MouseIn
choices:
- MouseIn
- DSURQE
- MBMv3
- turone

--mri_resample_percent:
help: "Resampling factor for multi-MRI averaging to create super-resolved images, as a percent (default: %(default)s). Use 200 for upsampling to twice the resolution"
default: 100
Expand Down Expand Up @@ -219,6 +208,14 @@ parse_args:
nargs: 3
type: int

--patch_atlas_segs:
help: "Atlas segmentations to use for extracting patches (default: coarse)"
default:
- coarse
action: store
nargs: '+'


--n_patches_per_label:
help: "Number of patches to extract per atlas label (default: %(default)s)"
default: 5
Expand All @@ -240,11 +237,12 @@ parse_args:
nargs: '+'

--crop_atlas_segs:
help: "Atlas segmentations to use for extracting Imaris crops (default: roi22)"
help: "Atlas segmentations to use for extracting Imaris crops (default: coarse)"
default:
- roi22
- coarse
action: store
nargs: '+'

--contrast_column:
help: "Column name in participants.tsv to use for defining group contrasts (e.g., 'treatment', 'genotype'). Required for group-level statistical analysis."
default: null
Expand Down
2 changes: 1 addition & 1 deletion spimquant/workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tpl_spec = spec[0].copy()
tpl_spec["entity"] = "template"
tpl_spec["tag"] = "tpl"
spec.insert(0, tpl_spec)
snakebids.set_bids_spec(spec)
set_bids_spec(spec)


configfile: "config/snakebids.yml"
Expand Down
2 changes: 1 addition & 1 deletion spimquant/workflow/rules/counts.smk
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ rule coloc_per_voxel_template:
),
threads: 16
resources:
mem_mb=15000,
mem_mb=64000,
runtime=30,
script:
"../scripts/coloc_per_voxel_template.py"
10 changes: 5 additions & 5 deletions spimquant/workflow/rules/regionprops.smk
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ rule colocalize_regionprops:
suffix="coloc.parquet",
**inputs["spim"].wildcards,
),
threads: 1
threads: 16
resources:
mem_mb=1500,
runtime=30,
mem_mb=64000,
runtime=180,
script:
"../scripts/compute_colocalization.py"

Expand Down Expand Up @@ -180,9 +180,9 @@ rule sample_at_vessel_sdt:
suffix="regionprops.parquet",
**inputs["spim"].wildcards,
),
threads: 1
threads: 8
resources:
mem_mb=32000,
runtime=30,
runtime=360,
script:
"../scripts/sample_at_points.py"
35 changes: 0 additions & 35 deletions spimquant/workflow/rules/segmentation.smk
Original file line number Diff line number Diff line change
Expand Up @@ -236,38 +236,3 @@ rule clean_segmentation:
runtime=30,
script:
"../scripts/clean_segmentation.py"


rule deform_negative_mask_to_subject_nii:
input:
ref=bids(
root=root,
datatype="micr",
stain=stain_for_reg,
level="{level}",
suffix="SPIM.nii.gz",
**inputs["spim"].wildcards,
),
mask=config["template_negative_mask"],
xfm_composite_inv=rules.compose_subject_to_template_warp.output.xfm_composite_inv,
output:
mask=bids(
root=root,
datatype="seg",
desc="negative",
level="{level}",
from_="{template}",
suffix="mask.nii.gz",
**inputs["spim"].wildcards,
),
threads: 32
resources:
mem_mb=1500,
runtime=15,
conda:
"../envs/ants.yaml"
shell:
"ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS={threads} "
"antsApplyTransforms -d 3 -v -n NearestNeighbor "
" -i {input.mask} -o {output.mask} "
" -r {input.ref} -t {input.xfm_composite_inv}"
8 changes: 4 additions & 4 deletions spimquant/workflow/rules/segstats.smk
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ rule map_regionprops_to_atlas_rois:
**inputs["spim"].wildcards,
)
),
threads: 1
threads: 4
resources:
mem_mb=1500,
mem_mb=32000,
runtime=15,
script:
"../scripts/map_atlas_to_regionprops.py"
Expand Down Expand Up @@ -84,9 +84,9 @@ rule map_coloc_to_atlas_rois:
**inputs["spim"].wildcards,
)
),
threads: 1
threads: 4
resources:
mem_mb=1500,
mem_mb=32000,
runtime=15,
script:
"../scripts/map_atlas_to_coloc.py"
Expand Down