"git@sissource.ethz.ch:sispub/openbis.git" did not exist on "c81eb0e8735ffa65d91ce9d6539e5b6f2a4bf3b2"
Newer
Older
{
"cells": [
{
"cell_type": "code",
"metadata": {},
"outputs": [],
"source": [
"from pybis import Openbis\n",
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Connecting to openBIS"
]
},
{
"cell_type": "code",
"metadata": {},
"outputs": [],
"source": [
"o = Openbis('https://127.0.0.1/openbis:8443', verify_certificates=False)"
]
},
{
"cell_type": "code",
"pw = getpass.getpass()"
]
},
{
"cell_type": "code",
"metadata": {},
"outputs": [],
"source": [
"o.login(username, pw, save_token=True) # saves the session token in ~/.pybis/example.com.token\n",
"del pw"
]
},
{
"cell_type": "code",
"source": [
"o.token"
]
},
{
"cell_type": "code",
"source": [
"o.is_session_active()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"o.get_datastores()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Masterdata"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
"source": [
"o.get_experiment_types()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"o.get_sample_types()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"o.get_sample_type('PLATE')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"o.get_material_types()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"o.get_dataset_types()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"o.get_terms()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"obj = o.new_object(type='UNKNOWN', space='MATLAB_TEST', code='12345')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
]
},
{
"cell_type": "code",
"metadata": {},
"outputs": [],
"source": [
"sample = o.get_sample('/MATLAB_TEST/911922')"
]
},
{
"cell_type": "code",
"source": [
"sample.delete('just a test')"
]
},
{
"cell_type": "markdown",
"metadata": {},
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"counter = 0\n",
"for ds in datasets:\n",
" print(ds)\n",
" counter += 1\n",
" if counter > 10:\n",
" break"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ds = o.get_dataset('20101105142049776-6512')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ds.get_files(start_folder='original')"
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Experiments / collections"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"o.get_experiments(\n",
" project='TEST_PROJECT',\n",
" space='MATLAB_TEST'\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"experiment = o.get_experiment('/MATLAB_TEST/TEST_PROJECT/E1300')\n",
"experiment"
]
},
{
"cell_type": "code",
"source": [
"experiment.props"
]
},
{
"cell_type": "code",
"metadata": {},
"outputs": [],
"source": [
"experiment = o.new_experiment(type='UNKNOWN', code='EXP123456789', project='/HLUETCKE/PLAYGROUND')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
]
},
{
"cell_type": "code",
"source": [
"project = o.new_project('HLUETCKE', 'test_project', 'boring project')"
]
},
{
"cell_type": "code",
"source": [
"project.save()"
]
},
"metadata": {},
"outputs": [],
"source": [
"experiment = o.new_experiment(type='UNKNOWN', code='EXP333', project='/HLUETCKE/TEST_PROJECT')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"o.get_objects('SIS_HLUETCKE/')"
]
},
{
"cell_type": "markdown",
"metadata": {},
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ds.download(files='', destination='data', wait_until_finished=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.imshow(plt.imread('data/20101105142920015-6525/original/441_x40001.tif'))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"o.get_experiment_types()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"o.get_dataset_types()"
]
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"o.get_projects(space='MATLAB_TEST', code=None)"
]
},
{
"cell_type": "code",
"metadata": {},
"outputs": [],
"source": [
"project = o.new_project(space='MATLAB_TEST', code='ANOTHER_TEST', description='TGIF')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"project.save()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"project.delete('just a test')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
]
},
{
"cell_type": "code",
"source": [
"file_list = [\n",
" '/Users/Henry/Data/temp/file1.dat',\n",
" '/Users/Henry/Data/temp/file2.dat',\n",
" '/Users/Henry/Data/temp/file3.dat'\n",
"]\n",
"file_list"
]
},
{
"cell_type": "code",
"outputs": [],
"source": [
"ds_new = o.new_dataset(type='ANALYZED_DATA', experiment='/HLUETCKE/DEMO/DEMO_EXP_1', sample='/HLUETCKE/DEMO/S43', files=file_list)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ds_new.save()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Logout"
]
},
{
"cell_type": "code",
"outputs": [],
"source": [
"o.logout()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
}
},
"nbformat": 4,