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
d86bb314
Unverified
Commit
d86bb314
authored
Jun 01, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better handling of missing residues/mismatch seqres
parent
0ef8eb59
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
33 deletions
+46
-33
src/PDB2Cif.cpp
+17
-2
src/Structure.cpp
+29
-31
No files found.
src/PDB2Cif.cpp
View file @
d86bb314
...
@@ -3801,12 +3801,27 @@ void PDBFileParser::ConstructEntities()
...
@@ -3801,12 +3801,27 @@ void PDBFileParser::ConstructEntities()
for
(
std
::
string
monID
:
monIds
)
for
(
std
::
string
monID
:
monIds
)
{
{
std
::
string
authMonID
,
authSeqNum
;
std
::
string
authMonID
,
authSeqNum
,
authInsCode
;
if
(
res
.
mSeen
)
if
(
res
.
mSeen
)
{
{
authMonID
=
monID
;
authMonID
=
monID
;
authSeqNum
=
std
::
to_string
(
res
.
mSeqNum
);
authSeqNum
=
std
::
to_string
(
res
.
mSeqNum
);
if
(
res
.
mIcode
!=
' '
and
res
.
mIcode
!=
0
)
authInsCode
=
std
::
string
{
res
.
mIcode
};
}
}
else
{
authMonID
=
res
.
mMonID
;
authSeqNum
=
std
::
to_string
(
res
.
mSeqNum
);
if
(
res
.
mIcode
!=
' '
and
res
.
mIcode
!=
0
)
authInsCode
=
std
::
string
{
res
.
mIcode
}
+
"A"
;
else
authInsCode
=
"A"
;
}
if
(
authInsCode
.
empty
())
authInsCode
=
"."
;
cat
->
emplace
({{
"asym_id"
,
asymID
},
cat
->
emplace
({{
"asym_id"
,
asymID
},
{
"entity_id"
,
mMolID2EntityID
[
chain
.
mMolID
]},
{
"entity_id"
,
mMolID2EntityID
[
chain
.
mMolID
]},
...
@@ -3818,7 +3833,7 @@ void PDBFileParser::ConstructEntities()
...
@@ -3818,7 +3833,7 @@ void PDBFileParser::ConstructEntities()
{
"pdb_mon_id"
,
authMonID
},
{
"pdb_mon_id"
,
authMonID
},
{
"auth_mon_id"
,
authMonID
},
{
"auth_mon_id"
,
authMonID
},
{
"pdb_strand_id"
,
std
::
string
{
chain
.
mDbref
.
chainID
}},
{
"pdb_strand_id"
,
std
::
string
{
chain
.
mDbref
.
chainID
}},
{
"pdb_ins_code"
,
(
res
.
mIcode
==
' '
or
res
.
mIcode
==
0
)
?
"."
:
std
::
string
{
res
.
mIcode
}
},
{
"pdb_ins_code"
,
authInsCode
},
{
"hetero"
,
res
.
mAlts
.
empty
()
?
"n"
:
"y"
}});
{
"hetero"
,
res
.
mAlts
.
empty
()
?
"n"
:
"y"
}});
}
}
}
}
...
...
src/Structure.cpp
View file @
d86bb314
...
@@ -127,15 +127,12 @@ bool Atom::AtomImpl::getAnisoU(float anisou[6]) const
...
@@ -127,15 +127,12 @@ bool Atom::AtomImpl::getAnisoU(float anisou[6]) const
auto
cat
=
mDb
.
get
(
"atom_site_anisotrop"
);
auto
cat
=
mDb
.
get
(
"atom_site_anisotrop"
);
if
(
cat
)
if
(
cat
)
{
{
try
for
(
auto
r
:
cat
->
find
(
cif
::
Key
(
"id"
)
==
mID
))
{
{
auto
r
=
cat
->
find1
(
cif
::
Key
(
"id"
)
==
mID
);
cif
::
tie
(
anisou
[
0
],
anisou
[
1
],
anisou
[
2
],
anisou
[
3
],
anisou
[
4
],
anisou
[
5
])
=
cif
::
tie
(
anisou
[
0
],
anisou
[
1
],
anisou
[
2
],
anisou
[
3
],
anisou
[
4
],
anisou
[
5
])
=
r
.
get
(
"U[1][1]"
,
"U[1][2]"
,
"U[1][3]"
,
"U[2][2]"
,
"U[2][3]"
,
"U[3][3]"
);
r
.
get
(
"U[1][1]"
,
"U[1][2]"
,
"U[1][3]"
,
"U[2][2]"
,
"U[2][3]"
,
"U[3][3]"
);
result
=
true
;
result
=
true
;
}
break
;
catch
(
const
std
::
exception
&
e
)
{
}
}
}
}
...
@@ -1471,12 +1468,8 @@ void Structure::loadData()
...
@@ -1471,12 +1468,8 @@ void Structure::loadData()
{
{
auto
&
polySeqScheme
=
category
(
"pdbx_poly_seq_scheme"
);
auto
&
polySeqScheme
=
category
(
"pdbx_poly_seq_scheme"
);
for
(
auto
&
r
:
polySeqScheme
)
for
(
const
auto
&
[
asymID
,
entityID
]
:
polySeqScheme
.
rows
<
std
::
string
,
std
::
string
>
(
"asym_id"
,
"entity_id"
)
)
{
{
std
::
string
asymID
,
entityID
,
seqID
,
monID
;
cif
::
tie
(
asymID
,
entityID
,
seqID
,
monID
)
=
r
.
get
(
"asym_id"
,
"entity_id"
,
"seq_id"
,
"mon_id"
);
if
(
mPolymers
.
empty
()
or
mPolymers
.
back
().
asymID
()
!=
asymID
or
mPolymers
.
back
().
entityID
()
!=
entityID
)
if
(
mPolymers
.
empty
()
or
mPolymers
.
back
().
asymID
()
!=
asymID
or
mPolymers
.
back
().
entityID
()
!=
entityID
)
mPolymers
.
emplace_back
(
*
this
,
entityID
,
asymID
);
mPolymers
.
emplace_back
(
*
this
,
entityID
,
asymID
);
}
}
...
@@ -1491,14 +1484,8 @@ void Structure::loadData()
...
@@ -1491,14 +1484,8 @@ void Structure::loadData()
auto
&
nonPolyScheme
=
category
(
"pdbx_nonpoly_scheme"
);
auto
&
nonPolyScheme
=
category
(
"pdbx_nonpoly_scheme"
);
for
(
auto
&
r
:
nonPolyScheme
)
for
(
const
auto
&
[
asymID
,
monID
,
pdbSeqNum
]
:
nonPolyScheme
.
rows
<
std
::
string
,
std
::
string
,
std
::
string
>
(
"asym_id"
,
"mon_id"
,
"pdb_seq_num"
))
{
std
::
string
asymID
,
monID
,
pdbSeqNum
;
cif
::
tie
(
asymID
,
monID
,
pdbSeqNum
)
=
r
.
get
(
"asym_id"
,
"mon_id"
,
"pdb_seq_num"
);
mNonPolymers
.
emplace_back
(
*
this
,
monID
,
asymID
,
0
,
pdbSeqNum
);
mNonPolymers
.
emplace_back
(
*
this
,
monID
,
asymID
,
0
,
pdbSeqNum
);
}
// place atoms in residues
// place atoms in residues
...
@@ -1595,30 +1582,25 @@ EntityType Structure::getEntityTypeForAsymID(const std::string asymID) const
...
@@ -1595,30 +1582,25 @@ EntityType Structure::getEntityTypeForAsymID(const std::string asymID) const
AtomView
Structure
::
waters
()
const
AtomView
Structure
::
waters
()
const
{
{
using
namespace
cif
::
literals
;
AtomView
result
;
AtomView
result
;
auto
&
db
=
datablock
();
auto
&
db
=
datablock
();
// Get the entity id for water
// Get the entity id for water
. Watch out, structure may not have water at all
auto
&
entityCat
=
db
[
"entity"
];
auto
&
entityCat
=
db
[
"entity"
];
std
::
string
waterEntityID
;
for
(
const
auto
&
[
waterEntityID
]
:
entityCat
.
find
<
std
::
string
>
(
"type"
_key
==
"water"
,
"id"
))
for
(
auto
&
e
:
entityCat
)
{
std
::
string
id
,
type
;
cif
::
tie
(
id
,
type
)
=
e
.
get
(
"id"
,
"type"
);
if
(
ba
::
iequals
(
type
,
"water"
))
{
{
waterEntityID
=
id
;
break
;
}
}
for
(
auto
&
a
:
mAtoms
)
for
(
auto
&
a
:
mAtoms
)
{
{
if
(
a
.
get_property
<
std
::
string
>
(
"label_entity_id"
)
==
waterEntityID
)
if
(
a
.
get_property
<
std
::
string
>
(
"label_entity_id"
)
==
waterEntityID
)
result
.
push_back
(
a
);
result
.
push_back
(
a
);
}
}
break
;
}
return
result
;
return
result
;
}
}
...
@@ -1764,7 +1746,15 @@ Residue &Structure::getResidue(const std::string &asymID, int seqID, const std::
...
@@ -1764,7 +1746,15 @@ Residue &Structure::getResidue(const std::string &asymID, int seqID, const std::
}
}
}
}
throw
std
::
out_of_range
(
"Could not find residue "
+
asymID
+
'/'
+
std
::
to_string
(
seqID
)
+
'-'
+
authSeqID
);
std
::
string
desc
=
asymID
;
if
(
seqID
!=
0
)
desc
+=
"/"
+
std
::
to_string
(
seqID
);
if
(
not
authSeqID
.
empty
())
desc
+=
"-"
+
authSeqID
;
throw
std
::
out_of_range
(
"Could not find residue "
+
desc
);
}
}
Residue
&
Structure
::
getResidue
(
const
std
::
string
&
asymID
,
const
std
::
string
&
compID
,
int
seqID
,
const
std
::
string
&
authSeqID
)
Residue
&
Structure
::
getResidue
(
const
std
::
string
&
asymID
,
const
std
::
string
&
compID
,
int
seqID
,
const
std
::
string
&
authSeqID
)
...
@@ -1802,7 +1792,15 @@ Residue &Structure::getResidue(const std::string &asymID, const std::string &com
...
@@ -1802,7 +1792,15 @@ Residue &Structure::getResidue(const std::string &asymID, const std::string &com
}
}
}
}
throw
std
::
out_of_range
(
"Could not find residue "
+
asymID
+
'/'
+
std
::
to_string
(
seqID
)
+
'-'
+
authSeqID
);
std
::
string
desc
=
asymID
;
if
(
seqID
!=
0
)
desc
+=
"/"
+
std
::
to_string
(
seqID
);
if
(
not
authSeqID
.
empty
())
desc
+=
"-"
+
authSeqID
;
throw
std
::
out_of_range
(
"Could not find residue "
+
desc
+
" of type "
+
compID
);
}
}
Branch
&
Structure
::
getBranchByAsymID
(
const
std
::
string
&
asymID
)
Branch
&
Structure
::
getBranchByAsymID
(
const
std
::
string
&
asymID
)
...
...
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