Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of anatomical network visualisations #140

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0cb64ab
Try to link to autodoc content in the introduction.rst
wingedRuslan Apr 2, 2019
86ff8d6
Add documentation to the introduction page
wingedRuslan Apr 7, 2019
1500c32
Add documentation to the introduction page, ready for PR
wingedRuslan Apr 2, 2019
5412842
Merge branch 'master' of https://github.com/wingedRuslan/scona
wingedRuslan Apr 7, 2019
9d083dc
Update view_corr_mat in visualisation commands to accept corr_mat as …
wingedRuslan Apr 9, 2019
d93b9fe
Add support of numpy.array as an input for view_corr_mat and add rais…
wingedRuslan Apr 16, 2019
d9ed917
Check that corr_mat is n x n matrix, otherwise raise Error
wingedRuslan Apr 16, 2019
f9fe78c
Explain corr_mat argument to view_corr_mat() more precisely
wingedRuslan Apr 18, 2019
2d76afb
Merge remote-tracking branch 'upstream/master'
wingedRuslan May 29, 2019
0d5155d
Created a new file for visualisation tools and implemented plot_rich_…
wingedRuslan Jun 10, 2019
b050a7e
Main implementation of plot_network_measures function
wingedRuslan Jun 11, 2019
28ff8e5
Implemention of plot_network_measures function
wingedRuslan Jun 11, 2019
4438537
Implementation of plot_degree_dist function
wingedRuslan Jun 12, 2019
287260f
Update source file for sphinx auto documentation to include new modul…
wingedRuslan Jun 12, 2019
eb3e549
Add tutorial to show how to use created visualisation tools
wingedRuslan Jun 13, 2019
cdd9acc
Address PR#121 comments. Create in scona/helpers.py <save_fig()> in o…
wingedRuslan Jun 21, 2019
5b8107d
Address PR#121 comments. Modify plot_rich_club() to accept GraphBundl…
wingedRuslan Jun 23, 2019
aa34567
Update the visualisation tutorial based on the updated plot_rich_club…
wingedRuslan Jun 23, 2019
8426955
Fix bugs in saving figures function and in plotting degree distribution
wingedRuslan Jun 23, 2019
adb4347
Update the visualisation tutorial to demonstrate plot_degree_dist fun…
wingedRuslan Jun 23, 2019
a97c24e
Address PR#121 comments. Redesign plot_network_measures() to accept G…
wingedRuslan Jun 26, 2019
1f2c1aa
Update plot_rich_club to accept real_network as a parameter to the fu…
wingedRuslan Jun 26, 2019
20d6f74
Update the visualisation_tutorial to show the usage of modified plot_…
wingedRuslan Jun 26, 2019
da7a994
Update the documentation about GraphBundle, report_global_measures &&…
wingedRuslan Jun 26, 2019
b6fdd17
Merge branch 'master' of https://github.com/wingedRuslan/scona into w…
KirstieJane Jul 5, 2019
064bad0
Refactor (opinionated Kirstie)
KirstieJane Jul 5, 2019
70080fc
Ignore figures directory when tutorials are run
KirstieJane Jul 5, 2019
ece228f
Adjust comments
KirstieJane Jul 5, 2019
da1a611
Move color settings earlier in function
KirstieJane Jul 5, 2019
73214a5
Merge pull request #2 from WhitakerLab/kw-visualisation
wingedRuslan Jul 6, 2019
4e2a04b
Implemented setup_color_list() to get list of colors for each data value
wingedRuslan Jul 6, 2019
1fd0019
Implemented add_colorbar() to have the ability to add colorbar to plot
wingedRuslan Jul 6, 2019
e4b9782
Merge the changes Kirstie made into my local master branch
wingedRuslan Jul 8, 2019
da7e1d9
Add anatomical_layout() as a helper function to get node coordinates …
wingedRuslan Jul 8, 2019
116dc6d
#130 - In plot_degree_dist() set seed to the default integer value to…
wingedRuslan Jul 11, 2019
64e3cc1
Renaming helpers.py to explicitly state that it is visualisations_hel…
wingedRuslan Jul 12, 2019
7a9bcd4
Create a function df_sns_barplot for restructuring DataFrame into acc…
wingedRuslan Jul 12, 2019
ae5e27f
Create plotting anatomical network function
wingedRuslan Jul 15, 2019
37c27f8
Fix small bugs in plot_anatomical_network
wingedRuslan Jul 16, 2019
a48a226
Create a tutorial to show functionalities of plotting anatomical netw…
wingedRuslan Jul 16, 2019
3bc48d3
Adjust the sizes of produced plots, add border for node when displayed
wingedRuslan Jul 19, 2019
26a26ad
Update tutorial to show changes made in plot_anatomical_network
wingedRuslan Jul 19, 2019
2b57b5c
Update network visualisations tutorial to fix a bug while calculating…
wingedRuslan Aug 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Ignore the figures directory that is created when you run
# some of the tutorials. We don't want those outputs to be
# brought up to the github repository.
tutorials/figures

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
8 changes: 8 additions & 0 deletions docs/source/scona.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,11 @@ scona.stats_functions module
:members:
:undoc-members:
:show-inheritance:

scona.visualisations module
--------------------------------------------

.. automodule:: scona.visualisations
:members:
:undoc-members:
:show-inheritance:
2 changes: 2 additions & 0 deletions scona/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

from scona.wrappers import *

from scona.visualisations_helpers import *

import scona.datasets
from scona import *

12 changes: 10 additions & 2 deletions scona/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,13 @@ def set_anatomical_graph_attributes(self, names):

class GraphBundle(dict):
'''
GraphBundle is a subclass of :class:`dict` containing
:class:`str`: :class:`BrainNetwork` pairs.
The GraphBundle class (after instantiating - object) is the scona way to
handle across-network comparisons.
What is it?
Essentially it's a python dictionary with BrainNetwork objects as values
(:class:`str`: :class:`BrainNetwork` pairs).

Mainly used to create random graphs for comparison with your real network data.

Parameters
----------
Expand Down Expand Up @@ -553,6 +558,9 @@ def report_global_measures(self, as_dict=False, partition=True):
Calculate global_measures for each BrainNetwork object and report as a
:class:`pandas.DataFrame` or nested dict.

Note: Global measures **will not** be calculated again if they have already been calculated.
So it is only needed to calculate them once and then they aren't calculated again.

Parameters
----------
as_dict : bool
Expand Down
8 changes: 4 additions & 4 deletions scona/graph_measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,12 @@ def calculate_nodal_measures(

# ==== CALCULATE MEASURES ====================

def calc_nodal_measure(G, measure, method, force=False):
for measure, method in nodal_measure_dict.items():
if (not nx.get_node_attributes(G, name=measure)) or force:
nx.set_node_attributes(G,
name=measure,
values=method(G))

for measure, method in nodal_measure_dict.items():
calc_nodal_measure(G, measure, method, force=force)


# ============= Global measures =============

Expand Down Expand Up @@ -452,6 +449,9 @@ def calculate_global_measures(G,
`average_shortest_path_length`, `assortativity`, `modularity`, and
`efficiency` of G.

Note: Global measures **will not** be calculated again if they have already been calculated.
So it is only needed to calculate them once and then they aren't calculated again.

Parameters
----------
G : :class:`networkx.Graph`
Expand Down
Loading