Skip to content

Commit

Permalink
allow to specify model comparison settings via config
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashopf committed Nov 11, 2024
1 parent 3a14a63 commit ff15914
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
17 changes: 17 additions & 0 deletions config/sample_config_monomer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,17 @@ compare:
# Warning: searching by HMM may result in crystal structures from very distant homologs or even unrelated sequences.
pdb_alignment_method: jackhmmer

# Uncomment to enable comparison to predicted models (e.g. AlphaFoldDB, as specified in databases section below);
# will inherit configuration as passed to compare stage, with any keys specified in compared_to_models subsection
# taking precedence
compare_models:
max_num_hits: 1
pdb_alignment_method: jackhmmer
use_bitscores: True
domain_threshold: 1.5
sequence_threshold: 1.5
iterations: 1

# Settings for Mutation effect predictions
mutate:
# Options: standard
Expand Down Expand Up @@ -414,6 +425,12 @@ databases:
sifts_mapping_table: /n/groups/marks/databases/SIFTS/pdb_chain_uniprot_plus_current.o2.csv
sifts_sequence_db: /n/groups/marks/databases/SIFTS/pdb_chain_uniprot_plus_current.o2.fasta

# Mapping onto predicted 3D structure models
# modeldb_type: alphafolddb_v4
# modeldb_sequence_file: /n/groups/marks/databases/alphafolddb/2022-11-14/sequences.fasta
# modeldb_list_file: /n/groups/marks/databases/alphafolddb/2022-11-14/accession_ids.csv
# modeldb_file_dir:

# Paths to external tools used by evcouplings. Please refer to README.md for installation instructions and which tools are required.
tools:
jackhmmer: /n/groups/marks/pipelines/evcouplings/software/hmmer-3.1b2-linux-intel-x86_64/binaries/jackhmmer
Expand Down
32 changes: 14 additions & 18 deletions evcouplings/compare/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ def _identify_predicted_structures(**kwargs):
kwargs,
[
"modeldb_type", "modeldb_sequence_file", "modeldb_list_file",
"model_max_num_hits",
"max_num_hits",
]
)

Expand Down Expand Up @@ -672,17 +672,13 @@ def _identify_predicted_structures(**kwargs):
sequence_file=kwargs["modeldb_sequence_file"]
)

# run sequence-based query against model database, always use jackhmmer for this
sifts_map = s.by_alignment(**{
**kwargs,
"pdb_alignment_method": "jackhmmer"
})

# run sequence-based query against model database
sifts_map = s.by_alignment(**kwargs)
sifts_map_full = deepcopy(sifts_map)

# reduce number of structures/hits
if kwargs["model_max_num_hits"] is not None:
sifts_map.hits = sifts_map.hits.iloc[:kwargs["model_max_num_hits"]]
if kwargs["max_num_hits"] is not None:
sifts_map.hits = sifts_map.hits.iloc[:kwargs["max_num_hits"]]

return sifts_map, sifts_map_full

Expand Down Expand Up @@ -1211,16 +1207,16 @@ def standard(**kwargs):
ec_table, d_intra, d_multimer, sifts_map, **kwargs
)

# Step 5: check if comparison to models is enabled, then run this protocol as well
if kwargs.get("compare_to_models"):
# create subdirectory for running models comparison
# aux_prefix_models = insert_dir(
# prefix, "models", rootname_subdir=False
# )
# create_prefix_folders(aux_prefix_models)

# Step 5: check if comparison to models is enabled (optional argument), then run this protocol as well
models_config = kwargs.get("compare_models")
if models_config is not None:
# apply protocol and update output
outcfg_models = models(**kwargs)
outcfg_models = models(
**{
**kwargs,
**models_config,
}
)
outcfg = {
**outcfg,
**outcfg_models,
Expand Down

0 comments on commit ff15914

Please sign in to comment.