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
8a60bae3
Unverified
Commit
8a60bae3
authored
Jan 04, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
non-throwing remove_residue
add chem_comp for sugars
parent
fa27a11f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
4 deletions
+62
-4
include/cif++/model.hpp
+1
-4
src/model.cpp
+61
-0
No files found.
include/cif++/model.hpp
View file @
8a60bae3
...
@@ -842,10 +842,7 @@ class structure
...
@@ -842,10 +842,7 @@ class structure
///
///
/// \param asym_id The asym ID
/// \param asym_id The asym ID
/// \param seq_id The sequence ID
/// \param seq_id The sequence ID
void
remove_residue
(
const
std
::
string
&
asym_id
,
int
seq_id
,
const
std
::
string
&
auth_seq_id
)
void
remove_residue
(
const
std
::
string
&
asym_id
,
int
seq_id
,
const
std
::
string
&
auth_seq_id
);
{
remove_residue
(
get_residue
(
asym_id
,
seq_id
,
auth_seq_id
));
}
/// \brief Create a new non-polymer entity, returns new ID
/// \brief Create a new non-polymer entity, returns new ID
/// \param mon_id The mon_id for the new nonpoly, must be an existing and known compound from CCD
/// \param mon_id The mon_id for the new nonpoly, must be an existing and known compound from CCD
...
...
src/model.cpp
View file @
8a60bae3
...
@@ -1222,6 +1222,22 @@ sugar &branch::construct_sugar(const std::string &compound_id)
...
@@ -1222,6 +1222,22 @@ sugar &branch::construct_sugar(const std::string &compound_id)
{
{
auto
&
db
=
m_structure
->
get_datablock
();
auto
&
db
=
m_structure
->
get_datablock
();
auto
compound
=
compound_factory
::
instance
().
create
(
compound_id
);
if
(
compound
==
nullptr
)
throw
std
::
runtime_error
(
"Trying to insert unknown compound "
+
compound_id
+
" (not found in CCD)"
);
auto
&
chemComp
=
db
[
"chem_comp"
];
auto
r
=
chemComp
.
find
(
key
(
"id"
)
==
compound_id
);
if
(
r
.
empty
())
{
chemComp
.
emplace
({
{
"id"
,
compound_id
},
{
"name"
,
compound
->
name
()},
{
"formula"
,
compound
->
formula
()},
{
"formula_weight"
,
compound
->
formula_weight
()},
{
"type"
,
compound
->
type
()}});
}
sugar
&
result
=
emplace_back
(
*
this
,
compound_id
,
m_asym_id
,
size
()
+
1
);
sugar
&
result
=
emplace_back
(
*
this
,
compound_id
,
m_asym_id
,
size
()
+
1
);
db
[
"pdbx_branch_scheme"
].
emplace
({
db
[
"pdbx_branch_scheme"
].
emplace
({
...
@@ -2017,6 +2033,51 @@ void structure::change_residue(residue &res, const std::string &newCompound,
...
@@ -2017,6 +2033,51 @@ void structure::change_residue(residue &res, const std::string &newCompound,
}
}
}
}
void
structure
::
remove_residue
(
const
std
::
string
&
asym_id
,
int
seq_id
,
const
std
::
string
&
auth_seq_id
)
{
if
(
seq_id
==
0
)
{
for
(
auto
&
res
:
m_non_polymers
)
{
if
(
res
.
get_asym_id
()
==
asym_id
and
(
auth_seq_id
.
empty
()
or
res
.
get_auth_seq_id
()
==
auth_seq_id
))
{
remove_residue
(
res
);
return
;
}
}
}
for
(
auto
&
poly
:
m_polymers
)
{
if
(
poly
.
get_asym_id
()
!=
asym_id
)
continue
;
for
(
auto
&
res
:
poly
)
{
if
(
res
.
get_seq_id
()
==
seq_id
)
{
remove_residue
(
res
);
return
;
}
}
}
for
(
auto
&
branch
:
m_branches
)
{
if
(
branch
.
get_asym_id
()
!=
asym_id
)
continue
;
for
(
auto
&
sugar
:
branch
)
{
if
(
sugar
.
get_asym_id
()
==
asym_id
and
sugar
.
get_auth_seq_id
()
==
auth_seq_id
)
{
remove_residue
(
sugar
);
return
;
}
}
}
}
void
structure
::
remove_residue
(
residue
&
res
)
void
structure
::
remove_residue
(
residue
&
res
)
{
{
using
namespace
literals
;
using
namespace
literals
;
...
...
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