Skip to content

Commit 79f062a

Browse files
authored
Merge pull request #143 from khanlab/coloc-resources
resource updates for coloc run
2 parents 6deed05 + 4ee1688 commit 79f062a

6 files changed

Lines changed: 39 additions & 76 deletions

File tree

spimquant/config/snakebids.yml

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -63,35 +63,12 @@ parse_args:
6363
- MBMv3
6464
- turone
6565

66-
--template_mri:
67-
help: "Template to use for MRI registration to obtain brain mask\n"
68-
default: MouseIn
69-
choices:
70-
- MouseIn
71-
- DSURQE
72-
- MBMv3
73-
- turone
74-
7566
--atlas_segs:
76-
help: "Atlas segmentations to use with the chosen template (default: use them all)"
67+
help: "Atlas segmentations to use with the chosen template (default: predefined list or all)"
7768
default: null
7869
action: store
7970
nargs: '+'
8071

81-
--patch_atlas_segs:
82-
help: "Atlas segmentations to use for extracting patches (default: roi22)"
83-
default:
84-
- roi22
85-
action: store
86-
nargs: '+'
87-
88-
89-
90-
--template_negative_mask:
91-
help: "Negative mask, in the template space, to highlight regions to avoid\n"
92-
type: Path
93-
default: placeholder
94-
9572
--template_crop:
9673
help: "Crop template along X-axis to retain specific hemisphere for registration (default: %(default)s)"
9774
choices:
@@ -105,13 +82,14 @@ parse_args:
10582
- PI
10683
- YOPRO
10784
- YoPro
85+
- YoPro1
10886
- AutoF
10987
- autof
11088
action: store
11189
nargs: '+'
11290

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

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

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

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

141121
--no_segmentation:
@@ -179,6 +159,15 @@ parse_args:
179159
action: store_true
180160
default: False
181161

162+
--template_mri:
163+
help: "Template to use for MRI registration to obtain brain mask\n"
164+
default: MouseIn
165+
choices:
166+
- MouseIn
167+
- DSURQE
168+
- MBMv3
169+
- turone
170+
182171
--mri_resample_percent:
183172
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"
184173
default: 100
@@ -219,6 +208,14 @@ parse_args:
219208
nargs: 3
220209
type: int
221210

211+
--patch_atlas_segs:
212+
help: "Atlas segmentations to use for extracting patches (default: coarse)"
213+
default:
214+
- coarse
215+
action: store
216+
nargs: '+'
217+
218+
222219
--n_patches_per_label:
223220
help: "Number of patches to extract per atlas label (default: %(default)s)"
224221
default: 5
@@ -240,11 +237,12 @@ parse_args:
240237
nargs: '+'
241238

242239
--crop_atlas_segs:
243-
help: "Atlas segmentations to use for extracting Imaris crops (default: roi22)"
240+
help: "Atlas segmentations to use for extracting Imaris crops (default: coarse)"
244241
default:
245-
- roi22
242+
- coarse
246243
action: store
247244
nargs: '+'
245+
248246
--contrast_column:
249247
help: "Column name in participants.tsv to use for defining group contrasts (e.g., 'treatment', 'genotype'). Required for group-level statistical analysis."
250248
default: null

spimquant/workflow/Snakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ tpl_spec = spec[0].copy()
1111
tpl_spec["entity"] = "template"
1212
tpl_spec["tag"] = "tpl"
1313
spec.insert(0, tpl_spec)
14-
snakebids.set_bids_spec(spec)
14+
set_bids_spec(spec)
1515

1616

1717
configfile: "config/snakebids.yml"

spimquant/workflow/rules/counts.smk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ rule coloc_per_voxel_template:
9090
),
9191
threads: 16
9292
resources:
93-
mem_mb=15000,
93+
mem_mb=64000,
9494
runtime=30,
9595
script:
9696
"../scripts/coloc_per_voxel_template.py"

spimquant/workflow/rules/regionprops.smk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ rule colocalize_regionprops:
134134
suffix="coloc.parquet",
135135
**inputs["spim"].wildcards,
136136
),
137-
threads: 1
137+
threads: 16
138138
resources:
139-
mem_mb=1500,
140-
runtime=30,
139+
mem_mb=64000,
140+
runtime=180,
141141
script:
142142
"../scripts/compute_colocalization.py"
143143

@@ -180,9 +180,9 @@ rule sample_at_vessel_sdt:
180180
suffix="regionprops.parquet",
181181
**inputs["spim"].wildcards,
182182
),
183-
threads: 1
183+
threads: 8
184184
resources:
185185
mem_mb=32000,
186-
runtime=30,
186+
runtime=360,
187187
script:
188188
"../scripts/sample_at_points.py"

spimquant/workflow/rules/segmentation.smk

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -236,38 +236,3 @@ rule clean_segmentation:
236236
runtime=30,
237237
script:
238238
"../scripts/clean_segmentation.py"
239-
240-
241-
rule deform_negative_mask_to_subject_nii:
242-
input:
243-
ref=bids(
244-
root=root,
245-
datatype="micr",
246-
stain=stain_for_reg,
247-
level="{level}",
248-
suffix="SPIM.nii.gz",
249-
**inputs["spim"].wildcards,
250-
),
251-
mask=config["template_negative_mask"],
252-
xfm_composite_inv=rules.compose_subject_to_template_warp.output.xfm_composite_inv,
253-
output:
254-
mask=bids(
255-
root=root,
256-
datatype="seg",
257-
desc="negative",
258-
level="{level}",
259-
from_="{template}",
260-
suffix="mask.nii.gz",
261-
**inputs["spim"].wildcards,
262-
),
263-
threads: 32
264-
resources:
265-
mem_mb=1500,
266-
runtime=15,
267-
conda:
268-
"../envs/ants.yaml"
269-
shell:
270-
"ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS={threads} "
271-
"antsApplyTransforms -d 3 -v -n NearestNeighbor "
272-
" -i {input.mask} -o {output.mask} "
273-
" -r {input.ref} -t {input.xfm_composite_inv}"

spimquant/workflow/rules/segstats.smk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ rule map_regionprops_to_atlas_rois:
3939
**inputs["spim"].wildcards,
4040
)
4141
),
42-
threads: 1
42+
threads: 4
4343
resources:
44-
mem_mb=1500,
44+
mem_mb=32000,
4545
runtime=15,
4646
script:
4747
"../scripts/map_atlas_to_regionprops.py"
@@ -84,9 +84,9 @@ rule map_coloc_to_atlas_rois:
8484
**inputs["spim"].wildcards,
8585
)
8686
),
87-
threads: 1
87+
threads: 4
8888
resources:
89-
mem_mb=1500,
89+
mem_mb=32000,
9090
runtime=15,
9191
script:
9292
"../scripts/map_atlas_to_coloc.py"

0 commit comments

Comments
 (0)