Skip to content

Commit 44c63d9

Browse files
committed
Initial commit
0 parents  commit 44c63d9

File tree

1,217 files changed

+14271
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,217 files changed

+14271
-0
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.ipynb_checkpoints
2+
*.pyc
3+
*.egg-info
4+
work
5+
.idea
6+
.DS_Store
7+
.kube-tmp-token
8+
tests/robot/results

Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM continuumio/miniconda
2+
3+
RUN apt-get update -y && apt-get install -y --no-install-recommends \
4+
build-essential
5+
6+
RUN conda config --add channels bioconda \
7+
&& conda config --add channels conda-forge
8+
9+
WORKDIR /opt/biophi
10+
11+
COPY environment.yml .
12+
COPY Makefile .
13+
14+
RUN make env-update ENV_NAME=base
15+
16+
COPY . .
17+
18+
RUN make env-setup ENV_NAME=base
19+
20+
RUN useradd docker \
21+
&& mkdir /home/docker \
22+
&& chown docker:docker /home/docker \
23+
&& addgroup docker staff
24+
USER docker
25+
26+
CMD [ "biophi", "web", "--host", "0.0.0.0" ]

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright © 2021 Merck Sharp & Dohme Corp. a subsidiary of Merck & Co., Inc., Kenilworth, NJ, USA."
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

LICENSES_THIRD_PARTY

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
Name Version License URL
2+
Cython 0.29.23 Apache Software License http://cython.org/
3+
Flask 2.0.1 BSD License https://palletsprojects.com/p/flask
4+
Flask-Humanize 0.3.0 MIT License https://github.com/vitalk/flask-humanize
5+
Jinja2 3.0.1 BSD License https://palletsprojects.com/p/jinja/
6+
MarkupSafe 2.0.1 BSD License https://palletsprojects.com/p/markupsafe/
7+
PyYAML 5.4.1 MIT License https://pyyaml.org/
8+
SQLAlchemy 1.4.19 MIT License http://www.sqlalchemy.org
9+
Werkzeug 2.0.1 BSD License https://palletsprojects.com/p/werkzeug/
10+
XlsxWriter 1.4.3 BSD License https://github.com/jmcnamara/XlsxWriter
11+
abnumber 0.2.6 MIT https://github.com/prihoda/abnumber
12+
amqp 5.0.6 BSD License http://github.com/celery/py-amqp
13+
anarci 2020.04.23 See url https://github.com/oxpig/ANARCI/blob/master/LICENCE
14+
antlr4-python3-runtime 4.8 BSD http://www.antlr.org
15+
attrs 21.2.0 MIT License https://www.attrs.org/
16+
billiard 3.6.4.0 BSD License https://github.com/celery/billiard
17+
biophi 1.0.0 MIT https://github.com/Merck/BioPhi
18+
biopython 1.79 Freely Distributable https://biopython.org/
19+
celery 5.1.1 BSD License http://celeryproject.org
20+
certifi 2021.5.30 Mozilla Public License 2.0 (MPL 2.0) https://certifiio.readthedocs.io/en/latest/
21+
cffi 1.14.5 MIT License http://cffi.readthedocs.org
22+
chardet 4.0.0 GNU Library or Lesser General Public License (LGPL) https://github.com/chardet/chardet
23+
click 7.1.2 BSD License https://palletsprojects.com/p/click/
24+
click-didyoumean 0.0.3 BSD License https://github.com/timofurrer/click-didyoumean
25+
click-plugins 1.1.1 BSD License https://github.com/click-contrib/click-plugins
26+
click-repl 0.2.0 MIT https://github.com/untitaker/click-repl
27+
dataclasses 0.6 Apache Software License https://github.com/ericvsmith/dataclasses
28+
fairseq 0.10.2 MIT License https://github.com/pytorch/fairseq
29+
greenlet 1.1.0 MIT License https://greenlet.readthedocs.io/
30+
humanize 3.9.0 MIT License https://github.com/jmoiron/humanize
31+
hydra-core 1.1.0 MIT License https://github.com/facebookresearch/hydra
32+
idna 2.10 BSD License https://github.com/kjd/idna
33+
importlib-resources 5.1.4 Apache Software License https://github.com/python/importlib_resources
34+
iniconfig 1.1.1 MIT License http://github.com/RonnyPfannschmidt/iniconfig
35+
itsdangerous 2.0.1 BSD License https://palletsprojects.com/p/itsdangerous/
36+
kombu 5.1.0 BSD License https://kombu.readthedocs.io
37+
numpy 1.21.0 BSD License https://www.numpy.org
38+
omegaconf 2.1.0 BSD License https://github.com/omry/omegaconf
39+
packaging 20.9 Apache Software License, BSD License https://github.com/pypa/packaging
40+
pandas 1.2.5 BSD https://pandas.pydata.org
41+
pluggy 0.13.1 MIT License https://github.com/pytest-dev/pluggy
42+
portalocker 2.0.0 PSF https://github.com/WoLpH/portalocker
43+
prompt-toolkit 3.0.19 BSD License https://github.com/prompt-toolkit/python-prompt-toolkit
44+
py 1.10.0 MIT License https://py.readthedocs.io/
45+
pycparser 2.20 BSD License https://github.com/eliben/pycparser
46+
pyparsing 2.4.7 MIT License https://github.com/pyparsing/pyparsing/
47+
pytest 6.2.4 MIT License https://docs.pytest.org/en/latest/
48+
python-dateutil 2.8.1 BSD License, Apache Software License https://dateutil.readthedocs.io
49+
pytz 2021.1 MIT License http://pythonhosted.org/pytz
50+
redis 3.5.3 MIT License https://github.com/andymccurdy/redis-py
51+
regex 2021.4.4 Apache Software License https://bitbucket.org/mrabarnett/mrab-regex
52+
requests 2.25.1 Apache Software License https://requests.readthedocs.io
53+
sacrebleu 1.5.1 Apache Software License https://github.com/mjpost/sacrebleu
54+
six 1.16.0 MIT License https://github.com/benjaminp/six
55+
toml 0.10.2 MIT License https://github.com/uiri/toml
56+
torch 1.9.0 BSD License https://pytorch.org/
57+
tqdm 4.61.1 MIT License, Mozilla Public License 2.0 (MPL 2.0) https://tqdm.github.io
58+
typing-extensions 3.10.0.0 Python Software Foundation License https://github.com/python/typing/blob/master/typing_extensions/README.rst
59+
urllib3 1.26.5 MIT License https://urllib3.readthedocs.io/
60+
vine 5.0.0 BSD License http://github.com/celery/vine
61+
wcwidth 0.2.5 MIT License https://github.com/jquast/wcwidth
62+
zipp 3.4.1 MIT License https://github.com/jaraco/zipp

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
recursive-include biophi *

Makefile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
ENV_NAME := biophi-dev
2+
SHELL := /bin/bash
3+
CONDA_ACTIVATE = eval "$$(conda shell.bash hook)" && conda activate $(ENV_NAME)
4+
DOCKER_CELERY_CPUS := 4
5+
6+
env: env-create env-setup
7+
8+
env-create: environment.yml
9+
conda env create -n $(ENV_NAME) -f $<
10+
11+
env-update: environment.yml
12+
conda env update -n $(ENV_NAME) -f $<
13+
14+
env-setup:
15+
$(CONDA_ACTIVATE); pip install -e .
16+
17+
docker-build:
18+
docker-compose build
19+
20+
docker-run:
21+
docker-compose up
22+
23+
docker-python:
24+
docker-compose run worker python
25+
26+
web:
27+
$(CONDA_ACTIVATE); \
28+
FLASK_APP=biophi.common.web.views \
29+
FLASK_ENV=development \
30+
flask run
31+
32+
celery:
33+
$(CONDA_ACTIVATE); \
34+
FLASK_ENV=development \
35+
celery -A biophi.common.web.tasks.celery worker --loglevel=INFO

README.md

+200
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
<p align="center">
2+
<br>
3+
<img height="90" src="biophi/common/web/static/img/logo-light/2x/biophi_logo@2x.png?raw=true?raw=true">
4+
<br>
5+
</p>
6+
7+
BioPhi is an open-source antibody design platform.
8+
It features methods for automated antibody humanization (Sapiens), humanness evaluation (OASis) and an interface for computer-assisted antibody sequence design.
9+
10+
BioPhi is available at: [http://biophi.dichlab.org](http://biophi.dichlab.org)
11+
12+
Learn more in the BioPhi, Sapiens and OASis in our pre-print:
13+
14+
> TBD
15+
16+
## Running BioPhi on your machine
17+
18+
If you don't want to use the [public BioPhi server](http://biophi.dichlab.org), you can run BioPhi on your own machine.
19+
20+
<details>
21+
<summary>See more</summary>
22+
23+
### 1. Download OASis database
24+
25+
To run BioPhi with OASis humanness evaluation locally,
26+
you will need to download the OASis database (22GB uncompressed).
27+
28+
### 2a. Run simplified server using Docker
29+
30+
If you have [Docker](https://www.docker.com/products/docker-desktop),
31+
you can run a simplified BioPhi server using:
32+
```bash
33+
docker run TBD
34+
```
35+
36+
### 2b. Run simplified server using Conda
37+
38+
You can also install BioPhi using [Bioconda](https://bioconda.github.io/user/install.html):
39+
40+
```bash
41+
# Recommended: Create a separate BioPhi environment
42+
conda create -n biophi python=3.8
43+
conda activate biophi
44+
45+
# Install BioPhi
46+
conda install biophi
47+
48+
# Run simplified BioPhi server (not for live deployment!)
49+
biophi web
50+
```
51+
52+
**Note:** This is simplified usage for local use only. See Deploying your own BioPhi server *(TODO LINK)* to learn about
53+
deploying BioPhi properly on a server.
54+
55+
</details>
56+
57+
## BioPhi command-line interface
58+
59+
BioPhi also provides a command-line interface that enables bulk processing.
60+
61+
<details>
62+
<summary>See more</summary>
63+
64+
```bash
65+
TBD
66+
```
67+
68+
</details>
69+
70+
## Contributing
71+
72+
BioPhi is an open and extensible platform, contributions are welcome.
73+
Submit any feature requests on the [Issues](https://github.com/Merck/biophi/issues) page.
74+
75+
## Development
76+
77+
BioPhi is composed of three services that need to be running at the same time:
78+
79+
- `web`: Flask web server that handles both the frontend and the backend of the web application
80+
- `celery`: Asynchronous worker service(s) that process long-running tasks
81+
- `redis`: In-memory database for storing celery queue tasks and results
82+
83+
### Run BioPhi dev server through Docker Compose
84+
85+
Running through Docker Compose is easiest in terms of setup, but web server autoreload is not supported,
86+
so you will have to restart the services after each code update.
87+
88+
<details>
89+
<summary>See more</summary>
90+
91+
#### 1. Install Docker
92+
93+
See https://docs.docker.com/docker-for-mac/install/
94+
95+
#### 2. Build all images using Docker Compose
96+
97+
```bash
98+
# Run using Makefile
99+
make docker-build
100+
# or directly using
101+
docker-compose build
102+
```
103+
104+
#### 3. Run all services using Docker Compose
105+
106+
```bash
107+
# Run using Makefile
108+
make docker-run
109+
# or directly using
110+
docker-compose up
111+
```
112+
113+
To build and run, you can use:
114+
```bash
115+
# Run using Makefile
116+
make docker-build docker-run
117+
# or directly using
118+
docker-compose up --build
119+
```
120+
121+
#### 4. Handle code updates
122+
123+
After your code is updated, you will need to stop the services, run build and start again.
124+
See the next section for info on running locally with flask auto-reload.
125+
126+
</details>
127+
128+
129+
### Run BioPhi dev server using Conda
130+
131+
Running each service locally using Conda will enable flask auto-reload,
132+
which is useful if you are going back and forth between your IDE and the browser.
133+
134+
<details>
135+
<summary>See more</summary>
136+
137+
#### 1. Install Conda
138+
139+
Install [Conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html)
140+
or one of the alternatives ([Miniconda](https://docs.conda.io/en/latest/miniconda.html),
141+
[Miniforge](https://github.com/conda-forge/miniforge))
142+
143+
#### 2. Install Redis server
144+
145+
Install and run [Redis server](https://redis.io/download).
146+
On Mac, you can [install Redis using Brew](https://medium.com/@petehouston/install-and-config-redis-on-mac-os-x-via-homebrew-eb8df9a4f298).
147+
148+
#### 3. Setup environment
149+
150+
```bash
151+
# Install dependencies using the provided Makefile
152+
make env
153+
# Or directly using
154+
conda env create -n biophi-dev -f environment.yml
155+
conda activate biophi-dev
156+
pip install -e .
157+
```
158+
159+
#### 4. Run all services
160+
161+
You will have to run each service in a separate terminal (Use Cmd+T to open a new tab):
162+
163+
```bash
164+
# Run Redis server (this depends on your installation, the server might already be running)
165+
redis-server
166+
167+
# In a separate terminal, run celery worker queue
168+
make celery
169+
170+
# In a separate terminal, run flask web server
171+
make web
172+
```
173+
174+
See the provided
175+
176+
#### 5. Handle code updates
177+
178+
After your code is updated, the flask web service should refresh automatically.
179+
However, the celery service needs to be stopped and started manually,
180+
so you will need to do that if you update code that is executed from the workers.
181+
</details>
182+
183+
## Deploying your own BioPhi server
184+
185+
You can deploy your own internal BioPhi server.
186+
You will need to run the three separate services - the flask web server,
187+
the celery worker and the redis database.
188+
189+
This will depend on your platform and your cloud provider, the easiest deployment is using [Docker Compose](https://docs.docker.com/compose/gettingstarted/)
190+
through the provided [docker-compose.yml](docker-compose.yml) file.
191+
192+
## Acknowledgements
193+
194+
BioPhi is based on antibody repertoires from the Observed Antibody Space:
195+
196+
> Kovaltsuk, A., Leem, J., Kelm, S., Snowden, J., Deane, C. M., & Krawczyk, K. (2018). Observed Antibody Space: A Resource for Data Mining Next-Generation Sequencing of Antibody Repertoires. The Journal of Immunology, 201(8), 2502–2509. https://doi.org/10.4049/jimmunol.1800708
197+
198+
Antibody numbering is performed using ANARCI:
199+
200+
> Dunbar, J., & Deane, C. M. (2016). ANARCI: Antigen receptor numbering and receptor classification. Bioinformatics, 32(2), 298–300. https://doi.org/10.1093/bioinformatics/btv552

biophi/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .__version__ import __version__

biophi/__version__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '1.0.0'

biophi/common/__init__.py

Whitespace-only changes.

biophi/common/cli/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)