Skip to content

Commit

Permalink
[FIX 🔨] bug fixes and improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
saratheriver committed Nov 13, 2020
1 parent 7b57377 commit b9f165b
Show file tree
Hide file tree
Showing 27 changed files with 1,857 additions and 22 deletions.
Binary file modified enigmatoolbox/datasets/__pycache__/base.cpython-37.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion enigmatoolbox/datasets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def fetch_ahba(csvfile=None):
Table of gene co-expression data, shape = (82, 15634)
"""
if csvfile is None:
url = 'https://raw.githubusercontent.com/saratheriver/enigma-extra/master/ahba/allgenes.csv'
url = 'https://raw.githubusercontent.com/saratheriver/enigma-extra/master/ahba/allgenes_stable.csv'
return pd.read_csv(url, error_bad_lines=False)
else:
return pd.read_csv(csvfile, error_bad_lines=False)
Expand Down
Binary file not shown.
12 changes: 6 additions & 6 deletions enigmatoolbox/permutation_testing/permutation_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def centroid_extraction_sphere(sphere_coords, annotfile, ventricles=False):
return centroid


def rotate_parcellation(coord_l, coord_r, nrot=100):
def rotate_parcellation(coord_l, coord_r, nrot=1000):
"""
Rotate parcellation (author: @saratheriver)
Expand All @@ -95,7 +95,7 @@ def rotate_parcellation(coord_l, coord_r, nrot=100):
coord_r : ndarray
Coordinates of right hemisphere regions on the sphere, shape = (m, 3)
nrot : int, optional
Number of rotations. Default is 100.
Number of rotations. Default is 1000.
Returns
-------
Expand Down Expand Up @@ -299,7 +299,7 @@ def perm_sphere_p(x, y, perm_id, corr_type='pearson', null_dist=False):
return p_perm


def spin_test(map1, map2, surface_name='fsa5', parcellation_name='aparc', n_rot=100,
def spin_test(map1, map2, surface_name='fsa5', parcellation_name='aparc', n_rot=1000,
type='pearson', null_dist=False, ventricles=False):
"""
Spin permutation (author: @saratheriver)
Expand All @@ -315,7 +315,7 @@ def spin_test(map1, map2, surface_name='fsa5', parcellation_name='aparc', n_rot=
parcellation_name : string, optional
Parcellation name {'aparc', 'aparc_aseg'}. Default is 'aparc'.
n_rot : int, optional
Number of spin rotations. Default is 100.
Number of spin rotations. Default is 1000.
type : string, optional
Correlation type {'pearson', 'spearman'}. Default is 'pearson'.
null_dist : bool, optional
Expand Down Expand Up @@ -390,7 +390,7 @@ def spin_test(map1, map2, surface_name='fsa5', parcellation_name='aparc', n_rot=
return p_spin


def shuf_test(map1, map2, n_rot=100, type='pearson', null_dist=False):
def shuf_test(map1, map2, n_rot=1000, type='pearson', null_dist=False):
"""
Shuf permuation (author: @saratheriver)
Expand All @@ -401,7 +401,7 @@ def shuf_test(map1, map2, n_rot=100, type='pearson', null_dist=False):
map2 : narray, ndarray, or pandas.Series
The other map to be correlated
n_rot : int, optional
Number of shuffles. Default is 100.
Number of shuffles. Default is 1000.
type : string, optional
Correlation type {'pearson', 'spearman'}. Default is 'pearson'.
null_dist : bool, optional
Expand Down
Binary file modified enigmatoolbox/plotting/__pycache__/colormaps.cpython-37.pyc
Binary file not shown.
400 changes: 400 additions & 0 deletions enigmatoolbox/plotting/cmaps/bb_g.csv

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions enigmatoolbox/plotting/cmaps/bb_o.csv

Large diffs are not rendered by default.

400 changes: 400 additions & 0 deletions enigmatoolbox/plotting/cmaps/bb_p.csv

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions enigmatoolbox/plotting/cmaps/bb_r.csv

Large diffs are not rendered by default.

29 changes: 28 additions & 1 deletion enigmatoolbox/plotting/colormaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,39 @@
[70, 130, 180, 255],
[196, 58, 250, 255]], dtype=np.uint8)

eco_kos_colors = np.array([[0, 0, 0, 255],
[126, 40, 127, 255],
[51, 104, 156, 255],
[167, 210, 140, 255],
[254, 205, 8, 255],
[255, 253, 25, 255]], dtype=np.uint8)

spec_5_colors = np.array([[0, 0, 0, 255],
[50, 136, 189, 255],
[171, 221, 164, 255],
[235, 235, 181, 255],
[253, 174, 97, 255],
[213, 62, 79, 255]], dtype=np.uint8)

root_pth = os.path.dirname(__file__)
TealRd_colors = np.loadtxt(os.path.join(root_pth, 'cmaps', 'TealRd.csv'))
GyRd_colors = np.loadtxt(os.path.join(root_pth, 'cmaps', 'GyRd.csv'))
GyRd_r_colors = np.loadtxt(os.path.join(root_pth, 'cmaps', 'GyRd_r.csv'))
GyBu_colors = np.loadtxt(os.path.join(root_pth, 'cmaps', 'GyBu.csv'))
GyBu_r_colors = np.loadtxt(os.path.join(root_pth, 'cmaps', 'GyBu_r.csv'))

bb_r_colors = np.loadtxt(os.path.join(root_pth, 'cmaps', 'bb_r.csv'))
bb_o_colors = np.loadtxt(os.path.join(root_pth, 'cmaps', 'bb_o.csv'))
bb_g_colors = np.loadtxt(os.path.join(root_pth, 'cmaps', 'bb_g.csv'))
bb_p_colors = np.loadtxt(os.path.join(root_pth, 'cmaps', 'bb_p.csv'))

bb_r_r_colors = np.flipud(np.loadtxt(os.path.join(root_pth, 'cmaps', 'bb_r.csv')))
bb_o_r_colors = np.flipud(np.loadtxt(os.path.join(root_pth, 'cmaps', 'bb_o.csv')))
bb_g_r_colors = np.flipud(np.loadtxt(os.path.join(root_pth, 'cmaps', 'bb_g.csv')))
bb_p_r_colors = np.flipud(np.loadtxt(os.path.join(root_pth, 'cmaps', 'bb_p.csv')))

colormaps = {'yeo7': yeo7_colors, 'TealRd': TealRd_colors, 'GyRd': GyRd_colors,
'GyRd_r': GyRd_r_colors, 'GyBu': GyBu_colors, 'GyBu_r': GyBu_r_colors}
'GyRd_r': GyRd_r_colors, 'GyBu': GyBu_colors, 'GyBu_r': GyBu_r_colors,
'eco_kos': eco_kos_colors, 'bb_r': bb_r_colors, 'bb_o': bb_o_colors,
'bb_g': bb_g_colors, 'bb_p': bb_p_colors, 'bb_r_r': bb_r_r_colors, 'bb_o_r': bb_o_r_colors,
'bb_g_r': bb_g_r_colors, 'bb_p_r': bb_p_r_colors, 'spec_5': spec_5_colors}
Binary file modified enigmatoolbox/utils/__pycache__/parcellation.cpython-37.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion enigmatoolbox/utils/parcellation.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def parcel_to_surface(source_val, target_lab, mask=None, fill=0, source_lab=None

if mask is not None:
target_lab2 = target_lab[mask]
labs2 = map_to_labels(source_val, target_lab2, source_lab=source_lab)
labs2 = parcel_to_surface(source_val, target_lab2, source_lab=source_lab)
return map_to_mask(labs2, mask, fill=fill)

if source_lab is None:
Expand Down
Loading

0 comments on commit b9f165b

Please sign in to comment.