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 dependencies and package up #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ Based this local-search mechanism, a model architecture called Mutation Factoriz
The dependencies can be set up using the following commands:

```bash
conda create -n pex python=3.8 -y
conda create -n pex python=3.10 -y
conda activate pex
conda install pytorch=1.10.2 cudatoolkit=11.3 -c pytorch -y
conda install numpy=1.19 pandas=1.3 -y
conda install pytorch pytorch-cuda -c pytorch -c nvidia -y
conda install -c conda-forge tape_proteins=0.5 -y
pip install sequence-models==1.2.0
pip install -e .
```

If you run into dependency version issues, try `pip install -r requirements.txt` before running `pip install -e .`.

Clone this repository and download the oracle landscape models by the following commands:

```bash
Expand Down
Empty file added pex/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion algorithm/__init__.py → pex/algorithm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ def get_algorithm(args, model, alphabet, starting_sequence):

for file_name in os.listdir(os.path.dirname(__file__)):
if file_name.endswith('.py') and not file_name.startswith('_'):
importlib.import_module('algorithm.' + file_name[:-3])
importlib.import_module('pex.algorithm.' + file_name[:-3])
2 changes: 1 addition & 1 deletion algorithm/pex.py → pex/algorithm/pex.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import random
import numpy as np
from . import register_algorithm
from utils.seq_utils import hamming_distance, random_mutation
from pex.utils.seq_utils import hamming_distance, random_mutation

@register_algorithm("pex")
class ProximalExploration:
Expand Down
2 changes: 1 addition & 1 deletion landscape/__init__.py → pex/landscape/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ def get_landscape(args):

for file_name in os.listdir(os.path.dirname(__file__)):
if file_name.endswith('.py') and not file_name.startswith('_'):
importlib.import_module('landscape.' + file_name[:-3])
importlib.import_module('pex.landscape.' + file_name[:-3])
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion model/__init__.py → pex/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ def get_model(args, **kwargs):

for file_name in os.listdir(os.path.dirname(__file__)):
if file_name.endswith('.py') and not file_name.startswith('_'):
importlib.import_module('model.' + file_name[:-3])
importlib.import_module('pex.model.' + file_name[:-3])
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion model/mufacnet.py → pex/model/mufacnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import torch.nn as nn
import numpy as np
from . import torch_model, register_model
from utils.seq_utils import sequences_to_mutation_sets
from pex.utils.seq_utils import sequences_to_mutation_sets

class MuFacNet(nn.Module):
"""
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion model/torch_model.py → pex/model/torch_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import torch
import numpy as np
from utils.seq_utils import sequences_to_tensor
from pex.utils.seq_utils import sequences_to_tensor

class TorchModel:
def __init__(self, args, alphabet, net, **kwargs):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[project]
name = "pex"
dynamic = ["version", "readme", "dependencies", "optional-dependencies"]
description = "Proximal Exploration for Model-guided Protein Sequence Design"
authors = [{name = "Zhizhou Ren", email = "[email protected]"}]
classifiers=[
"Development Status :: 3",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
]

[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.in"]}
optional-dependencies = {dev = {file = ["requirements-dev.in"]}}
readme = {file = "README.md"}

[tool.setuptools.packages.find]
include = ["pex*"]

[tool.setuptools_scm]
search_parent_directories = true
version_scheme = "no-guess-dev"
local_scheme = "node-and-date"
fallback_version = "0.0.0"
3 changes: 3 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
numpy
pandas<=1.5
sequence-models
20 changes: 20 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile requirements.in
#
numpy==1.25.2
# via
# -r requirements.in
# pandas
pandas==1.5.0
# via -r requirements.in
python-dateutil==2.8.2
# via pandas
pytz==2023.3
# via pandas
sequence-models==1.6.0
# via -r requirements.in
six==1.16.0
# via python-dateutil
12 changes: 6 additions & 6 deletions run.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import numpy as np
from landscape import get_landscape, task_collection, landscape_collection
from algorithm import get_algorithm, algorithm_collection
from model import get_model, model_collection
from model.ensemble import ensemble_rules
from utils.os_utils import get_arg_parser
from utils.eval_utils import Runner
from pex.landscape import get_landscape, task_collection, landscape_collection
from pex.algorithm import get_algorithm, algorithm_collection
from pex.model import get_model, model_collection
from pex.model.ensemble import ensemble_rules
from pex.utils.os_utils import get_arg_parser
from pex.utils.eval_utils import Runner

def get_args():
parser = get_arg_parser()
Expand Down