Skip to content

ugSUBMARINE/af3jobs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

af3jobs

af3jobs is a Python package designed to streamline the process of creating JSON input files for AlphaFold 3. It provides data structures and tools for defining molecular components, modifications, and job configurations compatible with both the AlphaFold server and the standalone version.

Features

  • Define protein, DNA, and RNA chains with sequence modifications (e.g., PTMs, nucleotide modifications).
  • Add ligands, ions, and other small molecules with CCD codes or SMILES strings.
  • Extract multiple sequence alignments and templates from JSON files generated by AF3 and attach them to a protein or RNA chain.
  • Read an MSA from A3M formatted alignment files.

Installation

Clone the repository and install the package using pip:

git clone https://github.com/your_username/af3jobs.git
cd af3jobs
pip install .

Alternatively, install the package directly from GitHub:

pip install git+https://github.com/ugSUBMARINE/af3jobs.git

Usage

The Job class is the main container for combining protein and nucleotide chains, ligands/ions, and modifications that can be converted to JSON as input for AlphaFold 3.

from af3jobs import Job

# Create a new job
job = Job(name="Sample AlphaFold Job", model_seeds=[42])

# Add a protein chain with modifications
# The method returns the chain object, which can be used to add modifications, alignments, etc.
protein_chain = job.add_protein_chain(sequence="MVLSEGEWQLVLHVWAKVEA", count=2)

# Add MSA and templates from the output JSON file of a previous job
# MSAs could also be read from A3M files using 'protein_chain.add_msa_from_a3m("msa.a3m")'
protein_chain.add_msa_from_json("some_job_data.json")
protein_chain.add_templates_from_json("some_job_data.json")

# Add a DNA chain with modifications
dna_chain = job.add_dna_chain(sequence="GATTACA", ids="C")
dna_chain.add_modification(mod_type="6OG", position=1)

# Add two heme cofactors
job.add_ligand(ccd_codes="HEM", ids=["X", "Y"])

# Export to JSON
job.write_af3_json("standalone_job.json", indent=4)

Server Job Example

The ServerJob class can be used in a similar way to prepare jobs for the AlphaFold server. (The two types of JSON input files are not interchangeable!)

import json
from af3jobs import ServerJob

# Create a new job
job = ServerJob(name="Sample AlphaFold Server Job")

# Add a protein chain with glycans and modifications
protein_chain = job.add_protein_chain(sequence="MVLSEGEWQLVLHVWAKVEA", count=2)
protein_chain.add_glycan(residues="NAG(NAG)(BMA)", position=8)
protein_chain.add_modification(mod_type="CCD_HY3", position=1)

# Add a DNA chain with modifications
dna_chain = job.add_dna_chain(sequence="GATTACA", count=1)
dna_chain.add_modification(mod_type="CCD_6OG", position=1)

# Add a ligand and an ion
job.add_ligand(ligand_type="CCD_ATP", count=1)
job.add_ion(ion_type="MG", count=2)

# Export to JSON
with open("server_job.json", "w") as f:
    json.dump([job.to_dict()], f, indent=4)

License

This project is licensed under the MIT License. See the LICENSE file for details.

References

About

Generate JSON job files for AlphaFold3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages