Getting your data ready

scona

scona is a tool to perform network analysis over correlation networks of brain regions. This tutorial will go through the basic functionality of scona, taking us from our inputs (a matrix of structural regional measures over subjects) to a report of local network measures for each brain region, and network level comparisons to a cohort of random graphs of the same degree.


In [2]:
import numpy as np
import networkx as nx
import scona as scn
import scona.datasets as datasets

Importing data

A scona analysis starts with four inputs.

  • regional_measures A pandas DataFrame with subjects as rows. The columns should include structural measures for each brain region, as well as any subject-wise covariates.
  • names A list of names of the brain regions. This will be used to specify which columns of the regional_measures matrix to want to correlate over.
  • covars (optional) A list of your covariates. This will be used to specify which columns of regional_measure you wish to correct for.
  • centroids A list of tuples representing the cartesian coordinates of brain regions. This list should be in the same order as the list of brain regions to accurately assign coordinates to regions. The coordinates are expected to obey the convention the the x=0 plane is the same plane that separates the left and right hemispheres of the brain.

In [4]:
df, *a = datasets.NSPN_WhitakerVertes_PNAS2016.import_data()
df.head()


Out[4]:
Unnamed: 0 nspn_id occ centre study_primary age_scan sex male age_bin mri_centre ... rh_supramarginal_part5 rh_supramarginal_part6 rh_supramarginal_part7 rh_frontalpole_part1 rh_temporalpole_part1 rh_transversetemporal_part1 rh_insula_part1 rh_insula_part2 rh_insula_part3 rh_insula_part4
0 0 10356 0 Cambridge 2K_Cohort 20.761 Female 0.0 4 WBIC ... 2.592 2.841 2.318 2.486 3.526 2.638 3.308 2.583 3.188 3.089
1 1 10702 0 Cambridge 2K_Cohort 16.055 Male 1.0 2 WBIC ... 3.448 3.283 2.740 3.225 4.044 3.040 3.867 2.943 3.478 3.609
2 2 10736 0 Cambridge 2K_Cohort 14.897 Female 0.0 1 WBIC ... 3.526 3.269 3.076 3.133 3.900 2.914 3.894 2.898 3.720 3.580
3 3 10778 0 Cambridge 2K_Cohort 20.022 Female 0.0 4 WBIC ... 2.830 2.917 2.647 2.796 3.401 3.045 3.138 2.739 2.833 3.349
4 4 10794 0 Cambridge 2K_Cohort 14.656 Female 0.0 1 WBIC ... 2.689 3.294 2.820 2.539 2.151 2.734 2.791 2.935 3.538 3.403

5 rows × 324 columns