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
637b795a
Unverified
Commit
637b795a
authored
Feb 01, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of github.com:PDB-REDO/libcifpp into develop
parents
d88d5205
4de981a3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
66 deletions
+68
-66
include/cif++/model.hpp
+7
-26
src/model.cpp
+41
-27
src/pdb/pdb2cif.cpp
+20
-13
No files found.
include/cif++/model.hpp
View file @
637b795a
...
...
@@ -321,13 +321,6 @@ class atom
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
atom
&
atom
);
// /// \brief Synchronize data with underlying cif data
// void sync()
// {
// if (m_impl)
// m_impl->prefetch();
// }
private
:
friend
class
structure
;
...
...
@@ -341,25 +334,6 @@ class atom
std
::
shared_ptr
<
atom_impl
>
m_impl
;
};
// template <>
// inline std::string atom::get_property<std::string>(const std::string_view name) const
// {
// return get_property(name);
// }
// template <>
// inline int atom::get_property<int>(const std::string_view name) const
// {
// auto v = impl().get_property(name);
// return v.empty() ? 0 : stoi(v);
// }
// template <>
// inline float atom::get_property<float>(const std::string_view name) const
// {
// return stof(impl().get_property(name));
// }
inline
void
swap
(
atom
&
a
,
atom
&
b
)
{
a
.
swap
(
b
);
...
...
@@ -949,4 +923,11 @@ class structure
std
::
vector
<
residue
>
m_non_polymers
;
};
// --------------------------------------------------------------------
/// \brief Reconstruct all missing categories for an assumed PDBx file.
/// Some people believe that simply dumping some atom records is enough.
/// \param db The cif::datablock that hopefully contains some valid data
void
reconstruct_pdbx
(
datablock
&
db
);
}
// namespace cif::mm
src/model.cpp
View file @
637b795a
...
...
@@ -618,19 +618,19 @@ float monomer::phi() const
{
float
result
=
360
;
try
{
if
(
m_index
>
0
)
{
auto
&
prev
=
m_polymer
->
operator
[](
m_index
-
1
);
if
(
prev
.
m_seq_id
+
1
==
m_seq_id
)
result
=
static_cast
<
float
>
(
dihedral_angle
(
prev
.
C
().
get_location
(),
N
().
get_location
(),
CAlpha
().
get_location
(),
C
().
get_location
()));
}
}
catch
(
const
std
::
exception
&
ex
)
{
if
(
VERBOSE
>
0
)
std
::
cerr
<<
ex
.
what
()
<<
std
::
endl
;
auto
a1
=
prev
.
C
();
auto
a2
=
N
();
auto
a3
=
CAlpha
();
auto
a4
=
C
();
if
(
a1
and
a2
and
a3
and
a4
)
result
=
dihedral_angle
(
a1
.
get_location
(),
a2
.
get_location
(),
a3
.
get_location
(),
a4
.
get_location
());
}
}
return
result
;
...
...
@@ -640,19 +640,19 @@ float monomer::psi() const
{
float
result
=
360
;
try
{
if
(
m_index
+
1
<
m_polymer
->
size
())
{
auto
&
next
=
m_polymer
->
operator
[](
m_index
+
1
);
if
(
m_seq_id
+
1
==
next
.
m_seq_id
)
result
=
static_cast
<
float
>
(
dihedral_angle
(
N
().
get_location
(),
CAlpha
().
get_location
(),
C
().
get_location
(),
next
.
N
().
get_location
()));
}
}
catch
(
const
std
::
exception
&
ex
)
{
if
(
VERBOSE
>
0
)
std
::
cerr
<<
ex
.
what
()
<<
std
::
endl
;
auto
a1
=
N
();
auto
a2
=
CAlpha
();
auto
a3
=
C
();
auto
a4
=
next
.
N
();
if
(
a1
and
a2
and
a3
and
a4
)
result
=
dihedral_angle
(
a1
.
get_location
(),
a2
.
get_location
(),
a3
.
get_location
(),
a4
.
get_location
());
}
}
return
result
;
...
...
@@ -935,17 +935,17 @@ float monomer::omega(const monomer &a, const monomer &b)
{
float
result
=
360
;
try
{
auto
a1
=
a
.
get_atom_by_atom_id
(
"CA"
);
auto
a2
=
a
.
get_atom_by_atom_id
(
"C"
);
auto
a3
=
b
.
get_atom_by_atom_id
(
"N"
);
auto
a4
=
b
.
get_atom_by_atom_id
(
"CA"
);
if
(
a1
and
a2
and
a3
and
a4
)
result
=
static_cast
<
float
>
(
dihedral_angle
(
a
.
get_atom_by_atom_id
(
"CA"
).
get_location
(),
a
.
get_atom_by_atom_id
(
"C"
).
get_location
(),
b
.
get_atom_by_atom_id
(
"N"
).
get_location
(),
b
.
get_atom_by_atom_id
(
"CA"
).
get_location
()));
}
catch
(...)
{
}
a1
.
get_location
(),
a2
.
get_location
(),
a3
.
get_location
(),
a4
.
get_location
()));
return
result
;
}
...
...
@@ -974,8 +974,12 @@ polymer::polymer(structure &s, const std::string &entityID, const std::string &a
for
(
auto
r
:
poly_seq_scheme
.
find
(
"asym_id"
_key
==
asym_id
))
{
int
seqID
;
std
::
optional
<
int
>
pdbSeqNum
;
std
::
string
compoundID
,
authSeqID
,
pdbInsCode
;
cif
::
tie
(
seqID
,
authSeqID
,
compoundID
,
pdbInsCode
)
=
r
.
get
(
"seq_id"
,
"auth_seq_num"
,
"mon_id"
,
"pdb_ins_code"
);
cif
::
tie
(
seqID
,
authSeqID
,
compoundID
,
pdbInsCode
,
pdbSeqNum
)
=
r
.
get
(
"seq_id"
,
"auth_seq_num"
,
"mon_id"
,
"pdb_ins_code"
,
"pdb_seq_num"
);
if
(
authSeqID
.
empty
()
and
pdbSeqNum
.
has_value
())
authSeqID
=
std
::
to_string
(
*
pdbSeqNum
);
size_t
index
=
size
();
...
...
@@ -2773,4 +2777,14 @@ void structure::validate_atoms() const
assert
(
atoms
.
empty
());
}
// --------------------------------------------------------------------
void
reconstruct_pdbx
(
datablock
&
db
)
{
if
(
db
.
get
(
"atom_site"
)
==
nullptr
)
throw
std
::
runtime_error
(
"Cannot reconstruct PDBx file, atom data missing"
);
}
}
// namespace pdbx
src/pdb/pdb2cif.cpp
View file @
637b795a
...
...
@@ -3819,27 +3819,33 @@ void PDBFileParser::ConstructEntities()
for
(
std
::
string
monID
:
monIds
)
{
std
::
string
authMonID
,
authSeqNum
,
authInsCode
;
std
::
string
authMonID
,
authSeqNum
,
authInsCode
{
'.'
};
if
(
res
.
mSeen
)
{
authMonID
=
monID
;
authSeqNum
=
std
::
to_string
(
res
.
mSeqNum
);
if
(
res
.
mIcode
!=
' '
and
res
.
mIcode
!=
0
)
authInsCode
=
std
::
string
{
res
.
mIcode
};
cat
->
emplace
({
{
"asym_id"
,
asymID
},
{
"entity_id"
,
mMolID2EntityID
[
chain
.
mMolID
]
},
{
"seq_id"
,
seqID
},
{
"mon_id"
,
monID
},
{
"ndb_seq_num"
,
seqID
},
{
"pdb_seq_num"
,
res
.
mSeqNum
},
{
"auth_seq_num"
,
authSeqNum
},
{
"pdb_mon_id"
,
authMonID
},
{
"auth_mon_id"
,
authMonID
},
{
"pdb_strand_id"
,
std
::
string
{
chain
.
mDbref
.
chainID
}
},
{
"pdb_ins_code"
,
authInsCode
},
{
"hetero"
,
res
.
mAlts
.
empty
()
?
"n"
:
"y"
}
});
}
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
},
...
...
@@ -3848,15 +3854,16 @@ void PDBFileParser::ConstructEntities()
{
"mon_id"
,
monID
},
{
"ndb_seq_num"
,
seqID
},
{
"pdb_seq_num"
,
res
.
mSeqNum
},
{
"auth_seq_num"
,
authSeqNum
},
{
"pdb_mon_id"
,
authMonID
},
{
"auth_mon_id"
,
authMonID
},
{
"auth_seq_num"
,
"."
},
{
"pdb_mon_id"
,
"."
},
{
"auth_mon_id"
,
"."
},
{
"pdb_strand_id"
,
std
::
string
{
chain
.
mDbref
.
chainID
}
},
{
"pdb_ins_code"
,
authInsCode
},
{
"hetero"
,
res
.
mAlts
.
empty
()
?
"n"
:
"y"
}
});
}
}
}
}
// We have now created all compounds, write them out
uint32_t
structRefID
=
0
,
structRefSeqAlignID
=
0
;
...
...
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