Giter VIP home page Giter VIP logo

gnode-client-matlab's Introduction

G-Node MATLAB Toolbox

The global scale of neuroinformatics offers unprecedented opportunities for scientific collaborations between and among experimental and theoretical neuroscientists. To fully harvest these possibilities, a set of coordinated activities is required that will improve three key ingredients of neuroscientific research: data access, data storage, and data analysis (...) (Herz et al., 2008)

The G-Node MATLAB Toolbox (GMT) allows convenient access to electro-physiological recordings stored in the G-Node Data Store (Beta) through the MATLAB command line. Requirements are

  • MATLAB R2008b or higher on any platform supporting Java (Linux, Mac, Windows), as well as a

  • G-Node account (user "demo" with password "demo" or a new one available here).

In addition, a backend for persistent and lab-wide caching is recommended but not necessary (e.g., MongoDB).

Installation

Installation of the G-Node Toolbox is similar to that of most MATLAB toolboxes. Follow these steps:

  1. Download and unzip the toolbox or clone it from GitHub via git clone https://github.com/g-node/gnode-client-matlab.git to your local Matlab toolbox directory (for example, $MATLAB_HOME/toolbox)
  2. Adjust the default settings in the default configuration file ($MATLAB_HOME/toolbox/gnode-client-matlab-master/default.json):
    • Set apiDefinition as a path to the supplied requirements.json file. On Linux, for instance, assuming your $MATLAB_HOME corresponds to /home/john/matlab/, you should put /home/john/matlab/toolbox/gnode-client-matlab/requirements.json. On Windows, this should be like C:\\matlab\\toolbox\\gnode-client-matlab\\requirements.json depending on your configuration (Note the double slashes in the path).
  3. Add the Java library to the path by either
    • adding a path to the .jar file ($MATLAB_HOME/toolbox/gnode-client-matlab/lib/client.jar) as the top line in the default Matlab classpath file located usually at $MATLAB_HOME/toolbox/local/classpath.txt (permanently, recommended)
    • or using the javaaddpath function >> javaaddpath('$MATLAB_HOME/toolbox/gnode-client-matlab/lib/client.jar') (valid for only one Matlab session)
  4. Open MATLAB.
  5. Add the toolbox folder to the path either
    • via menu (permanently, recommended) File -> Set Path -> Add Folder.. select $MATLAB_HOME/toolbox/gnode-client-matlab/
    • or using the addpath function: >> addpath('$MATLAB_HOME/toolbox/gnode-client-matlab') (valid for only one Matlab session)
  6. Check that your installation was successful by typing import gnode.*; at the MATLAB prompt. If there are no errors, you can start using the toolbox.
  7. Read the documentation.

Getting started

Before using the toolbox, you should set up your MATLAB environment and initialize a session.

% Move all toolbox functions into scope
import gnode.*;

% Initialize session. 'default' will use the account settings specified
% during installation.
session = init('default');

Now the toolbox is ready for use. It requires a network connection for all operations involving download or upload. The G-Node data store uses a simple object model similar to NEO. All your data is stored in a set of object types tailored to electrophysiology, such as blocks, segments, recording channels, signals et cetera.

In the MATLAB environment, we represent these objects as structures. Here is a basic example for creating and uploading such an object.

% Create a structure containing signal data

signal = make_dummy(session, 'analogsignal');

signal.name = 'My brand new signal';
signal.sampling_rate = struct('units', 'Hz', 'data', 12000);
signal.t_start = struct('units', 'ms', 'data', 0);
signal.signal = struct('units', 'mV', 'data', my_data);

% This returns the ID of the newly created object in
% the G-Node data store

new_object = create(session, signal);

Subsequent object retrieval is equally straightforward and supports various access methods (e.g., single ID, array of IDs, numeric range). Here are a few examples to get you going:

% Lists of objects
my_list = get_list(g, 'analogsignal');

% Single objects
my_recording = get(session, 'analogsignal_947');

% Multiple objects
all = { 'analogsignal_948', 'segment_43', 'unit_8' };
my_recordings = get(session, all);

% Ranges
more_recordings = get_range(session, 'analogsignal', 947, 1002);

More advanced operations (e.g., updates, download queues, batch object creation and upload, and so on) are described in the GMT wiki.

FAQ

Q: Is the G-Node toolbox compatible with older versions of MATLAB (i.e., before R2008b)?
A: Unfortunately not. GMT makes heavy use of the JVM bridge provided by Mathworks. This bridge is under constant development. Various incompatibilities and lack of features make it unfeasible to support MATLAB versions before R2008b.

Q: Is there any versioning support for my data (e.g., revert after destructive edit)?
A: Not yet.

Q: Can I contribute?
A: GMT is open-source; pull requests are always welcome. As a user, please report any bugs or missing features on the Issue Tracker.

License

GMT is distributed under the MIT license (see LICENSE).

gnode-client-matlab's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gnode-client-matlab's Issues

share function

share function works for a single user like:

share(g, block, 'anita', 1, 1);

but

  1. there is no way to make an object(s) public (safety_level = 1) or group-accessible (safety_level = 2). This feature is supported by the API with the same principle.
  2. would be cool if multiple users can be specified (supported by the API) - minor for the moment

Log4j warning

Due to lacking log4j.properties file, HTTPComponents throws a warning on start-up complaining about lack of appenders.

User / connection information

Would be really useful if there is a way to see the currently logged-in user information, as well as some connection information somehow.

get_list - extend the info

Now the get_list function returns only object IDs. would be cool if this could be extended by other object attributes, parent (and references to children?). Otherwise now it's almost impossible to query any object without remembering its exact ID.

Access by name or smth instead of NEO_ID

We found that it's hard to explore the structure of a, say, block (loaded in cascade mode) by NEO_IDs. The query:

b.segment_set

ans =

segment_34: [1x1 struct]
segment_35: [1x1 struct]
segment_36: [1x1 struct]

does give only list of NEO_IDs, which is sort of meaningless. Maybe names of structs inside "...set" containers should be assigned as ID or smth like that.

requirements.json - clean some fields

  1. 'safety_level' field: a bit strange seems that it is assigned for metadata objects (section, property, value) but is absent for other objects (NEO). If there is no specific reason for that I'd make it consistent.
  2. Value['attributes'] - 'current_state' is no longer exists.

Aliases for NEO objects

To get to the signals from a loaded block one has to type:

b.segment_set.segment_12345.analogsignal_set.analogsignalarray_12345

or to get to some of array parameter like data even more:

b.segment_set.segment_12345.analogsignalarray_set.analogsignalarray_12345.signal.data

Maybe one should think of some aliases for NEO objects, like

  • "as", "irsa" etc for object NEO_IDs, so to have "as_12345"
  • have "events" instead of "event_set" (just 3 letters less, but still)

Any other ideas?

These aliases could be made configurable, say, in requirements.json.

Shortcuts

Implement "shortcuts" for typical operations, to make actions easier. For example, make a function to create a property with several values in one line. Or maybe the same for object creation - make it possible in one line (?).

GET after POST: needed?

POST to create / update an object is followed by a GET request to get an object. However the response to the initial POST already contains the created / updated object. So probably additional GET is not needed and must be removed. (is there any other reason for it?)

get_updated fails

get_updated fails for data-related objects.

irr_events.name = 'stimulus event array';
irr_events = get_updated(g, irr_events);
??? Error using ==> update at 22
[GNODE] Cannot perform update without id. Please specify

Error in ==> get_updated at 14
updated_id = update(session, obj){1};

Besides that, the get_updated function is not documented.

get_created doesn't retrieve some values back

when I create a signal the t_start and sampling_rate are not assigned to the object that I get back:

I = make_dummy(g, 'analogsignal');
I.name = 'I';
I.sampling_rate = struct('units', 'Hz', 'data', data.SamplingFrequencyHz);
I.t_start = struct('units', 'ms', 'data', 0);
I.signal = struct('units', 'mV', 'data', data.I);
I.sampling_rate

ans =

units: 'Hz'
 data: 20000

I = get_created(g, I);
I.sampling_rate

ans =

units: 'Hz'
  url: ''

Warn in case there is no connection

When there is no network, the application doesn't print any warnings, and silently downloads empty structures, which is a bit confusing. Would be cool to change that somehow.

get_created fails for sections

sr_sec = make_dummy(g, 'section');
sr_sec.name = 'spontaneous recording';
sr_sec = get_created(g, sr_sec);
??? Reference to non-existent element of a cell array.

Error in ==> get_created at 15
new_id = create(session, obj){1};

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.