Skip to main content

Frame2seq for protein sequence design

Project description

Frame2seq

Official repository for Frame2seq, a structured-conditioned masked language model for protein sequence design, as described in our preprint Structure-conditioned masked language models for protein sequence design generalize beyond the native sequence space.

Colab notebook

Colab notebook for generating sequences with Frame2seq: Open In Colab

Setup

To use Frame2seq, install via pip:

pip install frame2seq

If previously installed via pip, upgrade to the latest version:

pip install --upgrade frame2seq

Usage

Sequence design

To use Frame2seq to generate sequences, you can use the design function.

from frame2seq import Frame2seqRunner

runner = Frame2seqRunner()
runner.design(pdb_file, chain_id, temperature, num_samples)

Arguments

  • pdb_file: Path to PDB file.
  • chain_id: Chain ID of protein.
  • temperature: Sampling temperature.
  • num_samples: Number of sequences to sample.
  • omit_AA: Amino acids to omit from sampling. Pass a list of single-letter amino acid strings (e.g. ['C', 'M']). Default None.
  • fixed_positions: Amino acid positions to fix during sampling. Pass a list of integers (e.g. [1, 3, 11]). Residue numbering starts from 1. Default None.
  • save_indiv_seqs: Whether to save sequences to indidual .fasta files. Default False.
  • save_indiv_neg_pll: Whether to save the per-residue negative pseudo-log-likelihoods of the sampled sequences. Default False.
  • verbose: Whether to print the sampled sequences and time taken for sampling. Default True.

Outputs

A .fasta file containing all sampled sequences is automatically saved. If save_indiv_seqs is True, individual .fasta files for each sampled sequence are also saved.

>pdbid=2fra chain_id=A recovery=62.67% score=0.83 temperature=1.0
PPSSVDWRDLGCITDVLDMGGCGACWAFSAVGALEARTTQKTGELTRLSAQDLVDCAREKYGNEGCDGGRMKSSFQFIIDKNGIDSHQAYPFTASDQECLYNSKYKAATCTDYTVLPEGDEDKLREAVSNVGPVAVGIDATHPEFRNFKSGVYHDPKCTTETNHGVLVVGYGTLKGKRFYKVKTCWGTYFGEDGFIRVAKNQGNHCGISTDPSYPEM

If save_indiv_neg_pll is True, a .csv file containing the per-residue negative pseudo-log-likelihoods of the sampled sequences is also saved.

Advanced sequence design

To use Frame2seq to generate sequences with advanced options, you can use the design function with additional arguments.

from frame2seq import Frame2seqRunner

runner = Frame2seqRunner()
runner.design(pdb_file, chain_id, temperature, num_samples, omit_AA=['C'], fixed_positions=[1, 3, 11])

Scoring

To use Frame2seq to score sequences, you can use the score function.

The following will score the PDB sequence for the PDB backbone.

from frame2seq import Frame2seqRunner

runner = Frame2seqRunner()
runner.score(pdb_file, chain_id)

The following will score all sequences in the given .fasta file for the PDB backbone.

from frame2seq import Frame2seqRunner

runner = Frame2seqRunner()
runner.score(pdb_file, chain_id, fasta_file)

Arguments

  • pdb_file: Path to PDB file.
  • chain_id: Chain ID of protein.
  • fasta_file: Path to .fasta file containing sequences to score. Default None. If None, will score the PDB sequence.
  • save_indiv_neg_pll: Whether to save the per-residue negative pseudo-log-likelihoods of the given sequence(s). Default False.
  • verbose: Whether to print time taken for scoring. Default True.

Outputs

A .csv file containing the average negative pseudo-log-likelihoods of the given sequence(s) is automatically saved. If save_indiv_neg_pll is True, per-residue negative pseudo-log-likelihoods are also saved in individual .csv files.

Citing this work

@article{akpinaroglu2023structure,
  title={Structure-conditioned masked language models for protein sequence design generalize beyond the native sequence space},
  author={Akpinaroglu, Deniz and Seki, Kosuke and Guo, Amy and Zhu, Eleanor and Kelly, Mark JS and Kortemme, Tanja},
  journal={bioRxiv},
  pages={2023--12},
  year={2023},
  publisher={Cold Spring Harbor Laboratory}
}

DOI

zenodo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frame2seq-0.0.8.tar.gz (86.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

frame2seq-0.0.8-py3-none-any.whl (86.4 MB view details)

Uploaded Python 3

File details

Details for the file frame2seq-0.0.8.tar.gz.

File metadata

  • Download URL: frame2seq-0.0.8.tar.gz
  • Upload date:
  • Size: 86.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for frame2seq-0.0.8.tar.gz
Algorithm Hash digest
SHA256 aea4f9e7d9cc357ff5f600699bc925a453c68c1803002400e78ae68d5222064b
MD5 05962aa67ba9e1d1a5011ab9bb0a49b5
BLAKE2b-256 6dc79262a263ff9344aaab14fa9422b5d68f564e65fb7f0e97543fcb1fc3a669

See more details on using hashes here.

File details

Details for the file frame2seq-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: frame2seq-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 86.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for frame2seq-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 9a9b9dd82f18e4e36f4e751d7c7fe3de6b12114411df52f10885f5462f115f56
MD5 dddedbb37c661e0d358f105a1fbe8b71
BLAKE2b-256 41f96212fa5e84d58397b1616aef61c3cc746a624448f0f8c366f4327b59cf44

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page