Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
9d13669f
Commit
9d13669f
authored
6 years ago
by
hluetcke
Committed by
Adam Laskowski
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
minor changes
parent
b4c44e30
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!40
SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
MatlabPybis_example.m
+71
-71
71 additions, 71 deletions
MatlabPybis_example.m
passwordEntryDialog.m
+405
-405
405 additions, 405 deletions
passwordEntryDialog.m
pybis_test.ipynb
+581
-581
581 additions, 581 deletions
pybis_test.ipynb
with
1057 additions
and
1057 deletions
MatlabPybis_example.m
+
71
−
71
View file @
9d13669f
% demo script for accessing openBIS from Matlab using Pybis
% demo script for accessing openBIS from Matlab using Pybis
% we use Matlab's capability to call Python libraries
% we use Matlab's capability to call Python libraries
% Pybis documentation is available here:
% Pybis documentation is available here:
% https://sissource.ethz.ch/sispub/pybis/blob/master/src/python/PyBis/README.md
% https://sissource.ethz.ch/sispub/pybis/blob/master/src/python/PyBis/README.md
%% first check the Python version
%% first check the Python version
pyversion
pyversion
% a different Python version can be selected by specifying the Python
% a different Python version can be selected by specifying the Python
% executable, e.g. pyversion /Users/Henry/miniconda3/bin/python
% executable, e.g. pyversion /Users/Henry/miniconda3/bin/python
%% enter username and password for openBIS
%% enter username and password for openBIS
username
=
'hluetcke'
;
username
=
'hluetcke'
;
pw
=
passwordEntryDialog
(
'CheckPasswordLength'
,
0
);
pw
=
passwordEntryDialog
(
'CheckPasswordLength'
,
0
);
%% connect to openBIS
%% connect to openBIS
obi
=
py
.
pybis
.
Openbis
(
'https://limb.ethz.ch/openbis:8443'
,
pyargs
(
'verify_certificates'
,
0
));
obi
=
py
.
pybis
.
Openbis
(
'https://limb.ethz.ch/openbis:8443'
,
pyargs
(
'verify_certificates'
,
0
));
obi
.
login
(
username
,
pw
,
pyargs
(
'save_token'
,
1
));
obi
.
login
(
username
,
pw
,
pyargs
(
'save_token'
,
1
));
clear
pw
clear
pw
obi
obi
%% select datasets
%% select datasets
datasets
=
obi
.
get_datasets
(
pyargs
(
'type'
,
'HISTOLOGY'
));
datasets
=
obi
.
get_datasets
(
pyargs
(
'type'
,
'HISTOLOGY'
));
datasets
datasets
%% download dataset
%% download dataset
% get specific dataset
% get specific dataset
ds_id
=
'20101105142049776-6512'
;
ds_id
=
'20101105142049776-6512'
;
ds
=
obi
.
get_dataset
(
ds_id
);
ds
=
obi
.
get_dataset
(
ds_id
);
% download
% download
data_dir
=
'/Users/Henry/Data/Projects/MatlabOpenbis/data'
;
data_dir
=
'/Users/Henry/Data/Projects/MatlabOpenbis/data'
;
ds
.
download
(
pyargs
(
'destination'
,
data_dir
,
'wait_until_finished'
,
false
));
ds
.
download
(
pyargs
(
'destination'
,
data_dir
,
'wait_until_finished'
,
false
));
%% list files / directories in dataset
%% list files / directories in dataset
% get list and convert to Matlab cell array
% get list and convert to Matlab cell array
files
=
cell
(
ds
.
get_file_list
);
files
=
cell
(
ds
.
get_file_list
);
for
iii
=
1
:
numel
(
files
)
for
iii
=
1
:
numel
(
files
)
iii_file
=
files
{
iii
};
iii_file
=
files
{
iii
};
fprintf
(
'%d - %s - isDir: %d\n'
,
iii
,
string
(
iii_file
{
'pathInDataSet'
}),
iii_file
{
'isDirectory'
})
fprintf
(
'%d - %s - isDir: %d\n'
,
iii
,
string
(
iii_file
{
'pathInDataSet'
}),
iii_file
{
'isDirectory'
})
end
end
%% Spaces
%% Spaces
% list spaces
% list spaces
spaces
=
obi
.
get_spaces
;
spaces
=
obi
.
get_spaces
;
spaces
spaces
% create a new space
% create a new space
space_id
=
'MATLAB_TEST'
;
space_id
=
'MATLAB_TEST'
;
space
=
obi
.
new_space
(
pyargs
(
'code'
,
space_id
,
'description'
,
'test space for Matlab access to openBIS'
));
space
=
obi
.
new_space
(
pyargs
(
'code'
,
space_id
,
'description'
,
'test space for Matlab access to openBIS'
));
space
space
space
.
save
;
space
.
save
;
% delete created space afterwards
% delete created space afterwards
% space.delete('just a test');
% space.delete('just a test');
%% Projects
%% Projects
% list projects in Space
% list projects in Space
space
.
get_projects
space
.
get_projects
% create new project
% create new project
project_code
=
'test_project'
;
project_code
=
'test_project'
;
project_description
=
'my awsome project'
;
project_description
=
'my awsome project'
;
project
=
space
.
new_project
(
pyargs
(
'code'
,
project_code
,
...
project
=
space
.
new_project
(
pyargs
(
'code'
,
project_code
,
...
'description'
,
project_description
));
'description'
,
project_description
));
project
=
project
.
save
();
project
=
project
.
save
();
space
.
get_projects
space
.
get_projects
%% clean up
%% clean up
% logout
% logout
obi
.
logout
()
obi
.
logout
()
This diff is collapsed.
Click to expand it.
passwordEntryDialog.m
+
405
−
405
View file @
9d13669f
This diff is collapsed.
Click to expand it.
pybis_test.ipynb
+
581
−
581
View file @
9d13669f
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment