Skip to content

Commit

Permalink
[ENH 🔨] add parcellations for histology module
Browse files Browse the repository at this point in the history
  • Loading branch information
saratheriver committed Dec 14, 2020
1 parent 146d76c commit c2fc2c6
Show file tree
Hide file tree
Showing 22 changed files with 53 additions and 23 deletions.
14 changes: 10 additions & 4 deletions enigmatoolbox/histology/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,16 @@ def economo_koskinas_spider(parcel_data=None, parcellation='aparc_fsa5', fill=0,
return class_mean


def bb_moments_raincloud(region_idx=None, title=''):
def bb_moments_raincloud(region_idx=None, parcellation='aparc', title=''):
"""Stratify regional data according to BigBrain statistical moments (authors: @caseypaquola, @saratheriver)
Parameters
----------
region_idx : ndarray, shape = (n_val,)
Indices of regions to be included in analysis.
parcellation : string, optional
Name of parcellation. Options are 'aparc', 'schaefer_100', 'schaefer_200', 'schaefer_300',
'schaefer_400', 'glasser_360'. Default is 'aparc'.
title : string, optional
Title of raincloud plot. Default is empty.
Expand All @@ -137,7 +140,7 @@ def prctile(x, p):
return np.percentile(x, p)

# Load BigBrain statistical moments (mean, skewness)
bb_pth = os.path.dirname(os.path.dirname(__file__)) + '/histology/bb_moments_aparc.csv'
bb_pth = os.path.dirname(os.path.dirname(__file__)) + '/histology/bb_moments_' + parcellation + '.csv'
bb_moments_aparc = np.loadtxt(bb_pth, delimiter=',', dtype=float)

# Initiate figure and axes
Expand Down Expand Up @@ -213,13 +216,16 @@ def prctile(x, p):
return fig, axs, axs2


def bb_gradient_plot(data=None, axis_range=None, title='', yaxis_label='', xaxis_label=''):
def bb_gradient_plot(data=None, parcellation='aparc', axis_range=None, title='', yaxis_label='', xaxis_label=''):
"""Stratify parcellated data according to the BigBrain gradient (authors: @caseypaquola, @saratheriver)
Parameters
----------
data : ndarray, shape = (n_val,)
Parcellated data.
parcellation : string, optional
Name of parcellation. Options are 'aparc', 'schaefer_100', 'schaefer_200', 'schaefer_300',
'schaefer_400', 'glasser_360'. Default is 'aparc'.
axis_range : tuple, optional
Range of spider plot axes. Default is (min, max).
title : string, optional
Expand All @@ -240,7 +246,7 @@ def bb_gradient_plot(data=None, axis_range=None, title='', yaxis_label='', xaxis
data = pd.Series(data)

# Load BigBrain gradient
bb_pth = os.path.dirname(os.path.dirname(__file__)) + '/histology/bb_gradient_aparc.csv'
bb_pth = os.path.dirname(os.path.dirname(__file__)) + '/histology/bb_gradient_' + parcellation + '.csv'
g = np.loadtxt(bb_pth, delimiter=',', dtype=float)

# Define number of bins
Expand Down
1 change: 1 addition & 0 deletions enigmatoolbox/histology/bb_gradient_glasser_360.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-0.04626,-0.0094678,-0.05906,-0.033068,-0.028171,-0.0020189,0.074254,-0.090948,-0.086824,-0.082694,-0.089789,-0.084903,-0.055223,0.057514,-0.001539,-0.064465,-0.064465,0.074254,-0.030823,-0.020565,-0.020565,0.0093778,-0.016642,-0.07362,0.007629,0.0039316,0.0059746,0.025553,0.0034589,0.0059746,0.018565,0.067591,0.021712,0.061092,0.039698,-0.095009,-0.058593,0.047114,-0.047608,-0.052202,0.023448,-0.063364,0.0039316,0.0039316,-0.02044,-0.064465,-0.064465,-0.064465,-0.064465,-0.064465,-0.086712,-0.079498,-0.088813,-0.089789,-0.05611,-0.089789,0.06945,0.055026,0.081418,0.025501,0.087148,0.01673,0.0039316,0.050904,0.088086,0.05083,-0.064139,-0.0076287,0.0060114,0.0039316,0.0052562,0.0041622,-0.050684,-0.029352,-0.020637,-0.0065235,-0.015175,-0.076446,-0.036345,-0.076613,-0.017663,-0.001261,0.008313,0.008313,0.008313,0.008313,0.0063458,0.083197,0.008313,0.035649,0.048798,0.058227,0.071967,0.058227,-0.064465,-0.041775,-0.062012,0.0039316,-0.089704,-0.086956,-0.037211,-0.016716,-0.0086768,0.0072512,0.0062272,0.0092829,0.011367,-0.023813,0.0092829,0.0088763,0.045096,0.012779,-0.089789,-0.010449,-0.053096,-0.0010337,-0.03421,0.06555,0.031481,0,0.014925,0.075844,0.011367,-0.0036307,0.014598,0.08105,0.071393,0.011367,0.040659,0.072062,0.05405,0.079814,0.082566,0.087566,0.080067,0.086552,0.078853,0.073712,0.060907,0.033699,0.0042776,-0.023684,0.0042776,-0.0037434,-0.0086116,-0.0071795,-0.01743,0.0062272,0.0052524,0.004389,0.0042776,-0.064465,0.00202,0.069245,0.079002,-0.020565,0.045563,-0.0065235,-0.016048,0.014147,0.0059746,0.042944,0.074254,0.069413,0.087731,0.028137,0.0092829,0.0092829,-0.008831,0.0080762,-0.0038992,0.087235,-0.042458,-0.018194,0.013248,0.057615,0.081227,0.0111,0.017793,0.04497,-0.052632,0.020964,-0.072439,-0.042128,-0.040146,0.0022783,0.074537,-0.085663,-0.096363,-0.086135,-0.086567,-0.083354,-0.067932,0.033668,-0.034367,-0.083699,-0.083699,0.074537,-0.054199,-0.023058,-0.023058,0.012076,-0.019147,-0.035784,-0.01488,0.029367,-0.02423,0.015319,-0.034141,-0.02423,-0.014848,0.04806,0.0010014,0.035908,-0.0020264,-0.073528,-0.055085,0.0052634,-0.060257,-0.057195,0.03038,-0.083699,0.029367,0.029367,-0.052034,-0.083699,-0.083699,-0.083699,-0.083699,-0.083699,-0.096768,-0.088906,-0.092231,-0.090004,-0.062979,-0.090004,0.04958,0.049098,0.065972,0.038642,0.072938,0.036243,0.029367,0.057376,0.089448,0.075507,-0.057031,0.013517,0.029823,0.029367,0.031083,0.030911,-0.047105,0.0090792,-0.018045,0.025258,0.026944,-0.055427,-0.0048066,-0.060248,0.02026,0.013107,0.037432,0.037432,0.037432,0.037432,0.03424,0.078707,0.037432,0.046384,0.065739,0.075507,0.081548,0.075507,-0.083699,-0.042965,-0.068239,0.029367,-0.091627,-0.08328,-0.018802,-0.0093407,0.026617,-0.004348,-0.016803,0.03642,-0.0027901,0.0033704,0.03642,0.01331,0.062804,0.039026,-0.090004,0.0077764,-0.040758,-0.022838,-0.055412,0.055845,0.023369,0,0.014529,0.087777,-0.0027901,-0.0083717,-0.0027901,0.081515,0.074372,-0.0027901,0.013295,0.064883,0.060606,0.07957,0.082258,0.08676,0.07868,0.085189,0.076143,0.076798,0.040682,0.033008,-0.013063,-0.052613,-0.013063,-0.01907,-0.030187,-0.019685,-0.034395,-0.016803,-0.014743,-0.01233,-0.013063,-0.083699,-0.0013693,0.066547,0.086391,-0.023058,0.05729,-0.017152,-0.018061,0.021403,-0.02423,0.0041696,0.074537,0.06626,0.085943,0.039496,0.03642,0.03642,-0.0081192,0.037432,0.0071909,0.084469,-0.0065634,-0.020731,-0.0021565,0.040678,0.07957,0.0079927,0.045857,0.073087
1 change: 1 addition & 0 deletions enigmatoolbox/histology/bb_gradient_schaefer_100.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.072359,0.033612,0.012186,-0.019895,-0.050534,-0.03104,0.0019849,-0.03065,-0.068037,-0.0063776,-0.011867,-0.06306,-0.088229,-0.087698,-0.07311,0.070415,-0.01808,-0.056364,-0.055416,-0.013396,-0.061537,-0.069623,-0.050841,0.0062888,0.0098875,-0.017139,0.008313,0.037326,-0.0060351,0.0039316,0.05903,0.064409,0.086144,-0.014483,-0.0033427,-0.0030561,0.044434,0.050656,0.056234,0.046904,0.004741,0.038664,-0.015635,0.062416,0.017566,0.0043313,-0.064185,-0.026184,0.025166,0.02339,0.076724,0.042476,0.041928,-0.029496,-0.065927,-0.018487,-0.033747,-0.085695,-0.0084965,0.003573,-0.086137,-0.093762,-0.091545,-0.093444,-0.090535,-0.074646,0.013232,-0.058416,-0.050985,-0.077077,-0.063399,-0.047547,-0.047243,0.02025,-0.018192,0.016644,-0.021197,0.035125,0.069167,0.074956,-0.016022,-0.014355,0.038033,0.025815,0.037432,-0.038152,0.030165,0.039616,-0.028379,-0.013063,0.082209,0.0077045,0.035512,0.063858,-0.0077403,0.060831,0.030281,-0.0018573,-0.0051177,-0.0065129
1 change: 1 addition & 0 deletions enigmatoolbox/histology/bb_gradient_schaefer_200.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.035215,0.031052,0.038376,-0.0008795,-0.02036,0.029337,-0.04767,0.0030263,-0.020565,-0.047949,-0.011427,-0.058092,-0.066838,-0.034416,-0.0096946,-0.0083821,-0.011997,-0.088385,-0.022903,-0.087811,-0.089666,0.00052115,-0.086478,-0.087167,-0.064465,-0.089789,-0.084946,-0.063282,-0.088307,-0.087617,0.079889,0.083988,-0.044345,-0.027957,-0.048666,-0.062323,-0.063836,-0.064465,-0.0076589,-0.059938,-0.070735,-0.011627,-0.076648,0.0088247,-0.0022218,0.0062272,0.0093887,0.0034756,-0.026144,-0.050887,0.008313,0.034386,-0.0074815,0.0039316,0.049536,0.062461,0.080636,0.083475,0.050148,0.010635,0.0056664,-0.013498,0.0052173,0.084262,0.028815,-0.0089487,0.008313,0.0059554,-0.018003,-0.073251,-0.002153,0.031953,0.042423,0.061477,0.083114,0.033809,0.061406,0.050174,0.022684,0.0042776,0.0058373,0.0042776,0.043259,0.081241,-0.018479,0.035756,-0.024512,0.056781,0.0043619,0.038646,0.0043259,0.0039316,-0.056802,-0.015236,0.0039316,0.024562,0.028523,0.062309,0.0059746,0.073484,0.076306,0.069112,0.045759,-0.0013693,-0.019443,-0.041568,0.020798,-0.023058,-0.084023,-0.034084,-0.017984,-0.063979,-0.088658,-0.083675,-0.05136,-0.01186,-0.00071135,0.0025899,-0.013286,-0.092299,-0.075063,-0.09377,0.018157,-0.094461,-0.091695,-0.0171,-0.09481,-0.083699,-0.090004,-0.096272,-0.055094,-0.070289,-0.078894,-0.095302,0.081737,0.02105,-0.046329,-0.02281,-0.05233,-0.07508,-0.081457,-0.083699,-0.044619,-0.082608,-0.082023,-0.006376,-0.040426,0.025802,0.01441,-0.016483,-0.084658,0.018989,0.016992,0.015102,-0.0062805,0.044134,-0.027457,0.028394,0.075933,0.067469,0.045386,0.076468,0.084411,0.074641,-0.016803,-0.014666,-0.027465,0.082741,0.059362,0.047481,0.037432,0.026353,0.0064221,0.037432,0.035578,-0.061057,-0.026118,0.024136,0.026975,0.047941,0.029367,-0.013063,-0.013063,-0.013063,0.037664,0.081345,0.0090816,0.074835,0.03056,-0.0069804,0.076496,0.061757,0.043851,0.03014,0.030125,-0.011222,0.023267,-0.0079689,0.0013036,-0.02423
1 change: 1 addition & 0 deletions enigmatoolbox/histology/bb_gradient_schaefer_300.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.074254,0.080182,0.074254,0.029362,0.034477,0.0039429,0.060771,-0.01395,-0.0008795,-0.0008795,-0.020565,0.012866,-0.020565,-0.045761,-0.020565,-0.07259,-0.033402,-0.0083542,-0.035569,-0.078471,-0.061861,-0.028774,-0.063272,-0.064465,-0.026679,-0.0077742,-0.013739,-0.0062892,-0.086712,0.010043,0.0023933,-0.087866,-0.03813,-0.087738,-0.035595,-0.089789,-0.086904,0.012166,-0.089671,-0.086441,-0.087169,-0.088155,-0.089789,-0.0035062,-0.064465,-0.087284,-0.084193,-0.083541,-0.076664,-0.092654,-0.06782,-0.087118,-0.089789,0.083857,0.043645,0.083596,0.008799,-0.041198,0.0062272,-0.064465,-0.050693,-0.062445,-0.064465,-0.064465,-0.047073,-0.059747,-0.070648,0.0039316,-0.088079,0.0063389,0.0062272,0.0062272,0.049792,0.0094342,0.030443,-0.0097633,-0.021383,-0.031079,-0.087773,-0.066266,0.008313,0.033142,-0.01178,0.0059746,0.00069986,0.049909,0.057514,0.071481,0.084043,0.08875,0.078313,0.04964,0.0487,0.061014,0.010829,0.0059226,-0.0059065,-0.00021481,0.0062272,0.084551,0.024695,-0.0064692,0.008313,0.0052701,-0.0079039,0.008313,-0.05479,-0.024594,0.00069163,0.030321,0.035734,0.0039316,0.07684,0.085319,0.011367,0.011367,0.048702,0.075156,0.029286,0.053764,0.0042776,0.0042776,0.0056789,0.0042776,0.039487,0.077009,-0.022494,0.020232,0.034141,-0.018878,0.054311,-0.028015,0.0063822,0.036195,0.0039316,0.0043989,-0.00054506,-0.064139,-0.073683,-0.02958,0.0039316,0.0039316,0.040595,0.035264,0.0059746,0.023054,0.0059746,0.05211,0.067591,0.0059746,0.074537,0.077757,0.039514,0.040422,0.05167,-0.021025,-0.0013693,-0.0013693,-0.0073562,-0.022851,0.018432,-0.0043026,-0.094322,-0.023058,-0.081711,-0.03494,-0.030565,-0.017023,-0.09571,-0.085976,-0.055909,-0.029954,-0.082533,-0.01124,0.00019391,0.025236,-0.018011,-0.0030449,0.038352,-0.014581,-0.092782,-0.062783,-0.094474,-0.079852,-0.09192,-0.096768,-0.090127,-0.09534,-0.014364,-0.094983,-0.083699,-0.095951,-0.090004,-0.058154,-0.074672,-0.095415,-0.094154,-0.090004,-0.06086,-0.088136,-0.092833,0.076624,0.08154,0.011749,-0.035137,-0.016803,-0.021329,-0.082522,-0.045181,-0.05776,-0.082837,-0.082481,-0.083699,-0.047325,-0.081056,-0.083425,0.0026041,-0.059132,-0.072227,0.028719,-0.014179,-0.016803,-0.024668,-0.016803,-0.0854,0.034912,0.027056,0.015924,0.011439,-0.056876,0.0022086,0.042333,0.026705,-0.017667,-0.058083,0.022103,0.029367,0.066596,0.064431,0.072676,0.079745,0.082997,0.070569,0.07691,0.087449,0.078827,-0.0010698,-0.016435,-0.014335,-0.014324,0.083713,0.056914,0.063694,0.038237,0.026266,0.037432,0.022104,0.028597,0.037432,0.037432,-0.022327,0.035511,-0.048247,-0.068239,-0.032726,-0.025419,0.021635,0.028009,0.048198,0.029367,-0.013512,-0.013063,-0.013063,-0.013063,-0.013063,0.043304,0.079688,0.0048124,0.033545,0.074985,0.034299,0.043156,-0.015674,-0.010702,0.078466,0.055914,0.058099,0.033314,0.029367,0.035811,0.030126,0.029367,0.012111,0.029367,0.0047089,-0.02423,-0.0018822,0.019736,-0.02423,-0.02423
1 change: 1 addition & 0 deletions enigmatoolbox/histology/bb_gradient_schaefer_400.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.074254,0.07955,0.074254,0.025642,0.041587,0.016864,0.066565,0.029008,-0.010441,-0.0008795,-0.0008795,-0.020565,0.035694,-0.020565,-0.033965,0.00064133,-0.0131,-0.069238,-0.020565,0.039922,-0.07519,-0.030583,-0.0083542,-0.038763,-0.079471,-0.058631,-0.038458,0.0042776,-0.064465,-0.049336,-0.064465,-0.019726,-0.013814,-0.027563,-0.011112,0.0010884,0.011262,-0.00016779,-0.08448,-0.088545,-0.0084474,-0.05973,-0.088659,-0.086712,-0.087793,-0.06735,-0.089789,-0.087271,-0.025922,-0.089639,-0.086712,-0.086712,-0.088066,-0.09149,-0.095239,-0.0084647,-0.089789,-0.064465,-0.087202,-0.083399,-0.079748,-0.089789,-0.077412,-0.091349,-0.050739,-0.087259,-0.081041,-0.089789,0.081753,0.084502,0.084747,0.018395,-0.049189,0.0062272,-0.062971,-0.046881,-0.05412,-0.064465,-0.051956,-0.064465,-0.062535,-0.064465,-0.02361,-0.064465,-0.049277,-0.08563,-0.049746,-0.083139,0.0017358,-0.077059,-0.087912,0.0063158,0.0063366,-0.0030667,0.0062272,0.061261,0.011178,0.0090645,0.030301,0.0097831,-0.0090923,-0.014692,-0.029352,-0.087322,-0.047128,0.008313,0.050084,0.045077,0.0030205,0.0039316,-0.011913,0.0059746,0.0039316,0.056393,0.05052,0.0719,0.055532,0.027532,0.082709,0.07014,0.082179,0.088719,0.077898,0.050514,0.029688,0.066288,0.0015279,0.0062272,0.0060972,-0.0097515,0.0027853,0.0062272,0.083834,0.041586,-0.0083873,-0.0047203,0.008313,0.008313,0.008313,-0.014994,-0.065694,0.008313,0.022785,-0.024214,0.0059746,0.040436,0.039565,0.0039316,0.079218,0.080618,0.086755,0.054825,0.011367,0.076086,0.038963,0.011367,0.032598,0.060907,0.036473,0.0042776,0.0042776,0.0042776,0.0056297,0.0042776,0.0043498,0.051948,0.020187,0.083537,0.081228,-0.023591,0.008313,-0.018574,0.011357,0.06323,-0.028511,0.0056007,0.035008,0.0039316,0.0045214,0.0082178,-0.005264,-0.064139,0.0039316,0.0041453,-0.071193,-0.064139,-0.012671,0.0039316,0.0039316,0.0464,0.0059746,0.036912,0.027204,0.0059746,0.009001,0.04052,0.063547,0.067591,0.0059746,0.0059746,0.074537,0.082712,0.074537,0.064778,0.038837,0.02973,0.058893,-0.017317,0.032937,-0.023058,-0.0013693,-0.0013693,-0.023058,0.020884,-0.059151,-0.012158,0.021926,-0.023058,-0.081339,-0.029027,-0.023058,-0.016907,-0.070935,-0.073364,-0.11298,-0.049338,-0.02719,-0.071395,-0.085802,-0.083699,-0.0027901,-0.0020998,-0.019574,0.012225,0.018662,0.032129,-0.0027901,0.023352,-0.041066,-0.014273,-0.079276,-0.092259,-0.016803,-0.081891,-0.090004,-0.094952,-0.062238,-0.090148,-0.081775,0.010887,-0.096768,-0.090004,-0.096768,-0.012036,-0.094566,-0.090004,-0.096484,-0.083699,-0.095077,-0.070872,-0.090004,-0.06143,-0.090004,-0.095265,-0.093942,-0.022825,-0.079291,-0.075928,-0.090004,-0.096108,0.081821,0.080984,0.018432,-0.013063,-0.059248,-0.016803,-0.083699,-0.033929,-0.030797,-0.083699,-0.064863,-0.083699,-0.082353,-0.083699,-0.046732,-0.083699,-0.032464,-0.079644,-0.083699,-0.086163,-0.064655,0.0015138,-0.06961,0.039032,0.039694,-0.0035251,-0.01551,-0.016803,-0.016803,-0.016803,-0.085449,0.020398,0.03642,0.026802,0.03642,0.013999,-0.0032228,-0.061195,-0.0018615,0.037432,0.048975,0.040971,-0.0040738,0.029367,-0.03437,-0.070872,0.019729,0.029367,0.063553,0.067474,0.083298,0.075507,0.068151,0.061315,0.082616,0.087449,0.067968,0.078216,0.053514,0.084469,0.071903,-0.013063,-0.015521,-0.028956,-0.016803,-0.013708,-0.016069,0.084325,0.082464,0.057825,0.049621,0.025927,0.037432,-0.0053518,0.037432,0.023046,0.010661,0.037432,0.037432,-0.058633,0.035319,-0.0553,-0.068239,-0.068239,0.0098458,-0.02423,-0.02423,0.01993,0.025503,0.044839,0.029367,-0.013063,-0.013063,-0.013063,-0.013233,-0.013063,0.070002,0.080273,-0.0027901,0.023024,0.07957,0.029655,0.065874,0.036956,0.072664,0.061154,-0.0039909,-0.0086029,0.076887,0.038733,0.065299,0.029367,0.033089,0.038873,0.029367,0.030289,0.029367,0.019392,0.029367,0.016907,0.029367,-0.0087632,0.017203,-0.02423,0.0044496,-0.02423,0.019127,0.04806,-0.022495,-0.02423
Loading

0 comments on commit c2fc2c6

Please sign in to comment.