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
35c99564
Unverified
Commit
35c99564
authored
Jun 01, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix importing sugars from PDB files
parent
1d8fe334
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
26 deletions
+54
-26
include/cif++/Structure.hpp
+2
-3
src/PDB2Cif.cpp
+34
-8
src/Structure.cpp
+18
-15
No files found.
include/cif++/Structure.hpp
View file @
35c99564
...
...
@@ -525,12 +525,12 @@ class Sugar : public Residue
{
public
:
Sugar
(
const
Branch
&
branch
,
const
std
::
string
&
compoundID
,
const
std
::
string
&
asymID
,
int
authSeqID
,
int
number
);
const
std
::
string
&
asymID
,
int
authSeqID
);
Sugar
(
Sugar
&&
rhs
);
Sugar
&
operator
=
(
Sugar
&&
rhs
);
int
num
()
const
{
return
mNumber
;
}
int
num
()
const
{
return
std
::
stoi
(
mAuthSeqID
)
;
}
std
::
string
name
()
const
;
/// \brief Return the atom the C1 is linked to
...
...
@@ -545,7 +545,6 @@ class Sugar : public Residue
private
:
const
Branch
*
mBranch
;
int
mNumber
;
Atom
mLink
;
};
...
...
src/PDB2Cif.cpp
View file @
35c99564
...
...
@@ -1077,6 +1077,7 @@ class PDBFileParser
std
::
map
<
std
::
string
,
std
::
string
>
mBranch2EntityID
;
std
::
map
<
std
::
string
,
std
::
string
>
mAsymID2EntityID
;
std
::
map
<
std
::
string
,
std
::
string
>
mMod2parent
;
std
::
set
<
std
::
string
>
mSugarEntities
;
};
// --------------------------------------------------------------------
...
...
@@ -3776,6 +3777,10 @@ void PDBFileParser::ConstructEntities()
for
(
auto
&
chain
:
mChains
)
{
std
::
string
asymID
=
cif
::
cifIdForNumber
(
asymNr
++
);
if
(
mMolID2EntityID
.
count
(
chain
.
mMolID
)
==
0
)
continue
;
std
::
string
entityID
=
mMolID2EntityID
[
chain
.
mMolID
];
mAsymID2EntityID
[
asymID
]
=
entityID
;
...
...
@@ -4601,14 +4606,20 @@ void PDBFileParser::ConstructSugarTrees(int &asymNr)
}
}
mSugarEntities
.
insert
(
entityID
);
// create an asym for this sugar tree
std
::
string
asymID
=
cif
::
cifIdForNumber
(
asymNr
++
);
getCategory
(
"struct_asym"
)
->
emplace
({{
"id"
,
asymID
},
mAsymID2EntityID
[
asymID
]
=
entityID
;
getCategory
(
"struct_asym"
)
->
emplace
({
{
"id"
,
asymID
},
{
"pdbx_blank_PDB_chainid_flag"
,
si
->
chainID
==
' '
?
"Y"
:
"N"
},
{
"pdbx_modified"
,
"N"
},
{
"entity_id"
,
entityID
}});
{
"entity_id"
,
entityID
}
});
std
::
string
iCode
{
si
->
iCode
};
ba
::
trim
(
iCode
);
...
...
@@ -5107,7 +5118,8 @@ void PDBFileParser::ParseConnectivtyAnnotation()
continue
;
}
getCategory
(
"struct_conn"
)
->
emplace
({{
"id"
,
type
+
std
::
to_string
(
linkNr
)},
getCategory
(
"struct_conn"
)
->
emplace
({
{
"id"
,
type
+
std
::
to_string
(
linkNr
)},
{
"conn_type_id"
,
type
},
// { "ccp4_link_id", ccp4LinkID },
...
...
@@ -5140,7 +5152,8 @@ void PDBFileParser::ParseConnectivtyAnnotation()
{
"ptnr2_symmetry"
,
sym2
},
{
"pdbx_dist_value"
,
distance
}});
{
"pdbx_dist_value"
,
distance
}
});
continue
;
}
...
...
@@ -5181,7 +5194,8 @@ void PDBFileParser::ParseConnectivtyAnnotation()
std
::
string
iCode1str
=
iCode1
==
' '
?
std
::
string
()
:
std
::
string
{
iCode1
};
std
::
string
iCode2str
=
iCode2
==
' '
?
std
::
string
()
:
std
::
string
{
iCode2
};
getCategory
(
"struct_mon_prot_cis"
)
->
emplace
({{
"pdbx_id"
,
serNum
},
getCategory
(
"struct_mon_prot_cis"
)
->
emplace
({
{
"pdbx_id"
,
serNum
},
{
"label_comp_id"
,
pep1
},
{
"label_seq_id"
,
lResSeq1
},
{
"label_asym_id"
,
lAsym1
},
...
...
@@ -5198,7 +5212,8 @@ void PDBFileParser::ParseConnectivtyAnnotation()
{
"pdbx_auth_seq_id_2"
,
seqNum2
},
{
"pdbx_auth_asym_id_2"
,
std
::
string
{
chainID2
}},
{
"pdbx_PDB_model_num"
,
modNum
},
{
"pdbx_omega_angle"
,
measure
}});
{
"pdbx_omega_angle"
,
measure
}
});
continue
;
}
...
...
@@ -5557,7 +5572,17 @@ void PDBFileParser::ParseCoordinate(int modelNr)
}
}
getCategory
(
"atom_site"
)
->
emplace
({{
"group_PDB"
,
groupPDB
},
// if the atom is part of a sugar, we need to replace the auth_seq_id/resSeq
if
(
mSugarEntities
.
count
(
entityID
))
{
using
namespace
cif
::
literals
;
auto
&
branch_scheme
=
*
getCategory
(
"pdbx_branch_scheme"
);
resSeq
=
branch_scheme
.
find1
<
int
>
(
"asym_id"
_key
==
asymID
and
"auth_seq_num"
_key
==
resSeq
,
"pdb_seq_num"
);
}
getCategory
(
"atom_site"
)
->
emplace
({
{
"group_PDB"
,
groupPDB
},
{
"id"
,
mAtomID
},
{
"type_symbol"
,
element
},
{
"label_atom_id"
,
name
},
...
...
@@ -5577,7 +5602,8 @@ void PDBFileParser::ParseCoordinate(int modelNr)
{
"auth_comp_id"
,
resName
},
{
"auth_asym_id"
,
std
::
string
{
chainID
}},
{
"auth_atom_id"
,
name
},
{
"pdbx_PDB_model_num"
,
modelNr
}});
{
"pdbx_PDB_model_num"
,
modelNr
}
});
InsertAtomType
(
element
);
...
...
src/Structure.cpp
View file @
35c99564
...
...
@@ -1123,17 +1123,15 @@ int Polymer::Distance(const Monomer &a, const Monomer &b) const
// --------------------------------------------------------------------
Sugar
::
Sugar
(
const
Branch
&
branch
,
const
std
::
string
&
compoundID
,
const
std
::
string
&
asymID
,
int
authSeqID
,
int
number
)
const
std
::
string
&
asymID
,
int
authSeqID
)
:
Residue
(
branch
.
structure
(),
compoundID
,
asymID
,
0
,
std
::
to_string
(
authSeqID
))
,
mBranch
(
&
branch
)
,
mNumber
(
number
)
{
}
Sugar
::
Sugar
(
Sugar
&&
rhs
)
:
Residue
(
std
::
forward
<
Residue
>
(
rhs
))
,
mBranch
(
rhs
.
mBranch
)
,
mNumber
(
rhs
.
mNumber
)
{
}
...
...
@@ -1144,7 +1142,6 @@ Sugar &Sugar::operator=(Sugar &&rhs)
{
Residue
::
operator
=
(
std
::
forward
<
Residue
>
(
rhs
));
mBranch
=
rhs
.
mBranch
;
mNumber
=
rhs
.
mNumber
;
}
return
*
this
;
...
...
@@ -1206,10 +1203,10 @@ Branch::Branch(Structure &structure, const std::string &asymID)
for
(
const
auto
&
[
entity_id
]
:
struct_asym
.
find
<
std
::
string
>
(
"id"
_key
==
asymID
,
"entity_id"
))
{
for
(
const
auto
&
[
comp_id
,
num
ber
,
auth_seq_num
]
:
branch_scheme
.
find
<
std
::
string
,
int
,
int
>
(
"asym_id"
_key
==
asymID
,
"mon_id"
,
"pdb_seq_num"
,
"auth_seq_num"
))
for
(
const
auto
&
[
comp_id
,
num
]
:
branch_scheme
.
find
<
std
::
string
,
int
>
(
"asym_id"
_key
==
asymID
,
"mon_id"
,
"pdb_seq_num"
))
{
emplace_back
(
*
this
,
comp_id
,
asymID
,
auth_seq_num
,
number
);
emplace_back
(
*
this
,
comp_id
,
asymID
,
num
);
}
for
(
const
auto
&
[
num1
,
num2
,
atom1
,
atom2
]
:
branch_link
.
find
<
size_t
,
size_t
,
std
::
string
,
std
::
string
>
(
...
...
@@ -2260,11 +2257,13 @@ std::string Structure::createNonpoly(const std::string &entity_id, const std::ve
auto
&
struct_asym
=
db
[
"struct_asym"
];
std
::
string
asym_id
=
struct_asym
.
getUniqueID
();
struct_asym
.
emplace
({{
"id"
,
asym_id
},
struct_asym
.
emplace
({
{
"id"
,
asym_id
},
{
"pdbx_blank_PDB_chainid_flag"
,
"N"
},
{
"pdbx_modified"
,
"N"
},
{
"entity_id"
,
entity_id
},
{
"details"
,
"?"
}});
{
"details"
,
"?"
}
});
std
::
string
comp_id
=
db
[
"pdbx_entity_nonpoly"
].
find1
<
std
::
string
>
(
"entity_id"
_key
==
entity_id
,
"comp_id"
);
...
...
@@ -2276,7 +2275,8 @@ std::string Structure::createNonpoly(const std::string &entity_id, const std::ve
{
auto
atom_id
=
atom_site
.
getUniqueID
(
""
);
auto
&&
[
row
,
inserted
]
=
atom_site
.
emplace
({{
"group_PDB"
,
atom
.
get_property
<
std
::
string
>
(
"group_PDB"
)},
auto
&&
[
row
,
inserted
]
=
atom_site
.
emplace
({
{
"group_PDB"
,
atom
.
get_property
<
std
::
string
>
(
"group_PDB"
)},
{
"id"
,
atom_id
},
{
"type_symbol"
,
atom
.
get_property
<
std
::
string
>
(
"type_symbol"
)},
{
"label_atom_id"
,
atom
.
get_property
<
std
::
string
>
(
"label_atom_id"
)},
...
...
@@ -2296,7 +2296,8 @@ std::string Structure::createNonpoly(const std::string &entity_id, const std::ve
{
"auth_comp_id"
,
comp_id
},
{
"auth_asym_id"
,
asym_id
},
{
"auth_atom_id"
,
atom
.
get_property
<
std
::
string
>
(
"label_atom_id"
)},
{
"pdbx_PDB_model_num"
,
1
}});
{
"pdbx_PDB_model_num"
,
1
}
});
auto
&
newAtom
=
emplace_atom
(
std
::
make_shared
<
Atom
::
AtomImpl
>
(
db
,
atom_id
,
row
));
res
.
addAtom
(
newAtom
);
...
...
@@ -2328,11 +2329,13 @@ std::string Structure::createNonpoly(const std::string &entity_id, std::vector<s
auto
&
struct_asym
=
db
[
"struct_asym"
];
std
::
string
asym_id
=
struct_asym
.
getUniqueID
();
struct_asym
.
emplace
({{
"id"
,
asym_id
},
struct_asym
.
emplace
({
{
"id"
,
asym_id
},
{
"pdbx_blank_PDB_chainid_flag"
,
"N"
},
{
"pdbx_modified"
,
"N"
},
{
"entity_id"
,
entity_id
},
{
"details"
,
"?"
}});
{
"details"
,
"?"
}
});
std
::
string
comp_id
=
db
[
"pdbx_entity_nonpoly"
].
find1
<
std
::
string
>
(
"entity_id"
_key
==
entity_id
,
"comp_id"
);
...
...
@@ -2406,7 +2409,7 @@ Branch &Structure::createBranch(std::vector<std::vector<cif::Item>> &nag_atoms)
std
::
string
asym_id
=
struct_asym
.
getUniqueID
();
auto
&
branch
=
mBranches
.
emplace_back
(
*
this
,
asym_id
);
auto
&
sugar
=
branch
.
emplace_back
(
branch
,
"NAG"
,
asym_id
,
1
,
1
);
auto
&
sugar
=
branch
.
emplace_back
(
branch
,
"NAG"
,
asym_id
,
1
);
auto
tmp_entity_id
=
db
[
"entity"
].
getUniqueID
(
""
);
auto
&
atom_site
=
db
[
"atom_site"
];
...
...
@@ -2520,7 +2523,7 @@ Branch &Structure::extendBranch(const std::string &asym_id, std::vector<std::vec
int
sugarNum
=
branch
.
size
()
+
1
;
auto
&
sugar
=
branch
.
emplace_back
(
branch
,
compoundID
,
asym_id
,
sugarNum
,
sugarNum
);
auto
&
sugar
=
branch
.
emplace_back
(
branch
,
compoundID
,
asym_id
,
sugarNum
);
for
(
auto
&
atom
:
atom_info
)
{
...
...
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