Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
modelcif-converters
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
modelcif-converters
Commits
847d3f43
Commit
847d3f43
authored
1 year ago
by
Gerardo Tauriello
Browse files
Options
Downloads
Patches
Plain Diff
SCHWED-6036: relaxed PDB comparison
parent
b1058e54
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/dark-matter-metagenomics/translate2modelcif.py
+20
-8
20 additions, 8 deletions
projects/dark-matter-metagenomics/translate2modelcif.py
with
20 additions
and
8 deletions
projects/dark-matter-metagenomics/translate2modelcif.py
+
20
−
8
View file @
847d3f43
...
...
@@ -23,7 +23,7 @@ import modelcif.model
import
modelcif.protocol
import
modelcif.reference
from
ost
import
io
,
geom
from
ost
import
io
,
geom
,
mol
# EXAMPLE for running:
...
...
@@ -144,7 +144,7 @@ def _compare_ent(ent1, ent2, at_occupancy_thresh=0.01,
return
False
return
True
def
_compare_pdbs
(
f1
,
f2
):
def
_compare_pdbs
(
f_name
,
f1
,
f2
):
"""
Use atom-by-atom comparison on PDB files allowing num. errors.
"""
# first do simple file diff.
if
filecmp
.
cmp
(
f1
,
f2
):
...
...
@@ -153,7 +153,22 @@ def _compare_pdbs(f1, f2):
ent1
=
io
.
LoadPDB
(
f1
)
ent2
=
io
.
LoadPDB
(
f2
)
# allow a bit more errors as input files can have rounding errors
return
_compare_ent
(
ent1
,
ent2
,
0.011
,
0.011
,
0.0011
,
True
,
False
,
True
)
if
_compare_ent
(
ent1
,
ent2
,
0.011
,
0.011
,
0.0011
,
True
,
False
,
True
):
return
True
else
:
# check manually and give warning...
atom_names_1
=
[
a
.
qualified_name
for
a
in
ent1
.
atoms
]
atom_names_2
=
[
a
.
qualified_name
for
a
in
ent2
.
atoms
]
assert
atom_names_1
==
atom_names_2
b_diffs
=
[
abs
(
a1
.
b_factor
-
a2
.
b_factor
)
\
for
a1
,
a2
in
zip
(
ent1
.
atoms
,
ent2
.
atoms
)]
max_b_diff
=
max
(
b_diffs
)
rmsd
=
mol
.
alg
.
CalculateRMSD
(
ent1
.
Select
(
""
),
ent2
.
Select
(
""
))
_warn_msg
(
f
"
PDB file mismatch web vs top-ranked for
{
f_name
}
:
"
f
"
RMSD
{
rmsd
:
.
3
f
}
, max. b_factor diff
{
max_b_diff
:
.
3
f
}
"
)
return
False
################################################################################
...
...
@@ -1057,11 +1072,8 @@ def _translate2modelcif_single(
# sanity check (only for top ranked model!)
if
mdl_rank
==
1
and
opts
.
pdb_web_path
is
not
None
:
pdb_file_web
=
os
.
path
.
join
(
opts
.
pdb_web_path
,
f
"
{
f_name
}
.pdb
"
)
if
not
_compare_pdbs
(
pdb_file
,
pdb_file_web
):
# for now just as warning...(TODO: CHECK)
_warn_msg
(
f
"
PDB file mismatch web vs top-ranked for
"
f
"
{
f_name
}
"
)
# warning handled in compare function...
_compare_pdbs
(
f_name
,
pdb_file
,
pdb_file_web
)
# get scores for this entry
mdlcf_json
[
"
plddt_global
"
]
=
metadata
.
pLDDT
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment