processing_inputs¶
Auxiliary functions to process input parameters file and input structure.
Functions¶
|
Process input structure prior to sampling. |
|
Register clashes in input structure to be ignored later. |
|
Get information about a protein from the AlphaFold Database using a given UniProt accession. |
|
Update sampling input parameters, store steric clashes present in input structure. |
|
Read input parameters and assert the validity of its contents. |
|
Get disorder data for a protein from MobiDB using a given UniProt accession. |
|
Format a human-readable report of disordered data from MobiDB. |
|
Get structured domain annotations for a protein from The Encyclopedia of Domains (TED). |
|
Format a human-readable report of TED domain annotations. |
|
Retrieve per-residue pLDDT scores from AlphaFold. |
|
Convert pLDDT scores into contiguous regions based on a given pLDDT range. |
|
Convert AlphaFold pLDDT into disorder-like region format. |
|
Format a human-readable report of data from AlphaFold Protein Structure Database. |
|
Query external databases for information about a given UniProt accession and report |
Module Contents¶
- ensemblify.generation.ensemble_utils.processing_inputs.process_input_pdb(faspr_path, pulchra_path, inputs_dir, input_pdb)¶
Process input structure prior to sampling.
Apply FASPR and Pulchra to the .pdb of our sampling input structure, outputting the resulting .pdb file. Allows us to start the sampling from a pdb file with less clashes, while taking note of the clashes still present in the input pdb so those are ignored later.
- Parameters:
faspr_path (
str) – Path to the FASPR executable.pulchra_path (
str) – Path to the PULCHRA executable.inputs_dir (
str) – Path to directory where files and .logs resulting from input processing will be stored.input_pdb (
str) – Path to the .pdb input structure to process.
- Returns:
- clashes_file (str):
Path to the .log file with the output of applying PULCHRA to our input structure.
- processed_pdb (str):
Path to the .pdb file resulting from applying FASPR and PULCHRA to our input structure.
- Return type:
tuple[str,str]
- ensemblify.generation.ensemble_utils.processing_inputs.register_input_clashes(input_clashes_file)¶
Register clashes in input structure to be ignored later.
- Parameters:
input_clashes_file (
str, optional) – Path to the PULCHRA output file for the input structure. If None, no clashes are registered.- Returns:
List of clashes in the input structure. Can be empty list if input_clashes_file is None. For example:
[ (‘ARG[277]’, ‘GLY[287]’),(‘ARG[706]’, ‘GLY[716]’), … ]
- Return type:
list[tuple[str,str]]
- ensemblify.generation.ensemble_utils.processing_inputs.get_protein_info(uniprot_accession)¶
Get information about a protein from the AlphaFold Database using a given UniProt accession.
- Parameters:
uniprot_accession (
str) – UniProt accession to use in request for AlphaFold’s Database API.- Returns:
Information about the protein identified by the given UniProt accession, including links to its .pdb structure and .json PAE matrix.
- Return type:
dict
- Raises:
RequestException with HTTPError if request timed out or encountered an issue. –
- ensemblify.generation.ensemble_utils.processing_inputs.setup_ensemble_gen_params(input_params, inputs_dir)¶
Update sampling input parameters, store steric clashes present in input structure.
If a UniProt accession is given in either the sequence or PAE fields, replace it with the corresponding downloaded .pdb or .json file.
‘sequence’ field is updated with the path to the processed input structure. If a UniProt accession is provided, replace it with the corresponding downloaded .pdb file.
‘pae’ field is updated with the path to the downloaded .json PAE matrix file, if a UniProt accession is provided.
‘output_path’ field is updated with the ensemble directory inside the created directory named ‘job_name’.
File with the updated parameters is saved to the inputs directory.
Input structure is processed and any steric clashes present after processing are stored in a file so they can later be ignored on non-sampled regions of structures resulting from the sampling process.
- Parameters:
input_params (
dict) – Parameters following the Ensemblify template.inputs_dir (
str) – Path to directory where files and .logs resulting from input processing will be stored.
- Returns:
- processed_parameters_path (str):
Path to file where updated parameters are stored.
- input_clashes (str):
Path to file with PULCHRA output from processing input .pdb.
- Return type:
tuple[str,str] | None
- ensemblify.generation.ensemble_utils.processing_inputs.read_input_parameters(parameter_path)¶
Read input parameters and assert the validity of its contents.
- Parameters:
parameter_path (
str) – Path to the parameter .yaml file.- Returns:
Dictionary with all the parameters validated for correct Python types.
- Return type:
dict
- ensemblify.generation.ensemble_utils.processing_inputs.get_mobidb_data(uniprot_accession)¶
Get disorder data for a protein from MobiDB using a given UniProt accession.
- Parameters:
uniprot_accession (
str) – UniProt accession to use in request for MobiDB’s API.- Returns:
Intrinsic disorder data for the protein identified by the given UniProt accession, including experimentally confirmed and predicted disordered regions. Returns None if no disorder data is found or if the request fails.
- Return type:
dict
- Raises:
RequestException with HTTPError if request timed out or encountered an issue. –
- ensemblify.generation.ensemble_utils.processing_inputs.format_mobidb_report(uniprot_accession, disorder_data)¶
Format a human-readable report of disordered data from MobiDB.
- Parameters:
uniprot_accession (
str) – UniProt accession used to extract the MobiDB data.disorder_data (
dict) – Extracted data from MobiDB.
- Returns:
Formatted multi-line report string.
- Return type:
str
- ensemblify.generation.ensemble_utils.processing_inputs.get_ted_data(uniprot_accession)¶
Get structured domain annotations for a protein from The Encyclopedia of Domains (TED).
- Parameters:
uniprot_accession (
str) – UniProt accession used to query TED.- Returns:
Dictionary containing parsed domain annotations. Returns None if request fails or no domains are found.
- Return type:
dict
- Raises:
RequestException with HTTPError if request timed out or encountered an issue. –
- ensemblify.generation.ensemble_utils.processing_inputs.format_ted_report(uniprot_accession, domain_data)¶
Format a human-readable report of TED domain annotations.
- Parameters:
uniprot_accession (
str) – UniProt accession used to extract the TED data.disorder_data (
dict) – Extracted data from TED.domain_data (dict)
- Returns:
Formatted multi-line report string.
- Return type:
str
- ensemblify.generation.ensemble_utils.processing_inputs.get_alphafold_plddt(uniprot_accession)¶
Retrieve per-residue pLDDT scores from AlphaFold.
- Parameters:
uniprot_accession (str)
- Return type:
list
- ensemblify.generation.ensemble_utils.processing_inputs.extract_plddt_regions(plddt_scores, plddt_range=(70, 101))¶
Convert pLDDT scores into contiguous regions based on a given pLDDT range.
- Parameters:
plddt_scores (list)
plddt_range (tuple)
- Return type:
list
- ensemblify.generation.ensemble_utils.processing_inputs.get_alphafold_data(uniprot_accession, detail='low+very_low')¶
Convert AlphaFold pLDDT into disorder-like region format.
- Parameters:
uniprot_accession (str)
detail (str)
- Return type:
dict
- ensemblify.generation.ensemble_utils.processing_inputs.format_alphafold_report(uniprot_accession, afdb_data)¶
Format a human-readable report of data from AlphaFold Protein Structure Database.
- Parameters:
uniprot_accession (
str) – UniProt accession used to extract the AFDB data.afdb_data (
dict) – Extracted AFDB data.
- Returns:
Formatted multi-line report string.
- Return type:
str
- ensemblify.generation.ensemble_utils.processing_inputs.suggest_targets(user_input)¶
Query external databases for information about a given UniProt accession and report on potential targets for ensemble generation.
- Parameters:
user_input (
str) – User input to be checked for UniProt accessions and queried against external databases.- Raises:
AssertionError if no valid UniProt accession is found in the user input. –