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
50693163
Unverified
Commit
50693163
authored
Feb 16, 2021
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When converting pdb to cif, calculate distance for LINKR records
parent
143f17fb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
0 deletions
+58
-0
include/cif++/Cif++.hpp
+13
-0
src/PDB2Cif.cpp
+45
-0
No files found.
include/cif++/Cif++.hpp
View file @
50693163
...
@@ -1195,6 +1195,19 @@ inline Condition Not(Condition&& cond)
...
@@ -1195,6 +1195,19 @@ inline Condition Not(Condition&& cond)
return
Condition
(
new
detail
::
NotConditionImpl
(
std
::
move
(
cond
)));
return
Condition
(
new
detail
::
NotConditionImpl
(
std
::
move
(
cond
)));
}
}
namespace
literals
{
inline
Key
operator
""
_key
(
const
char
*
text
,
size_t
length
)
{
return
Key
(
std
::
string
(
text
,
length
));
}
inline
constexpr
Empty
Null
=
Empty
();
}
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// iterators
// iterators
...
...
src/PDB2Cif.cpp
View file @
50693163
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
#include "cif++/PDB2CifRemark3.hpp"
#include "cif++/PDB2CifRemark3.hpp"
#include "cif++/CifUtils.hpp"
#include "cif++/CifUtils.hpp"
#include "cif++/Symmetry.hpp"
#include "cif++/Symmetry.hpp"
#include "cif++/Point.hpp"
namespace
ba
=
boost
::
algorithm
;
namespace
ba
=
boost
::
algorithm
;
...
@@ -5772,6 +5773,50 @@ void PDBFileParser::Parse(std::istream& is, cif::File& result)
...
@@ -5772,6 +5773,50 @@ void PDBFileParser::Parse(std::istream& is, cif::File& result)
// continue;
// continue;
// }
// }
// }
// }
using
namespace
cif
::
literals
;
auto
&
atom_site
=
*
getCategory
(
"atom_site"
);
// for (const auto& [asym1, seq1, atom1, asym2, seq2, atom2]: getCategory("struct_conn")
// ->find<std::string,std::string,std::string,std::string,std::string,std::string>(
// "pdbx_dist_value"_key == 0 or "pdbx_dist_value"_key == Null,
// { "ptnr1_label_asym_id", "ptnr1_label_seq_id", "ptnr1_label_atom_id",
// "ptnr2_label_asym_id", "ptnr2_label_seq_id", "ptnr2_label_atom_id" }))
// {
// auto a1 = atom_site.find1("label_asym_id"_key == asym1 and "label_seq_id"_key == seq1 and "label_atom_id"_key == atom1);
// auto a2 = atom_site.find1("label_asym_id"_key == asym2 and "label_seq_id"_key == seq2 and "label_atom_id"_key == atom2);
// const auto& [x1, y1, z1] = a1.get<float,float,float>({"cartn_x", "cartn_y", "cartn_z"});
// const auto& [x2, y2, z2] = a2.get<float,float,float>({"cartn_x", "cartn_y", "cartn_z"});
// float distance = mmcif::Distance(mmcif::Point{x1, y1, z1}, mmcif::Point{x2, y2, z2});
// std::cerr << "Distance for link: " << distance << std::endl;
// }
for
(
auto
r
:
getCategory
(
"struct_conn"
)
->
find
(
"pdbx_dist_value"
_key
==
0
or
"pdbx_dist_value"
_key
==
Null
))
{
const
auto
&
[
asym1
,
seq1
,
atom1
,
symm1
,
asym2
,
seq2
,
atom2
,
symm2
]
=
r
.
get
<
std
::
string
,
std
::
string
,
std
::
string
,
std
::
string
,
std
::
string
,
std
::
string
,
std
::
string
,
std
::
string
>
(
{
"ptnr1_label_asym_id"
,
"ptnr1_label_seq_id"
,
"ptnr1_label_atom_id"
,
"ptnr1_symmetry"
,
"ptnr2_label_asym_id"
,
"ptnr2_label_seq_id"
,
"ptnr2_label_atom_id"
,
"ptnr2_symmetry"
});
auto
a1
=
atom_site
.
find1
(
"label_asym_id"
_key
==
asym1
and
"label_seq_id"
_key
==
seq1
and
"label_atom_id"
_key
==
atom1
);
auto
a2
=
atom_site
.
find1
(
"label_asym_id"
_key
==
asym2
and
"label_seq_id"
_key
==
seq2
and
"label_atom_id"
_key
==
atom2
);
const
auto
&
[
x1
,
y1
,
z1
]
=
a1
.
get
<
float
,
float
,
float
>
({
"cartn_x"
,
"cartn_y"
,
"cartn_z"
});
const
auto
&
[
x2
,
y2
,
z2
]
=
a2
.
get
<
float
,
float
,
float
>
({
"cartn_x"
,
"cartn_y"
,
"cartn_z"
});
float
distance
=
1.0
f
;
if
(
symm1
==
"1_555"
and
symm2
==
"1_555"
)
distance
=
mmcif
::
Distance
(
mmcif
::
Point
{
x1
,
y1
,
z1
},
mmcif
::
Point
{
x2
,
y2
,
z2
});
else
if
(
cif
::
VERBOSE
)
std
::
cerr
<<
"Cannot calculate distance for link since one of the atoms is in another dimension"
<<
std
::
endl
;
r
[
"pdbx_dist_value"
]
=
distance
;
}
}
}
catch
(
const
std
::
exception
&
ex
)
catch
(
const
std
::
exception
&
ex
)
{
{
...
...
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