Package: peptide-encoder
Peptide EncoderAn encoder for peptides (short amino acid sequences) based on BLOSUM similarity.In particular, this package includes a model for learning peptide embeddings such that the embedding of two peptides in
the vector space is proportional to their BLOSUM62 similarity.InstallationThis project is written inpython3and can be installed withpip. It is available on PyPI.pip3 install --find-links https://download.pytorch.org/whl/cu113/torch_stable.html peptide-encoderAlternatively, the package can be installed from source.git clone https://github.com/bmmalone/peptide-encoder.git
cd piptide-encoder
pip3 install -r requirements.txt .(The "period" at the end is required.)Prerequisites: This project relies on quite a few prerequisites, such as pytorch, ray, cudnn, and others. Both therequirements.txtandsetup.pyfiles aim to install these dependencies correctly; nevertheless, it may still be
preferable to install these dependencies before installing this package.In particular, thefind-linksargument to pip may need to be adjusted depending on the available version of CUDA.UsageAfter installation, models can be trained using a command similar to the following:train-pepenc-models /prj/peptide-encoder/conf/base/config.yaml --num-hyperparameter-configurations 500 --max-training-iterations 30 --name my-pepenc-tune-exp --out-dir /tmpThe--helpflag can be used to see a description of all arguments to the script.For adjusting the hyperparameter search space, algorithms, or schedulers, thepepenc/models/train_pepenc_models.pyscript can be adjusted. If the package was not installed inpip"editable" mode, then make sure to re-runpip installso that the changes take effect for the next run of ray.DocumentationUnfortunately, there is no sphinx, etc., documentation at this time. The fileconf/base/config.yamlshows examples of
all hyperparameters, data files, etc., for training models.Data formatThe models in this project require an input csv file that has one row which is a header and remaining rows which are
the peptides for the various datasets. The column in the csv file with the peptide sequences must be namedsequence.
(This can be adjusted if calling thepepenclibrary from python code.)Tensorboard visualizationThe<out_dir>/<name>directory (based on the arguments totrain-pepenc-models) will contain output suitable for
visualization with Tensorboard. The following command uses Docker to expose the results on port 6007.docker run --rm --mount type=bind,source=/tmp/my-pepenc-tune-exp,target=/tensorboard --publish 6007:6006 nvcr.io/nvidia/tensorflow:21.12-tf2-py3 tensorboard --logdir /tensorboardThe tensorflow image can be updated as necessary.N.B.Thesourceof the bind mount must be the<out_dir>/<name>directory (based on the arguments totrain-pepenc-models).Training the modelThe model consistently experiences vanishing (or, improbably, exploding) gradient issues when using a single LSTM layer.
It is not clear why this happens, and it is currently suggested to avoid allowinglstm_layers == 1in the
hyperparameter search space (or directly setting it that way in the config).Testing the codeThe project usespytestfor unit testing. The testing prerequisites (though not other dependencies, as described
above) can be installed as follows.pip3 install .[test]After installingpytestand other testing dependencies, tests can be performed as follows.cd /path/to/peptide-encoder
pytest .