Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor 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
openstructure
Commits
019687e5
Verified
Commit
019687e5
authored
1 year ago
by
Xavier Robin
Browse files
Options
Downloads
Patches
Plain Diff
refactor: use OST logging
parent
f0ac4010
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
modules/conop/src/chemdict_tool.cc
+5
-0
5 additions, 0 deletions
modules/conop/src/chemdict_tool.cc
modules/io/src/mol/chemdict_parser.cc
+12
-10
12 additions, 10 deletions
modules/io/src/mol/chemdict_parser.cc
with
17 additions
and
10 deletions
modules/conop/src/chemdict_tool.cc
+
5
−
0
View file @
019687e5
...
...
@@ -30,6 +30,7 @@
#include
<ost/io/mol/chemdict_parser.hh>
#include
<ost/log.hh>
using
namespace
ost
;
...
...
@@ -43,6 +44,7 @@ void PrintUsage()
std
::
cout
<<
"supported options are:"
<<
std
::
endl
;
std
::
cout
<<
" -i - ignore compounds reserved by the PDB (01-99, DRG, INH, LIG)"
<<
std
::
endl
;
std
::
cout
<<
" -o - ignore obsolete compounds"
<<
std
::
endl
;
std
::
cout
<<
" -v - be more verbose"
<<
std
::
endl
;
}
int
main
(
int
argc
,
char
const
*
argv
[])
...
...
@@ -51,6 +53,7 @@ int main(int argc, char const *argv[])
PrintUsage
();
return
0
;
}
Logger
::
Instance
().
PushVerbosityLevel
(
1
);
conop
::
Compound
::
Dialect
dialect
=
conop
::
Compound
::
PDB
;
bool
ignore_reserved
=
false
;
bool
ignore_obsolete
=
false
;
...
...
@@ -69,6 +72,8 @@ int main(int argc, char const *argv[])
ignore_reserved
=
true
;
}
else
if
(
param
==
"-o"
)
{
ignore_obsolete
=
true
;
}
else
if
(
param
==
"-v"
)
{
Logger
::
Instance
().
PushVerbosityLevel
(
4
);
}
else
{
PrintUsage
();
return
0
;
...
...
This diff is collapsed.
Click to expand it.
modules/io/src/mol/chemdict_parser.cc
+
12
−
10
View file @
019687e5
#include
<ost/io/mol/chemdict_parser.hh>
#include
<ost/log.hh>
namespace
ost
{
namespace
io
{
...
...
@@ -75,9 +76,9 @@ void ChemdictParser::OnDataRow(const StarLoopDesc& header,
if
(
columns
[
indices_
[
DESC_TYPE
]]
==
StringRef
(
"InChI"
,
5
))
{
// for type InChi check prefix 'InChI='
if
(
columns
[
indices_
[
DESC
]].
substr
(
0
,
6
)
!=
StringRef
(
"InChI="
,
6
))
{
std
::
cout
<<
"InChI problem: compound "
<<
compound_
->
GetID
()
<<
" has an InChI descriptor not starting with the "
"'InChI=' prefix."
<<
std
::
endl
;
LOG_WARNING
(
"InChI problem: compound "
<<
compound_
->
GetID
()
<<
" has an InChI descriptor not starting with the "
<<
"'InChI=' prefix."
)
;
return
;
}
compound_
->
SetInchi
(
columns
[
indices_
[
DESC
]].
str
());
...
...
@@ -108,8 +109,8 @@ void ChemdictParser::OnDataItem(const StarDataItem& item)
if
(
i
!=
tm_
.
end
())
{
compound_
->
SetChemClass
(
i
->
second
);
}
else
{
std
::
cout
<<
"unknown type '"
<<
type
<<
"' for compound "
<<
compound_
->
GetID
()
<<
std
::
endl
;
LOG_WARNING
(
"unknown type '"
<<
type
<<
"' for compound "
<<
compound_
->
GetID
()
)
;
}
}
}
else
if
(
item
.
GetName
()
==
StringRef
(
"pdbx_type"
,
9
))
{
...
...
@@ -121,14 +122,15 @@ void ChemdictParser::OnDataItem(const StarDataItem& item)
if
(
i
!=
xtm_
.
end
())
{
compound_
->
SetChemType
(
i
->
second
);
}
else
{
std
::
cout
<<
"unknown pdbx_type '"
<<
type
<<
"' for compound "
<<
compound_
->
GetID
()
<<
std
::
endl
;
std
::
cout
<<
"ERR"
<<
std
::
endl
;
LOG_WARNING
(
"unknown pdbx_type '"
<<
type
<<
"' for compound "
<<
compound_
->
GetID
());
}
}
else
if
(
item
.
GetName
()
==
StringRef
(
"name"
,
4
))
{
compound_
->
SetName
(
item
.
GetValue
().
str
());
if
(
compound_
->
GetName
()
==
""
){
std
::
cout
<<
"unknown compound name, chemcomp.name field empty for
compound:
"
<<
compound_
->
GetID
()
<<
std
::
endl
;
LOG_WARNING
(
"unknown compound name, chemcomp.name field empty for "
"compound: "
<<
compound_
->
GetID
()
)
;
}
}
else
if
(
item
.
GetName
()
==
StringRef
(
"formula"
,
7
))
{
compound_
->
SetFormula
(
item
.
GetValue
().
str
());
...
...
@@ -268,7 +270,7 @@ bool ChemdictParser::IsNameReserved(const String& data_name)
data_name
==
"LIG"
)
{
std
::
cout
<<
"Ignoring reserved compound "
<<
data_name
<<
std
::
endl
;
LOG_SCRIPT
(
"Ignoring reserved compound "
<<
data_name
)
;
return
true
;
}
return
false
;
...
...
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