Skip to content

Wrappers Help

Kirstie Whitaker edited this page Oct 5, 2016 · 5 revisions

Wrappers help

Wrappers are command line tools that call a bunch of the different python functions stored in the SCRIPTS directory.

They're designed to make it easy for you to run parts of these analyses on your own data.

If you have any questions about these commands please open a new issue and Kirstie will get back to you as soon as possible.

Contents:

Correlation matrix from regional measures file

usage: corrmat_from_regionalmeasures.py [-h] [--covars_file covars_file]
                                        [--names_308_style]
                                        regional_measures_file names_file
                                        output_name

Generate a structural correlation matrix from an input csv file,
a list of region names and (optional) covariates.

positional arguments:
  regional_measures_file
                        CSV file that contains regional values for each participant.
                        Column labels should be the region names or covariate variable
                        names. All participants in the file will be included in the
                        correlation matrix.
  names_file            Text file that contains the names of each region to be included
                        in the correlation matrix. One region name on each line.
  output_name           File name of the output correlation matrix.
                        If the output directory does not yet exist it will be created.

optional arguments:
  -h, --help            show this help message and exit
  --covars_file covars_file
                        Text file that contains the names of variables that should be
                        covaried for each regional measure before the creation of the
                        correlation matrix. One variable name on each line.
                          Default: None
  --names_308_style     Include this flag if your names are in the NSPN 308
                        parcellation style (which means you have 41 subcortical regions)
                        that are still in the names files and that
                        the names are in <hemi>_<DK-region>_<part> format.
                          Default: False

Author: Kirstie Whitaker <kw401@cam.ac.uk>

Network analysis from correlation matrix

usage: network_analysis_from_corrmat.py [-h] [-c cost] [-n n_rand]
                                        [--names_308_style]
                                        corr_mat_file names_file
                                        centroids_file output_dir

Generate a graph as a fixed cost from a non-thresholded matrix
and return global and nodal measures.

positional arguments:
  corr_mat_file         Text file (tab or space delimited) that contains the unthresholded
                        matrix with no column or row labels.
  names_file            Text file that contains the names of each region, in the same
                        order as the correlation matrix. One region name on each line.
  centroids_file        Text file that contains the x, y, z coordinates of each region,
                        in the same order as the correlation matrix. One set of three
                        coordinates, tab or space delimited, on each line.
  output_dir            Location in which to save global and nodal measures.

optional arguments:
  -h, --help            show this help message and exit
  -c cost, --cost cost  Cost at which to threshold the matrix.
                          Default: 10.0
  -n n_rand, --n_rand n_rand
                        Number of random graphs to generate to compare with real network.
                          Default: 1000
  --names_308_style     Include this flag if your names are in the NSPN 308
                        parcellation style (which means you have 41 subcortical regions)
                        that are still in the names and centroids files and that
                        the names are in <hemi>_<DK-region>_<part> format.
                          Default: False

Author: Kirstie Whitaker <kw401@cam.ac.uk>

Question: Do the centroids (x, y, z coordinates) need to be in any particular coordinate system?

Answer: No, the code should work with x, y, z coordinates in any system. It was originally written assuming that the regions would be in MNI space as they need to be the same regions across people and that's the most common standard space. The coordinates are necessary to calculate the total_dist, av_dist and interhem nodal measures. Note that the interhemispheric measure assumes that negative x values are in the left hemisphere and positive values in the right hemisphere. The code shouldn't crash, you just might end up with odd values there if you don't use MNI standard space!