Generate json

Single protein sequence (default)

Default pipeline, will run MSA and template search


source

dump_json

 dump_json (data, save_path)

Save json data into a file


source

get_protein_json

 get_protein_json (name, seq, save_path=None, seeds=[1])

Generate json of single protein sequence for input of docker command

Type Default Details
name job name
seq aa sequence
save_path NoneType None .json
seeds list [1]
data = get_protein_json('proteinA','AAA','data/proteinA.json',seeds=[1,2,3])
data
{'name': 'proteinA',
 'modelSeeds': [1, 2, 3],
 'sequences': [{'protein': {'id': 'A', 'sequence': 'AAA'}}],
 'bondedAtomPairs': [],
 'dialect': 'alphafold3',
 'version': 2}

Protein-SMILES

  • First run the normal sequence only pipeline for the protein
  • Get the output data.json file, read it, load the ["sequences"][0]["protein"]

source

read_json

 read_json (file_path)
protein_json = read_json('data/seq_only_data.json')

source

get_protein_smiles_json

 get_protein_smiles_json (smi_id:str, SMILES:str, protein_json,
                          save_path=None, seeds=[1])

Get json for protein-ligand docking task

Type Default Details
smi_id str
SMILES str
protein_json json type
save_path NoneType None .json
seeds list [1]
out = get_protein_smiles_json('smi_name','CCC',protein_json,'data/protein_smi.json',seeds=[1,2,3])

Let’s take a look for the json:

str(out)[:100]
"{'name': 'smi_name', 'modelSeeds': [1, 2, 3], 'sequences': [{'ligand': {'id': 'L', 'smiles': 'CCC'}}"
df = pd.DataFrame({'idx':['a','b'],'smi':['CCC','OCO']})
df
idx smi
0 a CCC
1 b OCO
project_name='sdf'
for idx, smi in df.values:
    _ = get_protein_smiles_json(idx,smi,protein_json,f'af_input/{project_name}/{idx}.json',seeds=[1,2,3])

Split the files to subfolder for multi-GPUs


source

split_nfolder

 split_nfolder (folder_dir, n=4)

Move json files from a folder into subfolders (folder_0, folder_1, …, folder_N).

split_nfolder(f'af_input/{project_name}')
Distributed 2 files into 4 folders.

End