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
f0b8416e
Commit
f0b8416e
authored
1 year ago
by
B13nch3n
Browse files
Options
Downloads
Patches
Plain Diff
Reduce loc
parent
72f09e40
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
validation/test-suite.py
+1
-1
1 addition, 1 deletion
validation/test-suite.py
validation/validate-mmcif-file.py
+23
-28
23 additions, 28 deletions
validation/validate-mmcif-file.py
with
24 additions
and
29 deletions
validation/test-suite.py
+
1
−
1
View file @
f0b8416e
...
...
@@ -355,8 +355,8 @@ def _main():
+
'"
atom_site
"'
,
],
},
# duplicated item in _loop category
# missing category (entity)
# duplicated item in _loop category
# parent-child relationship issue (remove an atom_type.symbol)
}
...
...
This diff is collapsed.
Click to expand it.
validation/validate-mmcif-file.py
+
23
−
28
View file @
f0b8416e
...
...
@@ -57,14 +57,24 @@ def _parse_command_line():
+
"
external files attached.
"
,
default
=
None
,
)
parser
.
add_argument
(
dic_grp
=
parser
.
add_mutually_exclusive_group
()
dic_grp
.
add_argument
(
"
--dict-sdb
"
,
"
-d
"
,
type
=
str
,
metavar
=
"
<SDB FILE>
"
,
help
=
"
The dictionary in SDB format used for checking.
"
,
help
=
"
The dictionary in SDB format used for checking. Can
'
t be
"
+
"
combined with --modelcif-mode/-m and --pdbx-mmcif-mode/-p.
"
,
default
=
"
/usr/local/share/mmcif-dict-suite/mmcif_ma.sdb
"
,
)
dic_grp
.
add_argument
(
"
--pdbx-mmcif-mode
"
,
"
-p
"
,
action
=
"
store_true
"
,
help
=
"
Check with the PDBX/mmCIF dictionary, for verbatim mmCIF files.
"
+
"
Can
'
t be combined with --dict-sdb/-d and --modelcif-mode/-m.
"
+
"
Default is to check with the ModelCIF dictionary.
"
,
)
parser
.
add_argument
(
"
--out-file
"
,
"
-o
"
,
...
...
@@ -106,6 +116,8 @@ def _parse_command_line():
if
opts
.
extend_validated_file
is
not
None
:
if
opts
.
extend_validated_file
==
"
same
"
:
opts
.
extend_validated_file
=
opts
.
model_cif
if
opts
.
pdbx_mmcif_mode
is
True
:
opts
.
dict_sdb
=
"
/usr/local/share/mmcif-dict-suite/mmcif_pdbx_v50.sdb
"
return
opts
...
...
@@ -135,42 +147,23 @@ def _parse_cifcheck_stderr(stderr):
return
error_lst
def
_parse_parser_file
(
filename
):
"""
Parse the parser output file of CifCheck.
"""
parserfile
=
filename
+
"
-parser.log
"
if
not
os
.
path
.
exists
(
parserfile
):
return
[]
error_lst
=
[]
with
open
(
parserfile
,
encoding
=
"
utf-8
"
)
as
dfh
:
for
line
in
dfh
:
line
=
line
.
strip
()
error_lst
.
append
(
line
)
# remove the diag file
os
.
unlink
(
parserfile
)
return
error_lst
def
_parse_diag_file
(
filename
):
def
_get_cifcheck_out
(
filename
,
suffix
,
encoding
):
"""
Parse the diagnosis file of CifCheck.
"""
# CifCheck places the diag file in the current working directory.
diagfile
=
filename
+
"
-diag.log
"
if
not
os
.
path
.
exists
(
diagfile
):
cifcheck
=
filename
+
suffix
if
not
os
.
path
.
exists
(
cifcheck
):
return
[]
error_lst
=
[]
# CifCheck outputs diag files as iso-8859
with
open
(
diagfile
,
encoding
=
"
iso-8859-1
"
)
as
dfh
:
with
open
(
cifcheck
,
encoding
=
encoding
)
as
dfh
:
for
line
in
dfh
:
line
=
line
.
strip
()
if
line
==
""
:
continue
error_lst
.
append
(
line
)
# remove the diag file
os
.
unlink
(
diagfile
)
os
.
unlink
(
cifcheck
)
return
error_lst
...
...
@@ -592,12 +585,14 @@ class _CifCheck:
error_lst
=
[]
# get error messages on the command line
error_lst
.
extend
(
_parse_cifcheck_stderr
(
cps
.
stderr
))
error_lst
.
extend
(
_
parse_parser_file
(
filepath
))
error_lst
.
extend
(
_
get_cifcheck_out
(
filepath
,
"
-parser.log
"
,
"
utf-8
"
))
if
len
(
error_lst
)
>
0
:
raise
_CifCheckFailedError
(
cifcheck_cmd
,
error_lst
)
# get messages from diagnosis file
error_lst
.
extend
(
_parse_diag_file
(
filepath
))
error_lst
.
extend
(
_get_cifcheck_out
(
filepath
,
"
-diag.log
"
,
"
iso-8859-1
"
)
)
return
error_lst
...
...
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