Skip to content

Commit f1185c5

Browse files
authored
Merge pull request #421 from dPys/development
Development
2 parents 00c9add + eb95256 commit f1185c5

23 files changed

+1808
-113
lines changed

.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ omit =
3737
pynets/stats/netmotifs.py
3838
pynets/stats/benchmarking.py
3939
pynets/stats/embeddings.py
40-
pynets/stats/optimeasures.py
40+
pynets/stats/prediction.py
4141
pynets/registration/register.py
4242
pynets/core/interfaces.py
4343
pynets/core/cloud_utils.py

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ RUN echo "FSLDIR=/usr/share/fsl/5.0" >> /home/neuro/.bashrc && \
124124
libgfortran \
125125
matplotlib \
126126
openblas \
127+
&& pip install certifi -U --ignore-installed \
127128
&& pip install skggm python-dateutil==2.8.0 \
128129
# Precaching fonts, set 'Agg' as default backend for matplotlib
129130
&& python -c "from matplotlib import font_manager" \

README.md

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ docker pull dpys/pynets:latest
1818
```
1919

2020
## Manual
21-
(Requires a local dependency install of FSL version >=5.0.9. See:
21+
(REQUIRES a local dependency install of FSL version >=5.0.9. See:
2222
<https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation>):
2323
```
2424
[sudo] pip install pynets [--user]
@@ -55,45 +55,34 @@ A manuscript is in preparation, but for now, please cite ALL uses with the follo
5555
}
5656
```
5757

58-
The `pynets_bids` CLI
59-
---------------------
60-
```
61-
usage: pynets_bids [-h]
62-
[--participant_label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]]
63-
[--session_label SESSION_LABEL [SESSION_LABEL ...]]
64-
[--push_location PUSH_LOCATION]
65-
[-ua Path to parcellation file in MNI-space [Path to parcellation file in MNI-space ...]]
66-
[-cm Cluster mask [Cluster mask ...]]
67-
[-roi Path to binarized Region-of-Interest ROI) Nifti1Image [Path to binarized Region-of-Interest (ROI Nifti1Image ...]]
68-
[-ref Atlas reference file path]
69-
[-way Path to binarized Nifti1Image to constrain tractography [Path to binarized Nifti1Image to constrain tractography ...]]
70-
[-config Optional path to a config.json file with runtime settings.]
71-
[-pm Cores,memory] [-plug Scheduler type] [-v]
72-
[-work Working directory]
73-
bids_dir output_dir {participant,group} {dwi,func}
74-
[{dwi,func} ...]
75-
pynets_bids: the following arguments are required: bids_dir, output_dir, analysis_level, modality
58+
Data already preprocessed with BIDS apps like fmriprep, CPAC, dmriprep? If your BIDS derivatives can be queried with pybids, then you should be able to run them with the user-friendly `pynets_bids` CLI!
7659
```
60+
pynets_bids '/hnu/fMRIprep/fmriprep' '/Users/dPys/outputs/pynets' participant func --participant_label 0025427 0025428 --session_label 1 2 -config pynets/config/bids_config.json
7761
78-
where the `-config` flag specifies that path to a .json configuration spec that includes at least one of many possible connectome recipes to apply to your data. Pre-built configuration files are included in the pynets/config directory, and an example is shown here (with commented descriptions):
62+
```
63+
*Note: If you preprocessed your BOLD data using fMRIprep, then you will need to have specified either `T1w` or `anat` in the list of fmriprep `--output-spaces`. Similarly, if you preprocessed your data using CPAC, then you will want to be sure that an ALFF image exists. PyNets does NOT currently accept template-normalized BOLD or DWI data. See the usage docs for more information on compatible file types.
64+
65+
66+
where the `-config` flag specifies that path to a .json configuration spec that includes at least one of many possible connectome recipes to apply to your data. Pre-built configuration files are available (see: <https://github.com/dPys/PyNets/tree/master/pynets/config>), and an example is shown here (with commented descriptions):
7967

8068
```
8169
{
82-
"dwi": {
83-
"dg": "['prob', 'det']", # Indicates the direction-getting method(s) of tractography.
84-
"ml": "['0', '10', '40']", # Indicates the minimum streamline length(s) for tractographic filtering.
85-
"mod": "['csd', 'csa', 'sfm']" # Indicates the type(s) of diffusion model estimators for fixel reconstruction. At least 1 is required for structural connectometry.
86-
},
87-
"func": {
88-
"ct": "['rena', 'ward', 'kmeans']", # Indicates the type(s) of clustering that will be used to generate a clustering-based parcellation. This should be left as "None" if no clustering will be performed, but can be included simultaneously with the `-a` and `-ua` parcellation options.
89-
"k": "['200', '400', '600']", # Indicates the number of clusters to generate in a clustering-based parcellation. This should be left as "None" if no clustering will be performed.
70+
"func": { # fMRI options. If you only have functional (i.e. BOLD) data, set each of the `dwi` options to "None"
71+
"ct": "None", # Indicates the type(s) of clustering that will be used to generate a clustering-based parcellation. This should be left as "None" if no clustering will be performed, but can be included simultaneously with the `-a` and `-ua` parcellation options.
72+
"k": "None", # Indicates the number of clusters to generate in a clustering-based parcellation. This should be left as "None" if no clustering will be performed.
9073
"hp": "['0', '0.028', '0.080']", # Indicates the high-pass frequenc(ies) to apply to signal extraction from nodes.
91-
"mod": "['partcorr', 'sps']", # Indicates the functional connectivity estimator(s) to use. At least 1 is required for functional connectometry.
92-
"sm": "['0', '2', '4']", # Indicates the smoothing FWHM value(s) to apply during the nodal time-series signal extraction.
74+
"mod": "['partcorr', 'cov']", # Indicates the functional connectivity estimator(s) to use. At least 1 is required for functional connectometry.
75+
"sm": "['0', '4']", # Indicates the smoothing FWHM value(s) to apply during the nodal time-series signal extraction.
9376
"es": "['mean', 'median']" # Indicates the method(s) of nodal time-series signal extraction.
9477
},
95-
"gen": {
96-
"a": "DesikanKlein2012", # Anatomical atlases to define nodes.
78+
"dwi": { # dMRI options. If you only have structural (i.e. DWI) data, set each of the `func` options to "None"
79+
"dg": "None",
80+
"ml": "None",
81+
"mod": "None",
82+
"em": "None"
83+
},
84+
"gen": { # These are general options that apply to all modalities
85+
"a": "['BrainnetomeAtlasFan2016', 'atlas_harvard_oxford', 'destrieux2009_rois']", # Anatomical atlases to define nodes.
9786
"bin": "False", # Binarize the resulting connectome graph before analyzing it. Note that undirected weighted graphs are analyzed by default.
9887
"embed": "False", # Activate omnibus and single-graph adjacency spectral embedding of connectome estimates sampled.
9988
"mplx": 0, # If both functional and structural data are provided, this parameter [0-3] indicates the type of multiplex connectome modeling to perform. See `pynets -h` for more details on multiplex modes.
@@ -115,6 +104,30 @@ where the `-config` flag specifies that path to a .json configuration spec that
115104
}
116105
```
117106

107+
Data not in BIDS format and/or preprocessed using in-house tools?
108+
No problem-- you can still run pynets manually:
109+
```
110+
pynets -id '002_1' '/Users/dPys/outputs/pynets' \ # where `-id` is an arbitrary subject identifier and the first path is an arbitrary output directory to store derivatives of the workflow.
111+
-func '/Users/dPys/PyNets/tests/examples/sub-002/ses-1/func/BOLD_PREPROCESSED_IN_ANAT_NATIVE.nii.gz' \ # The fMRI BOLD image data.
112+
-anat '/Users/dPys/PyNets/tests/examples/sub-002/ses-1/anat/ANAT_PREPROCESSED_NATIVE.nii.gz' \ # The T1w anatomical image. This is mandatory -- PyNets requires a T1/T2-weighted anatomical image unless you are analyzing raw graphs that ahve already been produced.
113+
-a 'BrainnetomeAtlasFan2016' \ # An anatomical atlas name. Note that if were to omit the `-a` flag, a custom parcellation file would need to be specified using the `-ua` flag instead or a valid clustering mask (`-cm`) would be needed to generate an individual parcellation. For a complete catalogue of anatomical atlases available in PyNets, see the `Usage` section of the documentation.
114+
-mod 'partcorr' \ # The connectivity model. In the case of structural connectometry, this becomes the diffusion model type.
115+
-thr 0.20 \ # Optionally apply a single proportional threshold to the generated graph.
116+
```
117+
118+
```
119+
pynets -id '002_1' '/Users/dPys/outputs/pynets' \ # where `-id` is an arbitrary subject identifier and the first path is an arbitrary output directory to store derivatives of the workflow.
120+
-dwi '/Users/dPys/PyNets/tests/examples/sub-002/ses-1/dwi/DWI_PREPROCESSED_NATIVE.nii.gz' \ # The dMRI diffusion-weighted image data.
121+
-bval '/Users/dPys/PyNets/tests/examples/sub-002/ses-1/dwi/BVAL.bval' \ # The b-values.
122+
-bvec '/Users/dPys/PyNets/tests/examples/sub-002/ses-1/dwi/BVEC.bvec' \ # The b-vectors.
123+
-anat '/Users/dPys/PyNets/tests/examples/sub-002/ses-1/anat/ANAT_PREPROCESSED_NATIVE.nii.gz' \ # The T1w anatomical image.
124+
-ua '/Users/dPys/.atlases/MyCustomParcellation-scale1.nii.gz' '/Users/dPys/.atlases/MyCustomParcellation-scale2.nii.gz' \ # The parcellations.
125+
-mod 'csd' 'csa' 'sfm' \ # The (diffusion) connectivity model(s).
126+
-dg 'prob' 'det' \ # The tractography direction-getting method.
127+
-mst -min_thr 0.20 -max_thr 0.80 -step_thr 0.10 # Multi-thresholding from the Minimum-Spanning Tree, with AUC graph analysis.
128+
-n 'Default' # The resting-state network definition to restrict node-making.
129+
```
130+
118131
![Multiplex Layers](docs/_static/structural_functional_multiplex.png)
119132
![Multiplex Glass](docs/_static/glassbrain_mplx.png)
120133
![Yeo7](docs/_static/yeo7_mosaic.png)

0 commit comments

Comments
 (0)