Skip to content
Snippets Groups Projects
Commit 747f28a7 authored by Swen Vermeul's avatar Swen Vermeul
Browse files

jupyter notebook added

parent d1f614b1
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
# Using pybis
%% Cell type:markdown id: tags:
## Log into openBIS
%% Cell type:code id: tags:
``` python
from pybis import Openbis
import getpass
o = Openbis('https://localhost:8443', verify_certificates=False)
password = getpass.getpass()
o.login('vermeul',password)
o.token
```
%% Output
········
'vermeul-160707110248298xF6BBB7B360CEB4604AAC9914FFC064A5'
%% Cell type:markdown id: tags:
## create a sample
%% Cell type:code id: tags:
``` python
new_sample = o.new_sample(sample_name='oh_wie_schoen_ist_panama5', space_name='VERMEUL', tags=['uno','due','tre'])
```
%% Cell type:code id: tags:
``` python
new_sample.ident
```
%% Output
'/VERMEUL/OH_WIE_SCHOEN_IST_PANAMA5'
%% Cell type:markdown id: tags:
## get a sample
%% Cell type:code id: tags:
``` python
s = o.get_sample("/VERMEUL/OH_WIE_SCHOEN_IST_PANAMA4")
s.permid
```
%% Output
'20160630112919449-91'
%% Cell type:code id: tags:
``` python
s.ident
```
%% Output
'/VERMEUL/OH_WIE_SCHOEN_IST_PANAMA4'
%% Cell type:code id: tags:
``` python
datasets = s.get_datasets()
ds1 = datasets[0]
```
%% Cell type:code id: tags:
``` python
ds1.get_file_list()
```
%% Output
[{'@id': 1,
'@type': 'FileInfoDssDTO',
'crc32Checksum': None,
'fileSize': '-1',
'isDirectory': True,
'pathInDataSet': 'original',
'pathInListing': 'original'},
{'@id': 2,
'@type': 'FileInfoDssDTO',
'crc32Checksum': None,
'fileSize': '-1',
'isDirectory': True,
'pathInDataSet': 'original/results',
'pathInListing': 'original/results'},
{'@id': 3,
'@type': 'FileInfoDssDTO',
'crc32Checksum': -895786725,
'fileSize': '16',
'isDirectory': False,
'pathInDataSet': 'original/results/blublu',
'pathInListing': 'original/results/blublu'}]
%% Cell type:code id: tags:
``` python
ds1.download('original/results/blublu')
```
%% Cell type:code id: tags:
``` python
cat localhost/20160705171928021-202/original/results/blublu
```
%% Output
this is my data.
%% Cell type:markdown id: tags:
## create a dataset and upload data
%% Cell type:code id: tags:
``` python
dataset = o.new_dataset(
sample=s, type='JUPYTER_NOTEBOOK',
datastore='DSS1',
files=['pybis_playground_localhost.ipynb']
)
```
%% Cell type:code id: tags:
``` python
dataset.register()
```
%% Cell type:markdown id: tags:
## Analysis ##
An analysis has a name, description and parent dataset. Anytime it is saved, a new version of it is saved. On openBIS, an analysis is a container object which contains the result datafiles and the jupyter notebook. If an analysis is saved a second time, two new datasets are generated, both having parents of their previous datasets set.
%% Cell type:code id: tags:
``` python
analysis = o.new_analysis(
parent=dataset,
name="my analysis",
description= "this time, there should be a meaningful explanation",
results=["results/blublu_processed"]
)
```
%% Cell type:code id: tags:
``` python
analysis.save()
```
%% Cell type:markdown id: tags:
## get available dataset types
%% Cell type:code id: tags:
``` python
o.get_dataset_types()
```
%% Output
code description kind
0 ELN_PREVIEW ELN Preview image PHYSICAL
1 SEQ_FILE PHYSICAL
2 RAW_DATA PHYSICAL
3 ANALYZED_DATA PHYSICAL
4 ATTACHMENT PHYSICAL
5 DRAWING_BOARD PHYSICAL
6 JUPYTER_CONTAINER Jupyter Analysis Results CONTAINER
7 JUPYTER_NOTEBOOK Analysis Notebook Files PHYSICAL
8 UNKNOWN Unknown PHYSICAL
9 JUPYTER_RESULT Analysis Results Files PHYSICAL
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment