-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make via snakemake what all the other classes were doing
- Loading branch information
1 parent
76ff8b7
commit 93cfd20
Showing
7 changed files
with
54 additions
and
314 deletions.
There are no files selected for viewing
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,47 @@ | ||
rule setup: | ||
input: | ||
"/nfs/winstor/margrie/SimonWeiler/RawData/Invivo_imaging/3photon_rotation/shared/", | ||
"/ceph/margrie/laura/cimaut/", | ||
params: | ||
folder_read_pattern="2*", | ||
file_read_pattern=["rotation_00001.tif", "*.bin"], | ||
output: "datasets.csv" | ||
run: | ||
"calcium_imaging_automation/core/rules/setup.py" | ||
|
||
# import pandas as pd | ||
# Base paths | ||
raw_data_base = "/nfs/winstor/margrie/SimonWeiler/RawData/Invivo_imaging/3photon_rotation/shared/" | ||
processed_data_base = "/ceph/margrie/laura/cimaut/derivatives" | ||
|
||
# Dynamically discover folders matching the "2*" pattern | ||
datasets = glob_wildcards(f"{raw_data_base}{{dataset}}").dataset | ||
datasets = [ds for ds in datasets if ds.startswith("2")] | ||
datasets = [ds.split("/")[0] for ds in datasets] | ||
datasets = list(set(datasets)) | ||
datasets.sort() | ||
|
||
# paths = pd.read_csv("datasets.csv") | ||
# for the output | ||
datasets_no_underscore = [ds.replace("_", "") for ds in datasets] | ||
|
||
# rule all: | ||
# input: | ||
# expand("preprocess_output_{index}.txt", index=paths["index"]) | ||
# Final state of the pipeline | ||
# Are all the outputs files present? | ||
rule all: | ||
input: | ||
expand( | ||
[ | ||
f"{processed_data_base}/sub-{{index}}_{{datasets_no_underscore}}/ses-0/funcimg/derotation/derotated_full.tif", | ||
f"{processed_data_base}/sub-{{index}}_{{datasets_no_underscore}}/ses-0/funcimg/derotation/derotated_full.csv", | ||
], | ||
zip, | ||
index=range(len(datasets)), | ||
datasets_no_underscore=datasets_no_underscore, | ||
) | ||
|
||
# rule preprocess: | ||
# input: | ||
# lambda wildcards: paths.loc[int(wildcards.index), "read_dataset_path"], | ||
# lambda wildcards: paths.loc[int(wildcards.index), "write_dataset_path"], | ||
# output: | ||
# "preprocess_output_{index}.txt" | ||
# params: | ||
# index=lambda wildcards: wildcards.index | ||
# resources: | ||
# partition="fast", | ||
# mem_mb=16000, | ||
# cpu_per_task=1, | ||
# tasks=1, | ||
# nodes=1, | ||
# script: | ||
# "calcium_imaging_automation/core/rules/preprocess.py" | ||
rule preprocess: | ||
input: | ||
raw=lambda wildcards: f"{raw_data_base}{datasets[int(wildcards.index)]}/", | ||
# Dynamically match input files using patterns | ||
# bin=lambda wildcards: f"{raw_data_base}{datasets[int(wildcards.index)]}/aux_stim/*rotation_*001.bin", | ||
# tif=lambda wildcards: f"{raw_data_base}{datasets[int(wildcards.index)]}/imaging/rotation_*001.tif", | ||
output: | ||
tiff=f"{processed_data_base}/sub-{{index}}_{{datasets_no_underscore}}/ses-0/funcimg/derotation/derotated_full.tif", | ||
csv=f"{processed_data_base}/sub-{{index}}_{{datasets_no_underscore}}/ses-0/funcimg/derotation/derotated_full.csv", | ||
params: | ||
index=lambda wildcards: wildcards.index | ||
resources: | ||
partition="fast", | ||
mem_mb=16000, | ||
cpu_per_task=1, | ||
tasks=1, | ||
nodes=1, | ||
script: | ||
"../calcium_imaging_automation/core/rules/preprocess.py" |