# Execution ## Execution in command line ### Binary path configuration First off, we recommend to configure binary paths in your environment in order to ease the command line execution. For doing that, please follow the next steps: #### Create binary folder Remember to change the */home/user_name/projects/* path to the real path on your computer. ```Shell mkdir /home/user_name/projects/bin ``` #### Change python file permissions Remember to change the */home/user_name/projects/* path to the real path on your computer. ```Shell chmod +x /home/user_name/projects/biobb_template/biobb_template/template/template.py ``` #### Create symlink to python file Remember to change the */home/user_name/projects/* path to the real path on your computer. ```Shell cd /home/user_name/projects/bin ln -s /home/user_name/projects/biobb_template/biobb_template/template/template.py template ``` #### Create conda activate actions Remember to change the */[anaconda-path]* and the */home/user_name/projects/* path to the real paths on your computer. ```Shell cd /[anaconda-path]/envs/biobb_template/etc mkdir conda cd conda/ mkdir activate.d cd activate.d/ printf '#!/usr/bin/env bash\n\nexport BIOBB_OLD_PATH=$PATH\nexport PATH=/home/user_name/projects/bin:$PATH\n' > biobb_template.sh ``` #### Create conda deactivate actions Remember to change the */[anaconda-path]* and the */home/user_name/projects/* path to the real paths on your computer. ```Shell cd /[anaconda-path]/envs/biobb_template/etc/conda mkdir deactivate.d cd deactivate.d/ printf '#!/usr/bin/env bash\n\nexport PATH=$BIOBB_OLD_PATH\n' > biobb_template.sh ``` #### Restart environment ```Shell conda deactivate conda activate biobb_template ``` ### Execution All the information about the command line execution of a **BioBB** can be found here: [https://biobb-template.readthedocs.io/en/latest/command_line.html](https://biobb-template.readthedocs.io/en/latest/command_line.html) ## Execution in Jupyter Notebook **Jupyter Notebook** (formerly IPython Notebooks) is a web-based interactive computational environment for creating [Jupyter](https://jupyter.org/) notebook documents. The *notebook* term can colloquially make reference to many different entities, mainly the Jupyter web application, Jupyter Python web server, or Jupyter document format depending on context. A **Jupyter Notebook** document is a JSON document, following a versioned schema, and containing an ordered list of **input/output cells** which can contain code, text (using Markdown), mathematics, plots and rich media, usually ending with the ".ipynb" extension. A Jupyter Notebook can be converted to a number of open standard output formats (**HTML**, **presentation slides**, **LaTeX**, **PDF**, **ReStructuredText**, **Markdown**, **Python**) through *Download As* in the web interface, via the nbconvert library or *jupyter nbconvert* command line interface in a shell. To simplify visualisation of **Jupyter Notebook** documents on the web, the nbconvert library is provided as a service through NbViewer which can take a URL to any publicly available notebook document, convert it to **HTML on the fly** and display it to the user. Basic examples of **Jupyter Notebook** execution for *biobb_template* can be found here: [https://github.com/bioexcel/biobb_template/blob/master/biobb_template/notebooks/template/template.ipynb](https://github.com/bioexcel/biobb_template/blob/master/biobb_template/notebooks/template/template.ipynb) The execution is pretty straightforward: 1. We must **create an object** with the tool **properties** in case the properties are mandatory for this tool. More information about the properties [clicking here](https://biobb-documentation.readthedocs.io/en/latest/arguments.html#properties). 2. We call the **tool class** with the mandatory **inputs** / **outputs** and the **properties** defined in the previous step. ```python prop = { "boolean_property": False, "remove_tmp": True } template(input_file_path1=input1, input_file_path2=input2, output_file_path=output, properties=prop) ``` After executing this cell in **Jupyter Notebook** we will get the output log generated by the tool. In the example above, it should be something like this: ```python 2020-02-20 17:34:14,566 [MainThread ] [INFO ] Creating 19838984-a76c-401e-9226-4a814268391c temporary folder 2020-02-20 17:34:14,587 [MainThread ] [INFO ] Creating command line with instructions and required arguments 2020-02-20 17:34:14,597 [MainThread ] [INFO ] Appending optional argument to command line 2020-02-20 17:34:15,173 [MainThread ] [INFO ] zip -j output 19838984-a76c-401e-9226-4a814268391c/input1 19838984-a76c-401e-9226-4a814268391c/input2 2020-02-20 17:34:15,178 [MainThread ] [INFO ] Exit code 0 2020-02-20 17:34:15,181 [MainThread ] [INFO ] adding: input1 (deflated 87%) adding: input2 (deflated 14%) 2020-02-20 17:34:15,191 [MainThread ] [INFO ] Removed: 19838984-a76c-401e-9226-4a814268391c ``` ## Execution in a workflow TODO