-
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.
Add working snakemake rule for preprocessing
- Loading branch information
1 parent
dd44529
commit 4947e31
Showing
3 changed files
with
57 additions
and
1 deletion.
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 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from pathlib import Path | ||
|
||
from derotation.analysis.metrics import stability_of_most_detected_blob | ||
from derotation.derotate_batch import derotate | ||
from snakemake.script import snakemake | ||
|
||
try: | ||
# Input arguments | ||
read_dataset_path = Path(snakemake.input[0]) | ||
write_dataset_path = Path(snakemake.input[1]) | ||
output = snakemake.output[0] | ||
|
||
# os.system("module load miniconda") | ||
# os.system("source activate /nfs/nhome/live/lporta/.conda/envs/cimat") | ||
output_path_dataset = write_dataset_path / "ses-0/funcimg/" | ||
|
||
data = derotate(read_dataset_path, output_path_dataset) | ||
metric_measured = stability_of_most_detected_blob(data) | ||
with open(output, "w") as f: | ||
f.write(f"dataset: {read_dataset_path.stem} metric: {metric_measured}") | ||
except Exception as e: | ||
print(e.args) | ||
with open(output, "w") as f: | ||
f.write(str(e.args)) |
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