Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
bbe71af9
Unverified
Commit
bbe71af9
authored
Nov 03, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept invalid CCD component files, for now
parent
49912d01
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
38 deletions
+48
-38
src/category.cpp
+1
-0
src/compound.cpp
+47
-38
No files found.
src/category.cpp
View file @
bbe71af9
...
@@ -857,6 +857,7 @@ bool category::is_valid() const
...
@@ -857,6 +857,7 @@ bool category::is_valid() const
}
}
catch
(
const
std
::
exception
&
e
)
catch
(
const
std
::
exception
&
e
)
{
{
result
=
false
;
m_validator
->
report_error
(
"Error validating "
+
m_columns
[
cix
].
m_name
+
": "
+
e
.
what
(),
false
);
m_validator
->
report_error
(
"Error validating "
+
m_columns
[
cix
].
m_name
+
": "
+
e
.
what
(),
false
);
continue
;
continue
;
}
}
...
...
src/compound.cpp
View file @
bbe71af9
...
@@ -215,7 +215,8 @@ compound_atom compound::get_atom_by_atom_id(const std::string &atom_id) const
...
@@ -215,7 +215,8 @@ compound_atom compound::get_atom_by_atom_id(const std::string &atom_id) const
bool
compound
::
atoms_bonded
(
const
std
::
string
&
atomId_1
,
const
std
::
string
&
atomId_2
)
const
bool
compound
::
atoms_bonded
(
const
std
::
string
&
atomId_1
,
const
std
::
string
&
atomId_2
)
const
{
{
auto
i
=
find_if
(
m_bonds
.
begin
(),
m_bonds
.
end
(),
auto
i
=
find_if
(
m_bonds
.
begin
(),
m_bonds
.
end
(),
[
&
](
const
compound_bond
&
b
)
{
[
&
](
const
compound_bond
&
b
)
{
return
(
b
.
atom_id
[
0
]
==
atomId_1
and
b
.
atom_id
[
1
]
==
atomId_2
)
or
(
b
.
atom_id
[
0
]
==
atomId_2
and
b
.
atom_id
[
1
]
==
atomId_1
);
return
(
b
.
atom_id
[
0
]
==
atomId_1
and
b
.
atom_id
[
1
]
==
atomId_2
)
or
(
b
.
atom_id
[
0
]
==
atomId_2
and
b
.
atom_id
[
1
]
==
atomId_1
);
});
});
...
@@ -226,39 +227,41 @@ bool compound::atoms_bonded(const std::string &atomId_1, const std::string &atom
...
@@ -226,39 +227,41 @@ bool compound::atoms_bonded(const std::string &atomId_1, const std::string &atom
// known amino acids and bases
// known amino acids and bases
const
std
::
map
<
std
::
string
,
char
>
compound_factory
::
kAAMap
{
const
std
::
map
<
std
::
string
,
char
>
compound_factory
::
kAAMap
{
{
"ALA"
,
'A'
},
{
"ALA"
,
'A'
},
{
"ARG"
,
'R'
},
{
"ARG"
,
'R'
},
{
"ASN"
,
'N'
},
{
"ASN"
,
'N'
},
{
"ASP"
,
'D'
},
{
"ASP"
,
'D'
},
{
"CYS"
,
'C'
},
{
"CYS"
,
'C'
},
{
"GLN"
,
'Q'
},
{
"GLN"
,
'Q'
},
{
"GLU"
,
'E'
},
{
"GLU"
,
'E'
},
{
"GLY"
,
'G'
},
{
"GLY"
,
'G'
},
{
"HIS"
,
'H'
},
{
"HIS"
,
'H'
},
{
"ILE"
,
'I'
},
{
"ILE"
,
'I'
},
{
"LEU"
,
'L'
},
{
"LEU"
,
'L'
},
{
"LYS"
,
'K'
},
{
"LYS"
,
'K'
},
{
"MET"
,
'M'
},
{
"MET"
,
'M'
},
{
"PHE"
,
'F'
},
{
"PHE"
,
'F'
},
{
"PRO"
,
'P'
},
{
"PRO"
,
'P'
},
{
"SER"
,
'S'
},
{
"SER"
,
'S'
},
{
"THR"
,
'T'
},
{
"THR"
,
'T'
},
{
"TRP"
,
'W'
},
{
"TRP"
,
'W'
},
{
"TYR"
,
'Y'
},
{
"TYR"
,
'Y'
},
{
"VAL"
,
'V'
},
{
"VAL"
,
'V'
},
{
"GLX"
,
'Z'
},
{
"GLX"
,
'Z'
},
{
"ASX"
,
'B'
}};
{
"ASX"
,
'B'
}
};
const
std
::
map
<
std
::
string
,
char
>
compound_factory
::
kBaseMap
{
const
std
::
map
<
std
::
string
,
char
>
compound_factory
::
kBaseMap
{
{
"A"
,
'A'
},
{
"A"
,
'A'
},
{
"C"
,
'C'
},
{
"C"
,
'C'
},
{
"G"
,
'G'
},
{
"G"
,
'G'
},
{
"T"
,
'T'
},
{
"T"
,
'T'
},
{
"U"
,
'U'
},
{
"U"
,
'U'
},
{
"DA"
,
'A'
},
{
"DA"
,
'A'
},
{
"DC"
,
'C'
},
{
"DC"
,
'C'
},
{
"DG"
,
'G'
},
{
"DG"
,
'G'
},
{
"DT"
,
'T'
}};
{
"DT"
,
'T'
}
};
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// a factory class to generate compounds
// a factory class to generate compounds
...
@@ -272,7 +275,7 @@ class compound_factory_impl : public std::enable_shared_from_this<compound_facto
...
@@ -272,7 +275,7 @@ class compound_factory_impl : public std::enable_shared_from_this<compound_facto
virtual
~
compound_factory_impl
()
virtual
~
compound_factory_impl
()
{
{
for
(
auto
c
:
m_compounds
)
for
(
auto
c
:
m_compounds
)
delete
c
;
delete
c
;
}
}
...
@@ -334,7 +337,6 @@ class compound_factory_impl : public std::enable_shared_from_this<compound_facto
...
@@ -334,7 +337,6 @@ class compound_factory_impl : public std::enable_shared_from_this<compound_facto
}
}
protected
:
protected
:
virtual
compound
*
create
(
const
std
::
string
&
id
)
virtual
compound
*
create
(
const
std
::
string
&
id
)
{
{
// For the base class we assume every compound is preloaded
// For the base class we assume every compound is preloaded
...
@@ -414,10 +416,18 @@ compound_factory_impl::compound_factory_impl(const fs::path &file, std::shared_p
...
@@ -414,10 +416,18 @@ compound_factory_impl::compound_factory_impl(const fs::path &file, std::shared_p
else
else
{
{
// A CCD components file, validate it first
// A CCD components file, validate it first
try
{
cifFile
.
load_dictionary
(
"mmcif_pdbx.dic"
);
cifFile
.
load_dictionary
(
"mmcif_pdbx.dic"
);
if
(
not
cifFile
.
is_valid
())
if
(
not
cifFile
.
is_valid
())
throw
std
::
runtime_error
(
"Invalid compound file"
);
std
::
cerr
<<
"The components file "
<<
file
<<
" is not valid"
<<
std
::
endl
;
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cerr
<<
"When trying to load the components file "
<<
file
<<
" there was an exception:"
<<
std
::
endl
<<
e
.
what
()
<<
std
::
endl
;
}
for
(
auto
&
db
:
cifFile
)
for
(
auto
&
db
:
cifFile
)
m_compounds
.
push_back
(
new
compound
(
db
));
m_compounds
.
push_back
(
new
compound
(
db
));
...
@@ -430,7 +440,7 @@ compound_factory_impl::compound_factory_impl(const fs::path &file, std::shared_p
...
@@ -430,7 +440,7 @@ compound_factory_impl::compound_factory_impl(const fs::path &file, std::shared_p
class
CCD_compound_factory_impl
:
public
compound_factory_impl
class
CCD_compound_factory_impl
:
public
compound_factory_impl
{
{
public
:
public
:
CCD_compound_factory_impl
(
std
::
shared_ptr
<
compound_factory_impl
>
next
,
const
fs
::
path
&
file
)
CCD_compound_factory_impl
(
std
::
shared_ptr
<
compound_factory_impl
>
next
,
const
fs
::
path
&
file
)
:
compound_factory_impl
(
next
)
:
compound_factory_impl
(
next
)
,
mCompoundsFile
(
file
)
,
mCompoundsFile
(
file
)
{
{
...
@@ -647,7 +657,6 @@ compound_factory::compound_factory()
...
@@ -647,7 +657,6 @@ compound_factory::compound_factory()
m_impl
.
reset
(
new
CCP4_compound_factory_impl
(
clibd_mon
));
m_impl
.
reset
(
new
CCP4_compound_factory_impl
(
clibd_mon
));
else
if
(
cif
::
VERBOSE
>
0
)
else
if
(
cif
::
VERBOSE
>
0
)
std
::
cerr
<<
"CCP4 monomers library not found, CLIBD_MON is not defined"
<<
std
::
endl
;
std
::
cerr
<<
"CCP4 monomers library not found, CLIBD_MON is not defined"
<<
std
::
endl
;
}
}
compound_factory
::~
compound_factory
()
compound_factory
::~
compound_factory
()
...
@@ -729,4 +738,4 @@ bool compound_factory::is_known_base(const std::string &resName) const
...
@@ -729,4 +738,4 @@ bool compound_factory::is_known_base(const std::string &resName) const
return
m_impl
?
m_impl
->
is_known_base
(
resName
)
:
kBaseMap
.
count
(
resName
)
>
0
;
return
m_impl
?
m_impl
->
is_known_base
(
resName
)
:
kBaseMap
.
count
(
resName
)
>
0
;
}
}
}
// namespace
pdbx
}
// namespace
cif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment