Please see the dedicated documentation of the tool and api.
Please see the tutorial script brainstem_api_tutorial.m
for example calls.
Email and password will be requested
get_token
The token is saved to a mat file (brainstem_authentication.mat
) in the Matlab API tool folder.
load_model
can be used to load any model: We just need to set the name of the model.
output1 = load_model('model','dataset');
We can fetch a single dataset entry from the loaded models.
dataset = output1.datasets(1);
We can also filter the models by providing cell array with paired filters In this example, it will just load datasets whose name is "yeah".
output1_1 = load_model('model','dataset','filter',{'name','yeah'});
Loaded models can be sorted by different criteria applying to their fields. In this example, datasets will be sorted in descending ording according to their name.
output1_2 = load_model('model','dataset','sort',{'-name'});
In some cases models contain relations with other models, and they can be also loaded with the models if requested. In this example, all the projects, experiment data, behaviors and manipulations related to each dataset will be included.
output1_3 = load_model('model','dataset','include',{'projects','experimentdata','behaviors','manipulations'});
The list of related experiment data can be retrieved from the returned dictionary.
experiment_data = output1_3.experiment_data;
Get all subjects with related actions and subject state changes
output1_4 = load_model('model','subject','include',{'actions','subjectstatechanges'});
Get all projects with related subjects and datasets
output1_5 = load_model('model','project','include',{'datasets','subjects'});
All these options can be combined to suit the requirements of the users. For example, we can get only the dataset that contain the word "Rat" in their name, sorted in descending order by their name and including the related projects.
output1_6 = load_model('model','dataset', 'filter',{'name.icontains', 'Rat'}, 'sort',{'-name'}, 'include',{'projects'});
We can make changes to a model and update it in the database. In this case, we change the description of one of the previously loaded datasets.
dataset = output1.datasets(1);
dataset.description = 'new description';
output2 = save_model('data',dataset,'model','dataset');
We can submit a new entry by defining a struct with the required fields.
dataset = {};
dataset.name = 'New dataset85';
dataset.description = 'new dataset description';
dataset.projects = {'0c894095-2d16-4bde-ad50-c33b7680417d'};
Submitting dataset
output3 = save_model('data',dataset,'model','dataset');
Request the public data by defining the portal to be public
output4 = load_model('model','project','portal','public');