Datajoint
What is Datajoint?
There is an initiative in the Euler lab group to change the way our data is stored and accessed. Currently, data is stored in each lab members directories with little consistency in naming and directory organisation between individuals. The ambition of the Euler lab Datajoint project is to move from the present system to one where data is processed and stored in a consistent manner which is easily accessible to everyone.
In order to achieve this, a pipeline of computational tools will need to be established and integrated into the experimental and analytical workflow in the lab. The development is being coordinated by Prof. Dr. Thomas Euler, Dr. Philipp Berens, Dr. Tom Baden, Luke Rogerson, and Theresa Stadler, with additional contributions from the CIN IT services and other members of AG Euler and AG Bethge. If you have any questions, please refer them to one of the individuals listed above.
Integral to this process is the use of the Datajoint toolkit. In the words of the designers:
DataJoint for MATLAB and Python3 is a high-level programming interface for MySQL databases to support data processing chains in science labs. DataJoint is built on the foundation of the relational data model and prescribes a consistent method for organizing, populating, and querying data.
Setting up Datajoint
To set up MySql server locally on your own computer running on Linux do the following
Open a terminal and type
- sudo apt-get install mysql-server
After you installed it do the following as a little test whether all dependencies are running
- sudo netstat -tap | grep mysql
which should give you the following line (maybe with different keyvalues)
- tcp 0 0 localhost:mysql *:* LISTEN 1089/mysqld
Next set the root password so that you can access the mysql server and create new databases and grant permissions to other users
- sudo dpkg-reconfigure mysql-server-5.5
this should open a terminal where you can now set the password. After you have set the root you can now start the server as admin via
- mysql -u root -p
and do things like adding databases, users and grant permissions. Create a database by typing
- CREATE DATABASE database name;
Create a user by typing:
- CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
and do not forget to grant it permission to access your databases via
- GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
and then run
- FLUSH PRIVILEGES;
Now you can access the server for example to set up a DataJoint schema. For example when you have already installed DataJoint and the anaconda distribution for Python you can do this via an ipython notebook. For this go to the directory where you wan to run your scripts from and open a notebook. Then enter
- import datajoint as dj
- dj.conn()
which gives you
- Local config file dj_local_conf.json does not exist! Creating it.
So open the config file which was created in the directory you are running your scripts in and change the 'username' and 'password' according to the values that you have defined when you created the user in MySQL. Then everything should work and you are ready to set up your DataJoint schema :)
Some Comments: Do not forget to end every command in the mysql shell with a ';' All the information you can also find on these websites:
- https://www.digitalocean.com/community/tutorials/a-basic-mysql-tutorial
- http://askubuntu.com/questions/271328/how-to-connect-and-create-a-database-in-mysql
- https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql
- http://datajoint.github.io/installation/