diff --git a/run_test.sh b/run_test.sh index a30f6ea..768240f 100644 --- a/run_test.sh +++ b/run_test.sh @@ -1,21 +1,38 @@ #!/bin/bash set -euo pipefail +which DockQ + # Test that cython version behaves the same as nocython -coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/1A2K_r_l_b.model.pdb examples/1A2K_r_l_b.pdb -coverage run -a src/DockQ/DockQ.py examples/1A2K_r_l_b.model.pdb examples/1A2K_r_l_b.pdb -coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/1A2K_r_l_b.model.pdb examples/1A2K_r_l_b.pdb --no_align -coverage run -a src/DockQ/DockQ.py examples/1A2K_r_l_b.model.pdb examples/1A2K_r_l_b.pdb --no_align +coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/1A2K_r_l_b.model.pdb examples/1A2K_r_l_b.pdb > test +diff test testdata/1A2K.dockq +coverage run -a --source='DockQ.DockQ' src/DockQ/DockQ.py examples/1A2K_r_l_b.model.pdb examples/1A2K_r_l_b.pdb > test +diff test testdata/1A2K.dockq +coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/1A2K_r_l_b.model.pdb examples/1A2K_r_l_b.pdb --no_align > test +diff test testdata/1A2K.dockq +coverage run -a --source='DockQ.DockQ' src/DockQ/DockQ.py examples/1A2K_r_l_b.model.pdb examples/1A2K_r_l_b.pdb --no_align > test +diff test testdata/1A2K.dockq + # Multiple interfaces -coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/dimer_dimer.model.pdb examples/dimer_dimer.pdb --short +coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/dimer_dimer.model.pdb examples/dimer_dimer.pdb --short > test +diff test testdata/dimer_dimer.dockq + # Test on structures with slightly different sequences -coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/model.pdb examples/native.pdb --allowed_mismatches 1 +coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/model.pdb examples/native.pdb --allowed_mismatches 1 > test +diff test testdata/model.dockq + # Test various mapping strategies -coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/1EXB_r_l_b.model.pdb examples/1EXB_r_l_b.pdb --short --mapping AB*:BA* -coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/1EXB_r_l_b.model.pdb examples/1EXB_r_l_b.pdb --short --mapping :ABC -coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/1EXB_r_l_b.model.pdb examples/1EXB_r_l_b.pdb --short --mapping ABCDEFGH:BADCFEHG +coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/1EXB_r_l_b.model.pdb examples/1EXB_r_l_b.pdb --short --mapping AB*:BA* > test +diff test testdata/1EXB_AB.BA.dockq +coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/1EXB_r_l_b.model.pdb examples/1EXB_r_l_b.pdb --short --mapping :ABC > test +diff test testdata/1EXB_.ABC.dockq +coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/1EXB_r_l_b.model.pdb examples/1EXB_r_l_b.pdb --short --mapping ABCDEFGH:BADCFEHG > test +diff test testdata/1EXB_ABCDEFGH.BADCFEHG.dockq + # Test that cif parsing behaves same as pdb parsing -coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/1EXB_r_l_b.model.pdb examples/1EXB_r_l_b.pdb --mapping DH:AE -coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/1EXB_r_l_b.model.pdb examples/1EXB.cif.gz --mapping DH:AE +coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/1EXB_r_l_b.model.pdb examples/1EXB_r_l_b.pdb --mapping DH:AE > test +diff test testdata/1EXB_DH.AE.dockq +coverage run -a --source='DockQ.DockQ' -m DockQ.DockQ examples/1EXB_r_l_b.model.pdb examples/1EXB.cif.gz --mapping DH:AE > test +diff test testdata/1EXB_DH.AE_cif.dockq coverage report diff --git a/src/DockQ/DockQ.py b/src/DockQ/DockQ.py index a180061..a11e91b 100755 --- a/src/DockQ/DockQ.py +++ b/src/DockQ/DockQ.py @@ -3,6 +3,7 @@ import sys import gzip import hashlib +import warnings import traceback import itertools import math @@ -22,7 +23,7 @@ from .operations import residue_distances, get_fnat_stats from .parsers import PDBParser, MMCIFParser except ImportError: - print( + warnings.warn( """WARNING: It looks like cython is not working, falling back on native python. This will make DockQ slower""" ) diff --git a/testdata/1A2K.dockq b/testdata/1A2K.dockq new file mode 100644 index 0000000..0ac14cc --- /dev/null +++ b/testdata/1A2K.dockq @@ -0,0 +1,37 @@ +**************************************************************** +* DockQ * +* Scoring function for protein-protein docking models * +* Statistics on CAPRI data: * +* 0.00 <= DockQ < 0.23 - Incorrect * +* 0.23 <= DockQ < 0.49 - Acceptable quality * +* 0.49 <= DockQ < 0.80 - Medium quality * +* DockQ >= 0.80 - High quality * +* Ref: S. Basu and B. Wallner, DockQ: A quality measure for * +* protein-protein docking models * +* doi:10.1371/journal.pone.0161879 * +* For comments, please email: bjorn.wallner@.liu.se * +**************************************************************** +Model : examples/1A2K_r_l_b.model.pdb +Native : examples/1A2K_r_l_b.pdb +Total DockQ over 3 native interfaces: 1.959 +Native chains: A, B + Model chains: B, A + DockQ_F1: 0.996 + DockQ: 0.994 + irms: 0.000 + Lrms: 0.000 + fnat: 0.983 +Native chains: A, C + Model chains: B, C + DockQ_F1: 0.567 + DockQ: 0.511 + irms: 1.237 + Lrms: 6.864 + fnat: 0.333 +Native chains: B, C + Model chains: A, C + DockQ_F1: 0.500 + DockQ: 0.453 + irms: 2.104 + Lrms: 8.131 + fnat: 0.500 diff --git a/testdata/1EXB_.ABC.dockq b/testdata/1EXB_.ABC.dockq new file mode 100644 index 0000000..f63b8b2 --- /dev/null +++ b/testdata/1EXB_.ABC.dockq @@ -0,0 +1,3 @@ +Total DockQ over 2 native interfaces: 0.998 with ABC:ABC model:native mapping +DockQ 0.995 DockQ_F1 0.998 Fnat 0.985 iRMS 0.000 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping AC:AC examples/1EXB_r_l_b.model.pdb A C -> examples/1EXB_r_l_b.pdb A C +DockQ 1.000 DockQ_F1 1.000 Fnat 1.000 iRMS 0.000 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping BC:BC examples/1EXB_r_l_b.model.pdb B C -> examples/1EXB_r_l_b.pdb B C diff --git a/testdata/1EXB_AB.BA.dockq b/testdata/1EXB_AB.BA.dockq new file mode 100644 index 0000000..b864372 --- /dev/null +++ b/testdata/1EXB_AB.BA.dockq @@ -0,0 +1,17 @@ +Total DockQ over 16 native interfaces: 0.852 with ABCDFHEG:BADCEGFH model:native mapping +DockQ 0.995 DockQ_F1 0.998 Fnat 0.985 iRMS 0.000 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping AC:BD examples/1EXB_r_l_b.model.pdb A C -> examples/1EXB_r_l_b.pdb B D +DockQ 0.995 DockQ_F1 0.998 Fnat 0.985 iRMS 0.000 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping AD:BC examples/1EXB_r_l_b.model.pdb A D -> examples/1EXB_r_l_b.pdb B C +DockQ 0.742 DockQ_F1 0.772 Fnat 0.609 iRMS 0.850 LRMS 3.426 Fnonnat 0.176 clashes 0 mapping AE:BF examples/1EXB_r_l_b.model.pdb A E -> examples/1EXB_r_l_b.pdb B F +DockQ 0.824 DockQ_F1 0.853 Fnat 0.800 iRMS 0.625 LRMS 3.994 Fnonnat 0.000 clashes 0 mapping AG:BH examples/1EXB_r_l_b.model.pdb A G -> examples/1EXB_r_l_b.pdb B H +DockQ 1.000 DockQ_F1 1.000 Fnat 1.000 iRMS 0.000 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping BC:AD examples/1EXB_r_l_b.model.pdb B C -> examples/1EXB_r_l_b.pdb A D +DockQ 0.995 DockQ_F1 0.998 Fnat 0.985 iRMS 0.000 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping BD:AC examples/1EXB_r_l_b.model.pdb B D -> examples/1EXB_r_l_b.pdb A C +DockQ 0.552 DockQ_F1 0.606 Fnat 0.304 iRMS 1.458 LRMS 3.757 Fnonnat 0.000 clashes 0 mapping BF:AE examples/1EXB_r_l_b.model.pdb B F -> examples/1EXB_r_l_b.pdb A E +DockQ 0.694 DockQ_F1 0.751 Fnat 0.400 iRMS 0.793 LRMS 2.831 Fnonnat 0.000 clashes 0 mapping BH:AG examples/1EXB_r_l_b.model.pdb B H -> examples/1EXB_r_l_b.pdb A G +DockQ 0.687 DockQ_F1 0.737 Fnat 0.600 iRMS 1.161 LRMS 3.757 Fnonnat 0.000 clashes 0 mapping CF:DE examples/1EXB_r_l_b.model.pdb C F -> examples/1EXB_r_l_b.pdb D E +DockQ 0.477 DockQ_F1 0.502 Fnat 0.087 iRMS 1.425 LRMS 3.994 Fnonnat 0.000 clashes 0 mapping CG:DH examples/1EXB_r_l_b.model.pdb C G -> examples/1EXB_r_l_b.pdb D H +DockQ 0.775 DockQ_F1 0.812 Fnat 0.609 iRMS 0.711 LRMS 2.831 Fnonnat 0.125 clashes 0 mapping DH:CG examples/1EXB_r_l_b.model.pdb D H -> examples/1EXB_r_l_b.pdb C G +DockQ 0.914 DockQ_F1 0.914 Fnat 1.000 iRMS 0.547 LRMS 3.426 Fnonnat 0.000 clashes 0 mapping DE:CF examples/1EXB_r_l_b.model.pdb D E -> examples/1EXB_r_l_b.pdb C F +DockQ 0.992 DockQ_F1 0.996 Fnat 0.976 iRMS 0.001 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping FH:EG examples/1EXB_r_l_b.model.pdb F H -> examples/1EXB_r_l_b.pdb E G +DockQ 0.992 DockQ_F1 0.996 Fnat 0.976 iRMS 0.001 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping FG:EH examples/1EXB_r_l_b.model.pdb F G -> examples/1EXB_r_l_b.pdb E H +DockQ 0.992 DockQ_F1 0.996 Fnat 0.976 iRMS 0.001 LRMS 0.001 Fnonnat 0.000 clashes 0 mapping HE:GF examples/1EXB_r_l_b.model.pdb H E -> examples/1EXB_r_l_b.pdb G F +DockQ 1.000 DockQ_F1 0.996 Fnat 1.000 iRMS 0.001 LRMS 0.001 Fnonnat 0.024 clashes 0 mapping EG:FH examples/1EXB_r_l_b.model.pdb E G -> examples/1EXB_r_l_b.pdb F H diff --git a/testdata/1EXB_ABCDEFGH.BADCFEHG.dockq b/testdata/1EXB_ABCDEFGH.BADCFEHG.dockq new file mode 100644 index 0000000..1c263d6 --- /dev/null +++ b/testdata/1EXB_ABCDEFGH.BADCFEHG.dockq @@ -0,0 +1,17 @@ +Total DockQ over 16 native interfaces: 0.852 with ABCDEFGH:BADCFEHG model:native mapping +DockQ 0.995 DockQ_F1 0.998 Fnat 0.985 iRMS 0.000 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping AC:BD examples/1EXB_r_l_b.model.pdb A C -> examples/1EXB_r_l_b.pdb B D +DockQ 0.995 DockQ_F1 0.998 Fnat 0.985 iRMS 0.000 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping AD:BC examples/1EXB_r_l_b.model.pdb A D -> examples/1EXB_r_l_b.pdb B C +DockQ 0.742 DockQ_F1 0.772 Fnat 0.609 iRMS 0.850 LRMS 3.426 Fnonnat 0.176 clashes 0 mapping AE:BF examples/1EXB_r_l_b.model.pdb A E -> examples/1EXB_r_l_b.pdb B F +DockQ 0.824 DockQ_F1 0.853 Fnat 0.800 iRMS 0.625 LRMS 3.994 Fnonnat 0.000 clashes 0 mapping AG:BH examples/1EXB_r_l_b.model.pdb A G -> examples/1EXB_r_l_b.pdb B H +DockQ 1.000 DockQ_F1 1.000 Fnat 1.000 iRMS 0.000 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping BC:AD examples/1EXB_r_l_b.model.pdb B C -> examples/1EXB_r_l_b.pdb A D +DockQ 0.995 DockQ_F1 0.998 Fnat 0.985 iRMS 0.000 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping BD:AC examples/1EXB_r_l_b.model.pdb B D -> examples/1EXB_r_l_b.pdb A C +DockQ 0.552 DockQ_F1 0.606 Fnat 0.304 iRMS 1.458 LRMS 3.757 Fnonnat 0.000 clashes 0 mapping BF:AE examples/1EXB_r_l_b.model.pdb B F -> examples/1EXB_r_l_b.pdb A E +DockQ 0.694 DockQ_F1 0.751 Fnat 0.400 iRMS 0.793 LRMS 2.831 Fnonnat 0.000 clashes 0 mapping BH:AG examples/1EXB_r_l_b.model.pdb B H -> examples/1EXB_r_l_b.pdb A G +DockQ 0.687 DockQ_F1 0.737 Fnat 0.600 iRMS 1.161 LRMS 3.757 Fnonnat 0.000 clashes 0 mapping CF:DE examples/1EXB_r_l_b.model.pdb C F -> examples/1EXB_r_l_b.pdb D E +DockQ 0.477 DockQ_F1 0.502 Fnat 0.087 iRMS 1.425 LRMS 3.994 Fnonnat 0.000 clashes 0 mapping CG:DH examples/1EXB_r_l_b.model.pdb C G -> examples/1EXB_r_l_b.pdb D H +DockQ 0.914 DockQ_F1 0.914 Fnat 1.000 iRMS 0.547 LRMS 3.426 Fnonnat 0.000 clashes 0 mapping DE:CF examples/1EXB_r_l_b.model.pdb D E -> examples/1EXB_r_l_b.pdb C F +DockQ 0.775 DockQ_F1 0.812 Fnat 0.609 iRMS 0.711 LRMS 2.831 Fnonnat 0.125 clashes 0 mapping DH:CG examples/1EXB_r_l_b.model.pdb D H -> examples/1EXB_r_l_b.pdb C G +DockQ 1.000 DockQ_F1 0.996 Fnat 1.000 iRMS 0.001 LRMS 0.001 Fnonnat 0.024 clashes 0 mapping EG:FH examples/1EXB_r_l_b.model.pdb E G -> examples/1EXB_r_l_b.pdb F H +DockQ 0.992 DockQ_F1 0.996 Fnat 0.976 iRMS 0.001 LRMS 0.001 Fnonnat 0.000 clashes 0 mapping EH:FG examples/1EXB_r_l_b.model.pdb E H -> examples/1EXB_r_l_b.pdb F G +DockQ 0.992 DockQ_F1 0.996 Fnat 0.976 iRMS 0.001 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping FG:EH examples/1EXB_r_l_b.model.pdb F G -> examples/1EXB_r_l_b.pdb E H +DockQ 0.992 DockQ_F1 0.996 Fnat 0.976 iRMS 0.001 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping FH:EG examples/1EXB_r_l_b.model.pdb F H -> examples/1EXB_r_l_b.pdb E G diff --git a/testdata/1EXB_DH.AE.dockq b/testdata/1EXB_DH.AE.dockq new file mode 100644 index 0000000..3b5e296 --- /dev/null +++ b/testdata/1EXB_DH.AE.dockq @@ -0,0 +1,23 @@ +**************************************************************** +* DockQ * +* Scoring function for protein-protein docking models * +* Statistics on CAPRI data: * +* 0.00 <= DockQ < 0.23 - Incorrect * +* 0.23 <= DockQ < 0.49 - Acceptable quality * +* 0.49 <= DockQ < 0.80 - Medium quality * +* DockQ >= 0.80 - High quality * +* Ref: S. Basu and B. Wallner, DockQ: A quality measure for * +* protein-protein docking models * +* doi:10.1371/journal.pone.0161879 * +* For comments, please email: bjorn.wallner@.liu.se * +**************************************************************** +Model : examples/1EXB_r_l_b.model.pdb +Native : examples/1EXB_r_l_b.pdb +Total DockQ over 1 native interfaces: 0.775 +Native chains: A, E + Model chains: D, H + DockQ_F1: 0.812 + DockQ: 0.775 + irms: 0.711 + Lrms: 2.831 + fnat: 0.609 diff --git a/testdata/1EXB_DH.AE_cif.dockq b/testdata/1EXB_DH.AE_cif.dockq new file mode 100644 index 0000000..52d2056 --- /dev/null +++ b/testdata/1EXB_DH.AE_cif.dockq @@ -0,0 +1,23 @@ +**************************************************************** +* DockQ * +* Scoring function for protein-protein docking models * +* Statistics on CAPRI data: * +* 0.00 <= DockQ < 0.23 - Incorrect * +* 0.23 <= DockQ < 0.49 - Acceptable quality * +* 0.49 <= DockQ < 0.80 - Medium quality * +* DockQ >= 0.80 - High quality * +* Ref: S. Basu and B. Wallner, DockQ: A quality measure for * +* protein-protein docking models * +* doi:10.1371/journal.pone.0161879 * +* For comments, please email: bjorn.wallner@.liu.se * +**************************************************************** +Model : examples/1EXB_r_l_b.model.pdb +Native : examples/1EXB.cif.gz +Total DockQ over 1 native interfaces: 0.775 +Native chains: A, E + Model chains: D, H + DockQ_F1: 0.812 + DockQ: 0.775 + irms: 0.711 + Lrms: 2.831 + fnat: 0.609 diff --git a/testdata/dimer_dimer.dockq b/testdata/dimer_dimer.dockq new file mode 100644 index 0000000..1f4c077 --- /dev/null +++ b/testdata/dimer_dimer.dockq @@ -0,0 +1,5 @@ +Total DockQ over 4 native interfaces: 1.000 with ABLH:ABLH model:native mapping +DockQ 1.000 DockQ_F1 1.000 Fnat 1.000 iRMS 0.000 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping AB:AB examples/dimer_dimer.model.pdb A B -> examples/dimer_dimer.pdb A B +DockQ 1.000 DockQ_F1 1.000 Fnat 1.000 iRMS 0.000 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping AL:AL examples/dimer_dimer.model.pdb A L -> examples/dimer_dimer.pdb A L +DockQ 1.000 DockQ_F1 1.000 Fnat 1.000 iRMS 0.000 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping AH:AH examples/dimer_dimer.model.pdb A H -> examples/dimer_dimer.pdb A H +DockQ 1.000 DockQ_F1 1.000 Fnat 1.000 iRMS 0.000 LRMS 0.000 Fnonnat 0.000 clashes 0 mapping LH:LH examples/dimer_dimer.model.pdb L H -> examples/dimer_dimer.pdb L H diff --git a/testdata/model.dockq b/testdata/model.dockq new file mode 100644 index 0000000..767269a --- /dev/null +++ b/testdata/model.dockq @@ -0,0 +1,23 @@ +**************************************************************** +* DockQ * +* Scoring function for protein-protein docking models * +* Statistics on CAPRI data: * +* 0.00 <= DockQ < 0.23 - Incorrect * +* 0.23 <= DockQ < 0.49 - Acceptable quality * +* 0.49 <= DockQ < 0.80 - Medium quality * +* DockQ >= 0.80 - High quality * +* Ref: S. Basu and B. Wallner, DockQ: A quality measure for * +* protein-protein docking models * +* doi:10.1371/journal.pone.0161879 * +* For comments, please email: bjorn.wallner@.liu.se * +**************************************************************** +Model : examples/model.pdb +Native : examples/native.pdb +Total DockQ over 1 native interfaces: 0.700 +Native chains: A, B + Model chains: A, B + DockQ_F1: 0.731 + DockQ: 0.700 + irms: 1.232 + Lrms: 1.516 + fnat: 0.533