API Documentation

afusion.api.create_batch_task(job_name, entities, model_seeds, bonded_atom_pairs=None, user_ccd=None)

Creates a batch task dictionary for a single prediction.

Parameters:
  • job_name (str) – Name of the job.

  • entities (list) – List of dictionaries, each representing an Entity. Each entity dict should have keys: - ‘type’: ‘protein’, ‘rna’, ‘dna’, or ‘ligand’ - ‘id’: str or list - ‘sequence_data’: dict with sequence information

  • model_seeds (list of int) – List of integers.

  • bonded_atom_pairs (list, optional) – Optional list of bonded atom pairs.

  • user_ccd (str, optional) – Optional user CCD.

Returns:

Dictionary representing the AlphaFold input JSON structure.

Return type:

dict

afusion.api.run_batch_predictions(tasks, af_input_base_path, af_output_base_path, model_parameters_dir, databases_dir, run_data_pipeline=True, run_inference=True, bucket_sizes=None)

Runs batch predictions for the given tasks.

Parameters:
  • tasks (list of dict) – List of task dicts, as generated by create_batch_task.

  • af_input_base_path (str) – Base path for AlphaFold input.

  • af_output_base_path (str) – Base path for AlphaFold output.

  • model_parameters_dir (str) – Path to model parameters directory.

  • databases_dir (str) – Path to databases directory.

  • run_data_pipeline (bool) – Whether to run data pipeline.

  • run_inference (bool) – Whether to run inference.

  • bucket_sizes (list of int, optional) – Optional list of bucket sizes.

Returns:

List of dicts with keys ‘job_name’, ‘output_folder’, ‘status’.

Return type:

list of dict

afusion.api.create_protein_sequence_data(sequence, modifications=None, msa_option='auto', unpaired_msa=None, paired_msa=None, templates=None)

Creates sequence data for a protein entity.

Parameters:
  • sequence (str) – The protein sequence.

  • modifications (list of dict, optional) – Optional list of modifications, each with keys ‘ptmType’ and ‘ptmPosition’.

  • msa_option (str) – MSA option, ‘auto’, ‘upload’, or ‘none’.

  • unpaired_msa (str, optional) – Unpaired MSA (if msa_option is ‘upload’).

  • paired_msa (str, optional) – Paired MSA (if msa_option is ‘upload’).

  • templates (list of dict, optional) – Optional list of template dicts.

Returns:

Sequence data dictionary.

Return type:

dict

afusion.api.create_rna_sequence_data(sequence, modifications=None, msa_option='auto', unpaired_msa=None)

Creates sequence data for an RNA entity.

Parameters:
  • sequence (str) – The RNA sequence.

  • modifications (list of dict, optional) – Optional list of modifications.

  • msa_option (str) – MSA option, ‘auto’, ‘upload’, or ‘none’.

  • unpaired_msa (str, optional) – Unpaired MSA (if msa_option is ‘upload’).

Returns:

Sequence data dictionary.

Return type:

dict

afusion.api.create_dna_sequence_data(sequence, modifications=None)

Creates sequence data for a DNA entity.

Parameters:
  • sequence (str) – The DNA sequence.

  • modifications (list of dict, optional) – Optional list of modifications.

Returns:

Sequence data dictionary.

Return type:

dict

afusion.api.create_ligand_sequence_data(ccd_codes=None, smiles=None)

Creates sequence data for a ligand entity.

Parameters:
  • ccd_codes (list of str, optional) – List of CCD codes.

  • smiles (str, optional) – SMILES string.

Returns:

Sequence data dictionary.

Return type:

dict

afusion.api.create_tasks_from_dataframe(df)

Creates batch tasks from a DataFrame.

Parameters:

df (pandas.DataFrame) –

DataFrame with columns representing parameters: - ‘job_name’: str - ‘type’: ‘protein’, ‘rna’, ‘dna’, or ‘ligand’ - ‘id’: str or list - ‘sequence’: str - Other optional parameters:

  • ’modifications’: list of dicts (as JSON string)

  • ’msa_option’: ‘auto’, ‘upload’, or ‘none’

  • ’unpaired_msa’: str

  • ’paired_msa’: str

  • ’templates’: list of dicts (as JSON string)

  • ’model_seeds’: list of integers (as string)

  • ’bonded_atom_pairs’: list (as JSON string)

  • ’user_ccd’: str

Returns:

List of task dictionaries.

Return type:

list of dict

afusion.api.parse_json_field(value)

Parses a JSON string field into a Python object.

Returns None if the value is NaN or empty.

Parameters:

value (str) – JSON string to parse.

Returns:

Parsed Python object or None.

Return type:

object or None

afusion.api.parse_list_field(value, data_type=<class 'str'>)

Parses a comma-separated string field into a list.

Returns None if the value is NaN or empty.

Parameters:
  • value (str) – Comma-separated string to parse.

  • data_type (type) – Data type to convert list items to.

Returns:

List of items converted to data_type, or None.

Return type:

list or None