# Database tutorial

The public data in the database can be loaded as reference data, and can be accessed without providing credentials, but login credentials are necessary for full functionality of the database. This tutorial will show you the preparatory steps to use the database and various interactions. If you are using the public data, you can skip step 1-3.

edit db_credentials.m

2. In the Matlab file db_credentials.m, replace the two lines below with your credentials:
credentials.username = 'user';

3. Define paths to data repositories Paths are generated from the repository definition in the database. Here you need to define the root path for each repository in db_local_repositories.m. To use the NYUshare_Datasets (the NYU share dataset directory), you must define the system path to the repository, e.g.:
repositories.NYUshare_Datasets = '/Volumes/buzsakilab/Buzsakilabspace/Datasets';

1. Load single session by filtering by a sessionName
sessionName = 'Peter_MS13_171129_105507_concat';
session = sessions{1};

2. Load and set session parameters
sessionName = 'Peter_MS13_171129_105507_concat';
[session, basename, basepath] = db_set_session('sessionName',sessionName);

5. Inspect and edit the session metadata if necessary
session = gui_session(session);

spikes = loadSpikes('session',session);

1. Run the processing pipeline and CellExplorer from sessionName
cell_metrics = ProcessCellMetrics('sessionName',sessionName);
cell_metrics = CellExplorer('metrics',cell_metrics);

2. Run CellExplorer directly from sessionName
cell_metrics = CellExplorer('sessionName',sessionName);

3. Run CellExplorer from list of sessionNames
sessionNames = {'ham11_27-29_amp','ham11_34-36_amp'};