|
1 | 1 | # mease-elabftw
|
2 | 2 |
|
| 3 | +[](https://pypi.org/project/mease-elabftw) |
| 4 | +[](https://mease-elabftw.readthedocs.io/en/latest/?badge=latest) |
3 | 5 | [](https://github.com/ssciwr/mease-elabftw/actions?query=workflow%3ATests)
|
4 | 6 | [](https://codecov.io/gh/ssciwr/mease-elabftw)
|
5 |
| -[](https://sonarcloud.io/dashboard?id=ssciwr_mease-elabftw) |
6 |
| -[](https://mease-elabftw.readthedocs.io/en/latest/?badge=latest) |
| 7 | +[](https://sonarcloud.io/dashboard?id=ssciwr_mease-elabftw) |
7 | 8 |
|
8 |
| -Python library for interacting with [eLabFTW](https://www.elabftw.net/) experiments: |
| 9 | +A Python library for interacting with [eLabFTW](https://www.elabftw.net/) experiments: |
9 | 10 |
|
10 | 11 | - Create [NWB](https://nwb-schema.readthedocs.io/en/latest/) metadata from an eLabFTW experiment
|
11 |
| -- Extract [metadata](https://doc.elabftw.net/metadata.html) from linked database items |
12 | 12 | - Upload files (e.g. analysis result from HPC) to an eLabFTW experiment
|
13 | 13 | - List eLabFTW experiments from the command line
|
14 | 14 |
|
15 | 15 | ## Setup
|
16 | 16 |
|
17 |
| -To install: |
18 |
| - |
19 | 17 | ```bash
|
20 |
| -python -m pip install git+https://github.com/ssciwr/mease-elabftw |
| 18 | +python -m pip install mease-elabftw |
21 | 19 | ```
|
22 | 20 |
|
23 |
| -You also need to generate an API key in eLabFTW (User Panel -> API Keys -> GENERATE AN API KEY), |
| 21 | +To authenticate requests to the eLabFTW server you also need to generate an API key in eLabFTW (User Panel -> API Keys -> GENERATE AN API KEY), |
24 | 22 | and then set the environment variable `ELABFTW_TOKEN` to this key, e.g.
|
25 | 23 |
|
26 | 24 | ```bash
|
27 | 25 | export ELABFTW_TOKEN=abc123abc123abc123
|
28 | 26 | ```
|
29 | 27 |
|
30 |
| -This key is needed to authenticate requests to the eLabFTW server. |
31 |
| - |
32 | 28 | ## Use in Python
|
33 | 29 |
|
34 | 30 | Get nwb metadata from an elabftw experiment to use in [mease-lab-to-nwb](https://github.com/ssciwr/mease-lab-to-nwb):
|
35 | 31 |
|
36 | 32 | ```pycon
|
37 | 33 | >>> import mease_elabftw
|
38 |
| ->>> from pprint import pprint |
39 |
| ->>> pprint(mease_elabftw.list_experiments("Liam")) |
40 |
| -['163: test fake experiment without json metadata (Liam Keegan, 2021-10-07)', |
41 |
| - '156: test fake experiment with json metadata (Liam Keegan, 2021-10-01)'] |
42 |
| ->>> pprint(mease_elabftw.get_nwb_metadata(156)) |
43 |
| -{'Ecephys': {}, |
44 |
| - 'NWBFile': {'experimenter': 'Liam Keegan', |
45 |
| - 'identifier': '20211001-8b6f100d66f4312d539c52620f79d6a503c1e2d1', |
46 |
| - 'institution': 'Heidelberg University, Physiology and ' |
47 |
| - 'Pathophysiology', |
48 |
| - 'lab': 'Medical Biophysics, Groh/Mease', |
49 |
| - 'session_description': 'test fake experiment with json metadata', |
50 |
| - 'session_start_time': '2021-10-01 11:13:47', |
51 |
| - 'virus': 'AAVretr ChR2-tdTomato:\n' |
52 |
| - ' * Virus in -80 storage: AAVrg-CAG-hChR2-tdTomato (AAV ' |
53 |
| - 'Retrograde)\n' |
54 |
| - ' * Origin: Addgene\n' |
55 |
| - ' * Comments: retrograde\n' |
56 |
| - ' * Expression Quality: \n' |
57 |
| - ' * product number: \n' |
58 |
| - 'AAVretr Flpo:\n' |
59 |
| - ' * Virus in -80 storage: AAVretr EF1a-Flpo\n' |
60 |
| - ' * Origin: Addgene\n' |
61 |
| - ' * Comments: retrograde Flip\n' |
62 |
| - ' * Expression Quality: \n' |
63 |
| - ' * product number: 55637-AAVrg\n'}, |
64 |
| - 'Subject': {}} |
| 34 | +>>> mease_elabftw.list_experiments("Liam") |
| 35 | +['163: test fake experiment without json metadata (Liam Keegan, 2021-10-07)', '156: test fake experiment with json metadata (Liam Keegan, 2021-10-01)'] |
| 36 | +>>> metadata = mease_elabftw.get_nwb_metadata(156) |
| 37 | +>>> metadata["NWBFile"]["session_description"] |
| 38 | +test fake experiment with json metadata |
| 39 | +>>> metadata["NWBFile"]["identifier"] |
| 40 | +20211001-8b6f100d66f4312d539c52620f79d6a503c1e2d1 |
65 | 41 | ```
|
66 | 42 |
|
67 | 43 | ## Use from terminal
|
68 | 44 |
|
69 | 45 | List all experiments on elabftw belonging to user "Liam":
|
70 | 46 |
|
71 | 47 | ```bash
|
72 |
| -liam@ssc:~$ elabftw-list Liam |
| 48 | +$ elabftw-list Liam |
73 | 49 | 163: test fake experiment without json metadata (Liam Keegan, 2021-10-07)
|
74 | 50 | 156: test fake experiment with json metadata (Liam Keegan, 2021-10-01)
|
75 | 51 | ```
|
0 commit comments