Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update installation instructions #1039

Merged
merged 13 commits into from
Sep 24, 2024
29 changes: 28 additions & 1 deletion README.md
rvhonorato marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,34 @@ HADDOCK, standing for **H**igh **A**mbiguity **D**riven protein-protein **DOCK**

## Installation

Please check the [INSTALL](docs/INSTALL.md) file for instructions.
Clone the repository and run `pip install .`;

```bash
git clone https://github.com/haddocking/haddock3
cd haddock3
pip install .
```

Execute:

```bash
$ haddock3 -h
usage: haddock3 [-h] [--restart RESTART] [--extend-run EXTEND_RUN] [--setup] [--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [-v] recipe

positional arguments:
recipe The input recipe file path
rvhonorato marked this conversation as resolved.
Show resolved Hide resolved

optional arguments:
-h, --help show this help message and exit
--restart RESTART Restart the run from a given step. Previous folders from the selected step onwards will be deleted.
--extend-run EXTEND_RUN
Start a run from a run directory previously prepared with the `haddock3-copy` CLI. Provide the run directory created with `haddock3-copy` CLI.
--setup Only setup the run, do not execute
--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
-v, --version show version
```

For the installation of third-party additional software, please check the [INSTALL](docs/INSTALL.md).

You might also want to check the following utilities:

Expand Down
123 changes: 13 additions & 110 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,130 +1,31 @@
# Installation

Open a `terminal` window and navigate to the folder where you want to
install HADDOCK3; for example: `software`. The current installation
instructions are local and will affect only your user.

Before starting with the installation of HADDOCK3, make sure to properly [install CNS](CNS.md).
If you have installed a previous version of HADDOCK, you may already have a suitable version of CNS.
Please do [check your CNS installation](CNS.md#5-Check-installation) before proceeding.


## 1. Clone this repository:

Mind the `--recursive` flag when cloning!

```bash
git clone --recursive https://github.com/haddocking/haddock3.git
```

Go to the **haddock3** directory

```bash
cd haddock3
```

and type the following commands to first install the [FCC](https://github.com/haddocking/fcc) source code provided

```bash
cd src/fcc/src
chmod u+x Makefile
make
cd -
```

Then, follow the same logic to install the [fast-rmsdmatrix](https://github.com/mgiulini/fast-rmsdmatrix) source code

```bash
cd src/fast-rmsdmatrix/src
chmod u+x Makefile
make fast-rmsdmatrix
cd -
```

By the end of the above commands, you should be back to the **haddock3**
main folder.

## 2 Create a virtual environment with Python 3.9+ and install dependencies:
Create a virtual environment with Python 3.9:

You can use Python's `venv` or `conda` depending on your choice.
Commands are provided below:

### with `venv`

```bash
virtualenv venv --python=3.9
source venv/bin/activate
pip install -r requirements.txt
python -m venv .venv
source .venv/bin/activate
```

### with `conda`

```bash
conda create -n haddock3 python=3.9
conda activate haddock3
pip install -r requirements.txt
```

## 3. Install the HADDOCK3 package and command line clients

```bash
python setup.py develop --no-deps
```

Of note, here we are still using the depreacted `setup.py` command due to HPC, GRID and LOCAL compabilities with CNS.

## 4. Make a CNS binary shortcut to the expected path:

```bash
mkdir -p bin/

# on mac
ln -s /PATH/TO/cns_solve_1.3/mac-intel-darwin/source/cns_solve-2206031450.exe bin/cns

# on linux
ln -s /PATH/TO/cns_solve_1.3/intel-x86_64bit-linux/source/cns_solve-2002171359.exe bin/cns
```

As long as you have the `(haddock3)` python environment activated, you can
navigate away from the **haddock3** installation folder. You can run
HADDOCK3 from anywhere. To run HADDOCK3, follow the [usage
guidelines](USAGE.md).


## 5. Keep your installation up to date

Navigate to the **haddock3** installation folder (the one you cloned from
GitHub). Ensure you have the `(haddock3)` python environment activated.
Please keep in mind that HADDOCK3, as well as its
dependencies, are under active development.
If the updating processing fails, it is safest to reinstall
from scratch. Always refer to the latest installation guidelines.

```bash
# if you used `venv`
source venv/bin/activate

# if you used `conda`
conda activate haddock3
```

Afterwards:

```bash
# pull the latest source code from our repository to your computer
git pull

# update the dependencies by running:
pip install -r requirements.txt --upgrade

# ensure all command-lines clients are installed
python setup.py develop --no-deps
rvhonorato marked this conversation as resolved.
Show resolved Hide resolved
git clone https://github.com/haddocking/haddock3.git
cd haddock3
pip install .
```

Of note, here we are still using the depreacted `setup.py` command due to HPC, GRID and LOCAL compabilities with CNS.


## 6. (Optional) Install MPI libraries if you intend to run HADDOCK3 with MPI
## (Optional) Install MPI libraries if you intend to run HADDOCK3 with MPI

To use the mpi implementation of haddock3 you must have mpi4py installed in the `(haddock3)` python environment, and OpenMPI in the host system.

Expand All @@ -136,7 +37,7 @@ $ conda install -c conda-forge mpi4py

Later, you can find [here](https://www.bonvinlab.org/haddock3/tutorials/mpi.html) instructions on how to run HADDOCK3 with MPI.

## 7. (Optional) Install web service dependencies if you intend to run HADDOCK3 restraints web service
## (Optional) Install web service dependencies if you intend to run HADDOCK3 restraints web service

To run the restraints web service you must have the following dependencies installed in the `(haddock3)` python environment:

Expand All @@ -146,21 +47,21 @@ pip install uvicorn fastapi

Information on the restraints web service can be found [here](https://github.com/haddocking/haddock3/blob/main/src/haddock/clis/restraints/webservice.py).

# Installing third-party packages
## Installing third-party packages

HADDOCK3 can integrate third-party software in its workflows.
We are not responsible for the proper installation of such packages, but
we help you install them. Below, you will find a list of all third-party
packages HADDOCK3 can use and guidelines for their proper installation.

## `lightdock`
### `lightdock` (outdated)

To install [lightdock](https://github.com/lightdock/lightdock) follow
the instructions on the project's website. Remember to install it under
the same Python environment you created for HADDOCK3. If you have any
doubts, please let us know.

## `gdock`
### `gdock` (outdated)

1. Clone the latest version:

Expand All @@ -170,11 +71,13 @@ git clone https://github.com/rvhonorato/gdock.git
```

2. Install Python3+ dependencies

```
pip install deap scipy mgzip biopython
```

3. Set `GDOCK_PATH`

```
export GDOCK_PATH=some-folder
```
Expand Down
17 changes: 10 additions & 7 deletions src/haddock/clis/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@
ap = argparse.ArgumentParser()

ap.add_argument(
"recipe",
"workflow",
type=arg_file_exist,
help="The input recipe file path",
)
help=(
"The input configuration file path describing "
"the workflow to be performed"
),
)

add_restart_arg(ap)
add_extend_run(ap)
Expand Down Expand Up @@ -76,7 +79,7 @@ def maincli() -> None:


def main(
recipe: FilePath,
workflow: FilePath,
restart: Optional[int] = None,
extend_run: Optional[FilePath] = EXTEND_RUN_DEFAULT,
setup_only: bool = False,
Expand All @@ -87,8 +90,8 @@ def main(

Parameters
----------
recipe : str or pathlib.Path
The path to the recipe (config file).
workflow : str or pathlib.Path
The path to the workflow (config file).

restart : int
The step to restart the run from (inclusive).
Expand Down Expand Up @@ -145,7 +148,7 @@ def main(

with log_error_and_exit():
params, other_params = setup_run(
recipe,
workflow,
restart_from=restart,
extend_run=extend_run,
)
Expand Down
30 changes: 16 additions & 14 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
from . import configs_data


recipe = Path(configs_data, 'recipe.cfg')
@pytest.fixture(name="workflow")
def fixture_workflow():
yield Path(configs_data, "recipe.cfg")


def test_cli_has_maincli():
Expand All @@ -21,29 +23,29 @@ def test_cli_has_maincli():


def test_ap_recipe_does_not_exist():
"""Test raise error if recipe does not exist."""
"""Test raise error if workflow does not exist."""
with pytest.raises(SystemExit) as exit:
cli.ap.parse_args('does_not_exit.cfg'.split())
assert exit.type == SystemExit
assert exit.value.code == 2


def test_ap_recipe_exists():
"""Test reading recipes."""
cmd = cli.ap.parse_args(str(recipe).split())
with open(cmd.recipe) as fin:
def test_ap_workflow_exists(workflow):
"""Test reading workflows."""
cmd = cli.ap.parse_args(str(workflow).split())
with open(cmd.workflow) as fin:
fin.readlines()


def test_ap_setup_true():
def test_ap_setup_true(workflow):
"""Test --setup flag."""
cmd = cli.ap.parse_args(f'{recipe} --setup'.split())
cmd = cli.ap.parse_args(f'{workflow} --setup'.split())
assert cmd.setup_only is True


def test_ap_setup_false():
def test_ap_setup_false(workflow):
"""Test setup only default."""
cmd = cli.ap.parse_args(str(recipe).split())
cmd = cli.ap.parse_args(str(workflow).split())
assert cmd.setup_only is False


Expand All @@ -59,15 +61,15 @@ def test_ap_version():
'level',
("DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"),
)
def test_ap_log_level(level):
def test_ap_log_level(workflow, level):
"""Test --log-level correct."""
cmd = cli.ap.parse_args(f'{recipe} --log-level {level}'.split())
cmd = cli.ap.parse_args(f'{workflow} --log-level {level}'.split())
assert cmd.log_level == level


def test_ap_log_level_error():
def test_ap_log_level_error(workflow):
"""Test --log-level error with bad input."""
with pytest.raises(SystemExit) as exit:
cli.ap.parse_args(f'{recipe} --log-level BAD'.split())
cli.ap.parse_args(f'{workflow} --log-level BAD'.split())
assert exit.type == SystemExit
assert exit.value.code == 2
Loading