pybiouml¶
- class src.pybiouml.pybiouml.PyBiouml[source]¶
This library is a python API interface for using BioUML Web service
- analysis(analysis_name, wait=True, verbose=True, parameters=None, **params)[source]¶
Method for run BioUML analysis, optionally tracking progress
- Parameters:
analysis_name (str) – name of BioUML analysis to run, use PyBiouml.analysis_list to get the list of possible values
wait (bool) – whether to wait for analysis completion or return immediately
verbose (bool) – print messages and progress from BioUML analysis, only meaningful if wait is TRUE
parameters (dict) – a dictionary of parameters to BioUML analysis, use PyBiouml.analysis_parameters to get the table of parameters. Default None, this method can take parameters through **params.
params – parameters to BioUML analysis, use PyBiouml.analysis_parameters to get the table of parameters. Collect any other parameters which are give to the method and return a dictionary with them.
- Returns:
job_id: return a job id of started work, that can be passed to PyBiouml.job_info and PyBiouml.job_wait.
- Return type:
str
- analysis_list()[source]¶
Method that fetches list of available analyses from current BioUML server
- Returns:
DataFrame table of analysis with two column ’Group’ and ’Name’.
- Return type:
pandas.DataFrame
- analysis_parameters(analysis_name)[source]¶
Get BioUML analysis parameters names and description
- Parameters:
analysis_name (str) – me of BioUML analysis, , use PyBiouml.analysis_list to get the list of possible values
- Returns:
DataFrame which contains row with names corresponding to parameter names and one column ’description’ with parameter description
- Return type:
pandas.DataFrame
- as_tree(params_dictionary)[source]¶
Service method for parsing dictionary with parameters to json, which can be used by BioUML Web service.
- Parameters:
params_dictionary (dict) – dictionary with parameters
- Returns:
parameters in json format
- export(path, exporter_params=None, exporter='Tab-separated text (*.txt)', target_file='biouml.out')[source]¶
Method exports data from BioUML server to local file in given format
- Parameters:
path (str) – path in BioUML repository.
exporter_params – dictionary of parameters to exporter. Default None.
exporter (str) – character string specifying format, PyBiouml_exporters provides possible values.
target_file (str) – a character string naming a file to export to. Default biouml.out
- export_parameters(path, exporter)[source]¶
Method get BioUML export parameters
- Parameters:
path (str) – path to data element in BioUML repository to export
exporter (str) – name of BioUML exporter, use PyBiouml.exporters to get the table of possible values
- Returns:
DataFrame which contains row with names corresponding to parameter names and one column ’description’ with parameter description
- Return type:
pandas.DataFrame
- exporters()[source]¶
Method fetches the list of exporters from BioUML server, these exporters can be used in PyBiouml.export method
- Returns:
list with expoters
- get(path)[source]¶
Method fetches table data from BioUML server.
- Parameters:
path (str) – Path to table in BioUML repository.
- Return crafted_table:
return DataFrame representation of BioUML table from path.
- Rtype crafted_table:
pandas.DataFrame
- get_connection()[source]¶
Service method for creation a connection with BioUML Web Service, which checks if user was logged into BioUML
- Return connection:
connection link
- import_parameters(path, importer)[source]¶
Method Get BioUML import parameters
- Parameters:
path (str) – path to data element in BioUML repository to import
importer (str) – name of BioUML importer, use biouml.importers to get the list of possible values
- Returns:
DataFrame which contains row with names corresponding to parameter names and one column ’description’ with parameter description
- Return type:
pandas.DataFrame
- importers()[source]¶
Method fetches the list of importers from BioUML server, these importers can be used in PyBiouml.to_import method
- Returns:
list with expoters
- job_info(job_id)[source]¶
Method info fetches info about BioUML job.
- Parameters:
job_id (str) – ID of job usually returned from PyBiouml.analysis
- Returns:
info: json with information about requested process (status, results, values, percent)
- job_wait(job_id, verbose=True)[source]¶
Waits for BioUML job completion
- Parameters:
job_id – ID of job usually returned from biouml.analysis
verbose – print messages and progress from BioUML job
- Returns:
json with information about requested process (status, results, values, percent)
- login(url='http://localhost:8080/biouml', user='', password='')[source]¶
Method which LogintoBioUMLserver. Theconnectionwillbesavedinglobaloptionsundernamebiouml_connection for future reuse.
- Parameters:
url (str) – URLof running biouml server. Default it is http://localhost:8080/biouml, like an example of local biouml service.
user (str) – BioUML user, empty string for anonymous login.
password (str) – password.
- ls(path, extended=False)[source]¶
Method lists children data elements by path in BioUML repository.
- Parameters:
path (str) – path to data collection in BioUML repository.
extended (bool) – whether to return additional attributes for each children.
- Returns:
df: If extended is False a DataFrame with child names, otherwise a DataFrame wich contains row with names corresponding to child names and columns hasChildren and type.
- Return type:
pandas.DataFrame
- parameters(server_path, **params)[source]¶
Service method, which create a request to get parameters
- Parameters:
server_path (str) – path to target of the request for which need to take parameters
params – This parameter collect any other parameters which are give to the method and return a dictionary with them.
- Returns:
DataFrame with all parameters
- Return type:
pandas.DataFrame
- put(path, value)[source]¶
Method to put usere’s table on BioUML Web Service.
- Parameters:
path (str) – path to repository for table.
value (DataFrame) – pandas DataFrame table to put
- query(servers_path, data, file=None, binary=False)[source]¶
Service method for making post request with time and size logging
- Returns:
result of post request
- query_json(server_path, reconnect=True, parameters=None, **params)[source]¶
Service method for json return of connection with time and size logging
- Parameters:
server_path (str) – path to required server.
reconnect (bool) – try to reconnect or not.
parameters (dict) – a dictionary with parameters for connection. Default None, this method can take parameters through **params.
params – This parameter collect any other parameters which are give to the method and return a dictionary with them.
- Return json_content:
return a result of the request in json format.
- Rtype json_content:
json
- to_import(file, parentPath, importer, importer_params=None)[source]¶
Method imports file to BioUML repository.
- Parameters:
file – The name of file to import.
parentPath (str) – Path to folder in BioUML repository.
importer (str) – character string specifying format, PyBiouml.importers() provides list of posible values
importer_params – dictionary of parameters to importer
- Returns:
Resulting path in BioUML repository
- Return type:
str
- workflow(path, parameters=None, wait=True, verbose=True)[source]¶
Method run BioUML workflow optionaly tracking progress.
- Parameters:
path (str) – path to BioUML workflow
parameters – list of parameters to BioUML workflow.
wait (bool) – whether to wait for workflow completion or return immediately
verbose (bool) – print messages and progress from BioUML workflow, only meaningful if wait is TRUE
- Returns:
job_id: return a job id of started work, that can be passed to PyBiouml.job_info and PyBiouml.job_wait.
- Return type:
str