Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
clami66 committed Mar 25, 2024
1 parent b930d66 commit f902a81
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 39 deletions.
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ After installing DockQ with `pip`, the `DockQ` binary will be in your path. Just

**Example**

When running DockQ on model/native complexes with one or more interfaces, you will get a result for each interface. Results are computed to maximise the average DockQ across all interface:
When running DockQ on model/native complexes with one or more interfaces, you will get a result for each interface. Results are computed to maximise the average DockQ across all interfaces:

```
Expand Down Expand Up @@ -144,30 +144,29 @@ Run DockQ with `-h/--help` to see a list of the available flags:
```
bash$ DockQ -h
usage: DockQ [-h] [--capri_peptide] [--short] [--verbose] [--use_CA] [--no_align] [--optDockQF1] [--allowed_mismatches ALLOWED_MISMATCHES] [--mapping MODELCHAINS:NATIVECHAINS]
usage: DockQ [-h] [--capri_peptide] [--short] [--verbose] [--no_align] [--n_cpu n_cpu] [--optDockQF1] [--allowed_mismatches ALLOWED_MISMATCHES] [--mapping MODELCHAINS:NATIVECHAINS]
<model> <native>
DockQ - Quality measure for protein-protein docking models
positional arguments:
<model> path to model file
<native> path to native file
<model> Path to model file
<native> Path to native file
optional arguments:
-h, --help show this help message and exit
--capri_peptide use version for capri_peptide (DockQ cannot not be trusted for this setting)
--short short output
--verbose, -v talk a lot!
--use_CA, -ca use CA instead of backbone
--short Short output
--verbose, -v Verbose output
--no_align Do not align native and model using sequence alignments, but use the numbering of residues instead
--optDockQF1 optimize on DockQ_F1 instead of DockQ
--n_cpu n_cpu Number of cores to use
--optDockQF1 Optimize on DockQ_F1 instead of DockQ
--allowed_mismatches ALLOWED_MISMATCHES
number of allowed mismatches when mapping model sequence to native sequence.
Number of allowed mismatches when mapping model sequence to native sequence.
--mapping MODELCHAINS:NATIVECHAINS
Specify a chain mapping between model and native structure. If the native contains two chains "H" and "L" while the model contains two chains "A" and "B",
and chain A is a model of native chain H and chain B is a model of native chain L, the flag can be set as: '--mapping AB:HL'. This can also help limit the
search to specific native interfaces. For example, if the native is a tetramer (ABCD) but the user is only interested in the interface between chains B and
C, the flag can be set as: '--mapping :BC' or the equivalent '--mapping *:BC'.
```

48 changes: 19 additions & 29 deletions src/DockQ/DockQ.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import warnings
import traceback
import itertools
from collections import Counter
from argparse import ArgumentParser
from functools import lru_cache, wraps, partial

Expand Down Expand Up @@ -669,13 +670,8 @@ def product_without_dupl(*args, repeat=1):


def count_chain_combinations(chain_clusters):
counts = {}
for chain in chain_clusters:
chains = tuple(chain_clusters[chain])
if chains not in counts:
counts[chains] = 0
counts[chains] += 1
number_of_combinations = np.prod([math.factorial(a) for a in counts.values()])
tuples = [tuple(l) for l in chain_clusters.values()]
number_of_combinations = np.prod([math.factorial(a) for a in Counter(tuples).values()])
return number_of_combinations


Expand Down Expand Up @@ -743,7 +739,6 @@ def main():
native_chains_to_combo,
args.allowed_mismatches,
)

num_chain_combinations = count_chain_combinations(chain_clusters)
chain_maps = get_all_chain_maps(
chain_clusters,
Expand Down Expand Up @@ -793,29 +788,24 @@ def main():
best_dockq = total_dockq
best_result = result_this_mapping
best_mapping = chain_map

else: # skip multi-threading for single jobs (skip the bar basically)
for chain_map in chain_maps:
result_this_mapping = run_chain_map(chain_map)
total_dockq = sum(
[
result["DockQ_F1" if args.optDockQF1 else "DockQ"]
for result in result_this_mapping.values()
]
if low_memory: # retrieve the full output by rerunning the best chain mapping
best_result = run_on_all_native_interfaces(
model_structure,
native_structure,
best_mapping,
args.no_align,
args.capri_peptide,
low_memory=False,
)
if total_dockq > best_dockq:
best_dockq = total_dockq
best_result = result_this_mapping
best_mapping = chain_map

if low_memory: # retrieve the full output by reruning the best chain mapping
best_result = run_on_all_native_interfaces(
model_structure,
native_structure,
best_mapping,
args.no_align,
args.capri_peptide,
low_memory=False,
else: # skip multi-threading for single jobs (skip the bar basically)
best_mapping = next(chain_maps)
best_result = run_chain_map(best_mapping)
best_dockq = sum(
[
result["DockQ_F1" if args.optDockQF1 else "DockQ"]
for result in best_result.values()
]
)

info["model"] = args.model
Expand Down

0 comments on commit f902a81

Please sign in to comment.