Giter Club home page Giter Club logo

maybrain's Introduction

Maybrain

Python v3.5, v3.6 Build Status codecov Release License Apache-2.0

Maybrain is a Python package for analysing and visualising brain connectome and related data.

Dependencies

To run Maybrain you will need a Python 3.5 installation and several other packages on which parts of the code depend. The following are required for analysis:

The following is required for plotting functions:

The following provides some extra functionality for input of certain data types:

If you are not familiar with Python, or you don't want to manually install and deal with each package separately, it is recommended that you install a pre-packaged version that will include most of the above, for example Anaconda. Installation for each package can be found on the individual websites, but if you want to use Anaconda you will find instructions in our documentation page.

Installation

To install, simply run setup.py throughout pip:

$ pip install .

If you want more detailed instructions about installing maybrain using Anaconda, please go to our Wiki pages.

Documentation

For a detailed documentation, with usage examples and explanations, please go to our Wiki pages.

Contributing

The authors are happy for developers to extend, customise, improve or simply to create an issue. We will create an innovative and meaningful hall of fame for anyone contributing a bug-fix and promise to buy you a beer (or acceptable non-alcoholic alternative) when we meet.

Submitting a Pull Request

  1. Fork it.
  2. Create a branch (git checkout -b my_maybrain)
  3. Commit your changes (git commit -am "Added message type")
  4. Push to the branch (git push origin my_maybrain)
  5. Open a Pull Request
  6. Enjoy a refreshing beverage and wait

Credits

Maybrain was originally written by Timothy Rittman and Martyn Rittman, but with substantial improvements and updates from Tiago Azevedo.

Licence

Maybrain is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

maybrain's People

Contributors

rittman avatar tjiagom avatar mrittman avatar

Stargazers

 avatar Oromion avatar Liz Lee avatar ZhyCong avatar Will Scotton avatar Xenia Kobeleva avatar Ting-Yat Wong avatar  avatar Avraam "Makis" Marimpis avatar  avatar

Watchers

Xiangzhen Kong avatar James Cloos avatar  avatar  avatar  avatar  avatar Will Scotton avatar

maybrain's Issues

Logging in GUI

Enable logging so users can download a script to run what they just did in the GUI.

Invoking allen.py

Hi,

could you direct me on how to invoke allen.py trying to match the allen data to a parcellation different from the one Dr. Whitaker used in her papers.

Correct nx.to_numpy_matrix() incompatibility

With new versions of numpy, using subclass matrix raises a Warning. Thus, necessary to find an alternative to nx.to_numpy_matrix() that exists in histograms and bct modules.

Adding support for voxelwise p values

New methods of preprocessing produce voxelwise p-values to determine the confidence of edge connection strengths. This possibility should be implemented. It would involve:

  1. input file of p-values in the same shape as the association matrix
  2. Specifying global thresholding based on p-values rather than strength

Potential challenge - it may not be possible to construct a minimum spanning tree in these networks.

GUI error

When I ran "python guiTest.py":

ERROR: test_highlights (main.TestSequenceFunctions)
test the ability to highlight some part of a brain

Traceback (most recent call last):
File "guiTest.py", line 32, in setUp
self.app = gui.runGui()
File "/home/Tianjie/maybrain-master/bin/gui/mayBrainGUI.py", line 539, in runGui
ex = mayBrainGUI()
File "/home/Tianjie/maybrain-master/bin/gui/mayBrainGUI.py", line 37, in init
self.plot = mb.plotObj() # start plot object
AttributeError: 'module' object has no attribute 'plotObj'

======================================================================
ERROR: test_loadData (main.TestSequenceFunctions)
test inputting of basic data

Traceback (most recent call last):
File "guiTest.py", line 32, in setUp
self.app = gui.runGui()
File "/home/Tianjie/maybrain-master/bin/gui/mayBrainGUI.py", line 539, in runGui
ex = mayBrainGUI()
File "/home/Tianjie/maybrain-master/bin/gui/mayBrainGUI.py", line 37, in init
self.plot = mb.plotObj() # start plot object
AttributeError: 'module' object has no attribute 'plotObj'


Ran 2 tests in 0.595s

FAILED (errors=2)

Node labels for plotting

Can we make the node labels for plotting the actual node names rather than an index? I don't want to update this before you do a merge with the master.

Typo in recipes.py(?) and basicTests failure

Trying to get this running for a work colleague.

On copying the maybrain/maybrain folder to site-packages and then trying to run test/basicTests.py

$ python basicTests.py Traceback (most recent call last): File "basicTests.py", line 17, in <module> from maybrain import recipes File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/maybrain/recipes.py", line 12, in <module> from plot import plotObj ImportError: No module named plot

Surely this should be mbplot?

Regardless of this, running basicTests.py results in the following error:

`$ python basicTests.py
red
red
green
blue
green
green
green
green
green
green
('x', 'gt', 0.5, 'x1', 'node')
('colour', 'eq', 'green', 'green', 'edge')
{'colour': 'green', 'weight': 0.60080034391699999}
('green', 'eq', 'green', True)
{'colour': 'green', 'weight': 0.203602458588}
('green', 'eq', 'green', True)
{'colour': 'green', 'weight': 0.16390494700200001}
('green', 'eq', 'green', True)
{'colour': 'green', 'weight': 0.84379894778099995}
('green', 'eq', 'green', True)
{'colour': 'green', 'weight': 0.242747996199}
('green', 'eq', 'green', True)
{'colour': 'green', 'weight': 0.63727884848299998}
('green', 'eq', 'green', True)

..E.

ERROR: test_loadAndPlot (main.TestSequenceFunctions)

load, threhsold and plot

Traceback (most recent call last):
File "basicTests.py", line 56, in test_loadAndPlot
br, plt = recipes.loadAndPlot(self.fnameAdj, self.fnameCo, 0.5, opacity = 0.2)
File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/maybrain/recipes.py", line 50, in loadAndPlot
plt = plotObj()
File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/maybrain/plot.py", line 41, in init
self.startMayavi()
File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/maybrain/plot.py", line 55, in startMayavi
self.mfig = mlab.figure(bgcolor = (1., 1., 1.,), fgcolor = (0., 0., 0.), engine = self.engine, size=(1500, 1500))
File "/opt/rh/python27/root/usr/lib64/python2.7/site-packages/mayavi/tools/figure.py", line 68, in figure
engine.new_scene(name=name, size=size)
File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/apptools/scripting/recordable.py", line 45, in _wrapper
result = func(_args, *_kw)
File "/opt/rh/python27/root/usr/lib64/python2.7/site-packages/mayavi/core/engine.py", line 452, in new_scene
viewer = self.scene_factory(**factory_kwargs)
File "/opt/rh/python27/root/usr/lib64/python2.7/site-packages/mayavi/core/ui/mayavi_scene.py", line 86, in viewer_factory
viewer = MayaviViewer()
File "/opt/rh/python27/root/usr/lib64/python2.7/site-packages/tvtk/tools/ivtk.py", line 382, in init
super(IVTK, self).init(**traits)
File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/pyface/toolkit.py", line 124, in init
raise NotImplementedError("the %s pyface backend doesn't implement %s" % (ETSConfig.toolkit, oname))
NotImplementedError: the null pyface backend doesn't implement ApplicationWindow


Ran 4 tests in 0.005s

Python 2.7
apptools (4.4.0)
Babel (0.9.6)
cmp (2.1.0b0)
configobj (5.0.6)
cycler (0.10.0)
decorator (4.0.6)
docutils (0.11)
Easy-Lausanne (0.5)
functools32 (3.2.3-2)
Jinja2 (2.6)
MarkupSafe (0.11)
matplotlib (2.0.0b4-2053.g440adff)
mayavi (4.5.0)
mpmath (0.19)
networkx (1.11)
nibabel (2.0.2)
nipy (0.4.0)
nipype (0.7.0.gd2cbeaa-dev)
nose (1.3.0)
numpy (1.11.1)
pip (8.1.2)
pyface (5.1.0)
Pygments (2.1.3)
pyparsing (2.1.9)
python-dateutil (2.5.3)
pytz (2016.6.1)
scipy (0.17.0)
setuptools (27.2.0)
simplejson (3.2.0)
six (1.10.0)
Sphinx (1.1.3)
SQLAlchemy (0.7.9)
subprocess32 (3.2.7)
sympy (1.0)
traits (4.5.0)
traitsui (5.1.0)
virtualenv (13.1.0)
Werkzeug (0.8.3)
wheel (0.24.0)

module install error

Hi,
When I install the module, there is an error: package directory 'maybrain/test' does not exist. Is there anything wrong?

Run allen.py seems get some wrong

Hi, I have run allen.py to match the AHBA genetic data to MNI coordinate. I used the data in the test folder. But it returns some wrong:
I have modified the scripts from the other issue:
from maybrain import allen
from os import path
from glob import glob
import time
start_time=time.time()
nodesToExclude=[]
diags = ['AD308']
for d in diags:
a = allen.multisubj('3d_grid_adj.txt',
nodesToExclude=nodesToExclude,
allen_dir="D:\\WorkingSoftware\\Maybrain\\maybrain-master",
symmetrise=True,
subj_list= ['9861'],
imaging_spatial_file="3d_grid_coords.txt",
delim="\t",
convert_mni=True)
print("comparison")
a.comparison()
print("writeXmatrix")
a.xmatrix(out_file="Xmatrix.csv")
`
Firstly, it returns the wrong message :"allen_data\9861\Probe.csv" not exist. It seems the allen.py has lost 'self' in line 560 and 588. I have addressed the problem after add 'self' in line 561 and 588 before 'allen_dir'.
But I have met the other problem when saving the Xmatrix.csv. The script firstly returns the wrong message: type error: a bytes-like object is required, not 'str'. This seems a problem of python 3, I have addressed the problem by removing the 'r' in line 567. But the script returns wrong message: ValueError: zero-size array to reduction operation maximum which has no identity. Could you provide some examples of the modified allen.py to coordinate matching?

Revise pylint exceptions

Right now, pylint is ignoring the following warnings/conventions (on top of the default ones):
too-many-arguments
too-many-locals
too-many-branches
wildcard-import
too-many-instance-attributes
too-few-public-methods
too-many-instance-attributes
global-statement
inconsistent-return-statements

Maybe some of those can be corrected and incorporated back in pylint analysis after changing accordingly in maybrain's code. This way we can conform more to PEP style rules without loosing readability .

Also, two variables added to good-names might be removed if corrected, from the utils package:
highlights
__number_of_highlights

Finally, the following modules are being ignored by pylint:
allen.py
braineac.py
mayavi_wrapper.py
degeneration.py
modularity.py

Problem important spatial files with ^M ending

This might be an issue for people who generate their spatial information files in windows and some mac programmes. The brainObj.importSpatialInfo function can't manage files with line breaks ^M

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.