{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Getting your data ready" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# scona\n", "\n", "scona is a tool to perform network analysis over correlation networks of brain regions. \n", "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. " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import networkx as nx\n", "import scona as scn\n", "import scona.datasets as datasets" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Importing data\n", "\n", "A scona analysis starts with four inputs.\n", "* __regional_measures__\n", " A pandas DataFrame with subjects as rows. The columns should include structural measures for each brain region, as well as any subject-wise covariates. \n", "* __names__\n", " 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.\n", "* __covars__ _(optional)_ \n", " A list of your covariates. This will be used to specify which columns of __regional_measure__ you wish to correct for. \n", "* __centroids__\n", " 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. " ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
| \n", " | Unnamed: 0 | \n", "nspn_id | \n", "occ | \n", "centre | \n", "study_primary | \n", "age_scan | \n", "sex | \n", "male | \n", "age_bin | \n", "mri_centre | \n", "... | \n", "rh_supramarginal_part5 | \n", "rh_supramarginal_part6 | \n", "rh_supramarginal_part7 | \n", "rh_frontalpole_part1 | \n", "rh_temporalpole_part1 | \n", "rh_transversetemporal_part1 | \n", "rh_insula_part1 | \n", "rh_insula_part2 | \n", "rh_insula_part3 | \n", "rh_insula_part4 | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "0 | \n", "10356 | \n", "0 | \n", "Cambridge | \n", "2K_Cohort | \n", "20.761 | \n", "Female | \n", "0.0 | \n", "4 | \n", "WBIC | \n", "... | \n", "2.592 | \n", "2.841 | \n", "2.318 | \n", "2.486 | \n", "3.526 | \n", "2.638 | \n", "3.308 | \n", "2.583 | \n", "3.188 | \n", "3.089 | \n", "
| 1 | \n", "1 | \n", "10702 | \n", "0 | \n", "Cambridge | \n", "2K_Cohort | \n", "16.055 | \n", "Male | \n", "1.0 | \n", "2 | \n", "WBIC | \n", "... | \n", "3.448 | \n", "3.283 | \n", "2.740 | \n", "3.225 | \n", "4.044 | \n", "3.040 | \n", "3.867 | \n", "2.943 | \n", "3.478 | \n", "3.609 | \n", "
| 2 | \n", "2 | \n", "10736 | \n", "0 | \n", "Cambridge | \n", "2K_Cohort | \n", "14.897 | \n", "Female | \n", "0.0 | \n", "1 | \n", "WBIC | \n", "... | \n", "3.526 | \n", "3.269 | \n", "3.076 | \n", "3.133 | \n", "3.900 | \n", "2.914 | \n", "3.894 | \n", "2.898 | \n", "3.720 | \n", "3.580 | \n", "
| 3 | \n", "3 | \n", "10778 | \n", "0 | \n", "Cambridge | \n", "2K_Cohort | \n", "20.022 | \n", "Female | \n", "0.0 | \n", "4 | \n", "WBIC | \n", "... | \n", "2.830 | \n", "2.917 | \n", "2.647 | \n", "2.796 | \n", "3.401 | \n", "3.045 | \n", "3.138 | \n", "2.739 | \n", "2.833 | \n", "3.349 | \n", "
| 4 | \n", "4 | \n", "10794 | \n", "0 | \n", "Cambridge | \n", "2K_Cohort | \n", "14.656 | \n", "Female | \n", "0.0 | \n", "1 | \n", "WBIC | \n", "... | \n", "2.689 | \n", "3.294 | \n", "2.820 | \n", "2.539 | \n", "2.151 | \n", "2.734 | \n", "2.791 | \n", "2.935 | \n", "3.538 | \n", "3.403 | \n", "
5 rows × 324 columns
\n", "