diff --git a/giga_connectome/data/methods/template.jinja b/giga_connectome/data/methods/template.jinja new file mode 100644 index 0000000..77500b5 --- /dev/null +++ b/giga_connectome/data/methods/template.jinja @@ -0,0 +1,25 @@ +These results were generated with giga_connectome (version {{ data.version }}, https://giga-connectome.readthedocs.io/en/latest/). + +The following steps were followed. + +1. Created subject specific grey matter mask in MNI space. + +2. Sampled the atlas to the space of subject specific grey matter mask in MNI space. + +3. Calculated the conjunction of the customised grey matter mask and resampled atlas to find valid parcels. + +4. Used the new input specific grey matter mask and atlas to extract time series and connectomes for each subject. + The time series data were denoised as follow: + + - Time series extractions through label or map maskers are performed on the denoised nifti file. + - Denoising steps were performed on the voxel level: + - spatial smoothing + - detrend, only if high pass filter was not applied through confounds + - Regress out confounds + - standardize + - Extracted time series from atlas + - Computed correlation matrix + +5. Calculate intranetwork correlation of each parcel. The values replace the diagonal of the connectomes. + +6. Create a group average connectome. diff --git a/giga_connectome/methods.py b/giga_connectome/methods.py new file mode 100644 index 0000000..e947290 --- /dev/null +++ b/giga_connectome/methods.py @@ -0,0 +1,27 @@ +"""Module responsible for generating method section.""" + +from pathlib import Path + +from jinja2 import Environment, FileSystemLoader, select_autoescape + +from giga_connectome import __version__ + + +def generate_method_section(output_dir: Path): + + env = Environment( + loader=FileSystemLoader(Path(__file__).parent), + autoescape=select_autoescape(), + lstrip_blocks=True, + trim_blocks=True, + ) + + template = env.get_template("data/methods/template.jinja") + + output_file = output_dir / "logs" / "CITATION.md" + output_file.parent.mkdir(parents=True, exist_ok=True) + + data = {"version": __version__} + + with open(output_file, "w") as f: + print(template.render(data=data), file=f) diff --git a/giga_connectome/tests/test_methods.py b/giga_connectome/tests/test_methods.py new file mode 100644 index 0000000..7e0ca00 --- /dev/null +++ b/giga_connectome/tests/test_methods.py @@ -0,0 +1,5 @@ +from giga_connectome import methods + + +def test_generate_method_section(tmp_path): + methods.generate_method_section(output_dir=tmp_path) diff --git a/pyproject.toml b/pyproject.toml index 66c5fa3..45526bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,7 @@ dependencies = [ "templateflow < 23.0.0", "tqdm", "setuptools", + "jinja2 >= 2.0", ] dynamic = ["version"]