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
5476eef0
Unverified
Commit
5476eef0
authored
Dec 21, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some extensions for sugar tree building
parent
33c1eea9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
14 deletions
+61
-14
include/cif++/compound.hpp
+7
-0
include/cif++/model.hpp
+32
-14
src/compound.cpp
+22
-0
src/model.cpp
+0
-0
No files found.
include/cif++/compound.hpp
View file @
5476eef0
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include <cif++.hpp>
#include <cif++.hpp>
#include <cif++/atom_type.hpp>
#include <cif++/atom_type.hpp>
#include <cif++/point.hpp>
namespace
cif
namespace
cif
{
{
...
@@ -75,6 +76,11 @@ struct compound_atom
...
@@ -75,6 +76,11 @@ struct compound_atom
bool
leaving_atom
=
false
;
bool
leaving_atom
=
false
;
bool
stereo_config
=
false
;
bool
stereo_config
=
false
;
float
x
,
y
,
z
;
float
x
,
y
,
z
;
point
get_location
()
const
{
return
{
x
,
y
,
z
};
}
};
};
/// --------------------------------------------------------------------
/// --------------------------------------------------------------------
...
@@ -114,6 +120,7 @@ class compound
...
@@ -114,6 +120,7 @@ class compound
compound_atom
get_atom_by_atom_id
(
const
std
::
string
&
atom_id
)
const
;
compound_atom
get_atom_by_atom_id
(
const
std
::
string
&
atom_id
)
const
;
bool
atoms_bonded
(
const
std
::
string
&
atomId_1
,
const
std
::
string
&
atomId_2
)
const
;
bool
atoms_bonded
(
const
std
::
string
&
atomId_1
,
const
std
::
string
&
atomId_2
)
const
;
float
bond_length
(
const
std
::
string
&
atomId_1
,
const
std
::
string
&
atomId_2
)
const
;
bool
is_water
()
const
bool
is_water
()
const
{
{
...
...
include/cif++/model.hpp
View file @
5476eef0
...
@@ -394,7 +394,7 @@ class residue
...
@@ -394,7 +394,7 @@ class residue
friend
class
structure
;
friend
class
structure
;
// constructor
// constructor
residue
(
const
structure
&
structure
,
const
std
::
string
&
compoundID
,
residue
(
structure
&
structure
,
const
std
::
string
&
compoundID
,
const
std
::
string
&
asymID
,
int
seqID
,
const
std
::
string
&
asymID
,
int
seqID
,
const
std
::
string
&
authAsymID
,
const
std
::
string
&
authSeqID
,
const
std
::
string
&
authAsymID
,
const
std
::
string
&
authSeqID
,
const
std
::
string
&
pdbInsCode
)
const
std
::
string
&
pdbInsCode
)
...
@@ -408,7 +408,7 @@ class residue
...
@@ -408,7 +408,7 @@ class residue
{
{
}
}
residue
(
const
structure
&
structure
,
const
std
::
vector
<
atom
>
&
atoms
);
residue
(
structure
&
structure
,
const
std
::
vector
<
atom
>
&
atoms
);
residue
(
const
residue
&
rhs
)
=
delete
;
residue
(
const
residue
&
rhs
)
=
delete
;
residue
&
operator
=
(
const
residue
&
rhs
)
=
delete
;
residue
&
operator
=
(
const
residue
&
rhs
)
=
delete
;
...
@@ -432,7 +432,7 @@ class residue
...
@@ -432,7 +432,7 @@ class residue
const
std
::
string
&
get_compound_id
()
const
{
return
m_compound_id
;
}
const
std
::
string
&
get_compound_id
()
const
{
return
m_compound_id
;
}
void
set_compound_id
(
const
std
::
string
&
id
)
{
m_compound_id
=
id
;
}
void
set_compound_id
(
const
std
::
string
&
id
)
{
m_compound_id
=
id
;
}
const
structure
*
get_structure
()
const
{
return
m_structure
;
}
structure
*
get_structure
()
const
{
return
m_structure
;
}
// const compound &compound() const;
// const compound &compound() const;
...
@@ -489,7 +489,7 @@ class residue
...
@@ -489,7 +489,7 @@ class residue
protected
:
protected
:
residue
()
{}
residue
()
{}
const
structure
*
m_structure
=
nullptr
;
structure
*
m_structure
=
nullptr
;
std
::
string
m_compound_id
,
m_asym_id
;
std
::
string
m_compound_id
,
m_asym_id
;
int
m_seq_id
=
0
;
int
m_seq_id
=
0
;
std
::
string
m_auth_asym_id
,
m_auth_seq_id
,
m_pdb_ins_code
;
std
::
string
m_auth_asym_id
,
m_auth_seq_id
,
m_pdb_ins_code
;
...
@@ -573,7 +573,7 @@ class monomer : public residue
...
@@ -573,7 +573,7 @@ class monomer : public residue
class
polymer
:
public
std
::
vector
<
monomer
>
class
polymer
:
public
std
::
vector
<
monomer
>
{
{
public
:
public
:
polymer
(
const
structure
&
s
,
const
std
::
string
&
entityID
,
const
std
::
string
&
asymID
,
const
std
::
string
&
auth_asym_id
);
polymer
(
structure
&
s
,
const
std
::
string
&
entityID
,
const
std
::
string
&
asymID
,
const
std
::
string
&
auth_asym_id
);
polymer
(
const
polymer
&
)
=
delete
;
polymer
(
const
polymer
&
)
=
delete
;
polymer
&
operator
=
(
const
polymer
&
)
=
delete
;
polymer
&
operator
=
(
const
polymer
&
)
=
delete
;
...
@@ -581,7 +581,7 @@ class polymer : public std::vector<monomer>
...
@@ -581,7 +581,7 @@ class polymer : public std::vector<monomer>
// monomer &getBySeqID(int seqID);
// monomer &getBySeqID(int seqID);
// const monomer &getBySeqID(int seqID) const;
// const monomer &getBySeqID(int seqID) const;
const
structure
*
get_structure
()
const
{
return
m_structure
;
}
structure
*
get_structure
()
const
{
return
m_structure
;
}
std
::
string
get_asym_id
()
const
{
return
m_asym_id
;
}
std
::
string
get_asym_id
()
const
{
return
m_asym_id
;
}
std
::
string
get_auth_asym_id
()
const
{
return
m_auth_asym_id
;
}
// The PDB chain ID, actually
std
::
string
get_auth_asym_id
()
const
{
return
m_auth_asym_id
;
}
// The PDB chain ID, actually
...
@@ -590,7 +590,7 @@ class polymer : public std::vector<monomer>
...
@@ -590,7 +590,7 @@ class polymer : public std::vector<monomer>
// int Distance(const monomer &a, const monomer &b) const;
// int Distance(const monomer &a, const monomer &b) const;
private
:
private
:
const
structure
*
m_structure
;
structure
*
m_structure
;
std
::
string
m_entity_id
;
std
::
string
m_entity_id
;
std
::
string
m_asym_id
;
std
::
string
m_asym_id
;
std
::
string
m_auth_asym_id
;
std
::
string
m_auth_asym_id
;
...
@@ -604,7 +604,7 @@ class branch;
...
@@ -604,7 +604,7 @@ class branch;
class
sugar
:
public
residue
class
sugar
:
public
residue
{
{
public
:
public
:
sugar
(
const
branch
&
branch
,
const
std
::
string
&
compoundID
,
sugar
(
branch
&
branch
,
const
std
::
string
&
compoundID
,
const
std
::
string
&
asymID
,
int
authSeqID
);
const
std
::
string
&
asymID
,
int
authSeqID
);
sugar
(
sugar
&&
rhs
);
sugar
(
sugar
&&
rhs
);
...
@@ -631,27 +631,42 @@ class sugar : public residue
...
@@ -631,27 +631,42 @@ class sugar : public residue
return
result
;
return
result
;
}
}
cif
::
mm
::
atom
add_atom
(
row_initializer
atom_info
);
private
:
private
:
const
branch
*
m_branch
;
branch
*
m_branch
;
atom
m_link
;
atom
m_link
;
};
};
class
branch
:
public
std
::
vector
<
sugar
>
class
branch
:
public
std
::
vector
<
sugar
>
{
{
public
:
public
:
branch
(
structure
&
structure
,
const
std
::
string
&
asymID
);
branch
(
structure
&
structure
,
const
std
::
string
&
asym_id
,
const
std
::
string
&
entity_id
);
branch
(
const
branch
&
)
=
delete
;
branch
&
operator
=
(
const
branch
&
)
=
delete
;
branch
(
branch
&&
)
=
default
;
branch
&
operator
=
(
branch
&&
)
=
default
;
void
link_atoms
();
void
link_atoms
();
std
::
string
name
()
const
;
std
::
string
name
()
const
;
float
weight
()
const
;
float
weight
()
const
;
std
::
string
get_asym_id
()
const
{
return
m_asym_id
;
}
std
::
string
get_asym_id
()
const
{
return
m_asym_id
;
}
std
::
string
get_entity_id
()
const
{
return
m_entity_id
;
}
structure
&
get_structure
()
{
return
*
m_structure
;
}
structure
&
get_structure
()
{
return
*
m_structure
;
}
const
structure
&
get_structure
()
const
{
return
*
m_structure
;
}
structure
&
get_structure
()
const
{
return
*
m_structure
;
}
sugar
&
getSugarByNum
(
int
nr
);
sugar
&
get_sugar_by_num
(
int
nr
);
const
sugar
&
getSugarByNum
(
int
nr
)
const
;
const
sugar
&
get_sugar_by_num
(
int
nr
)
const
{
return
const_cast
<
branch
*>
(
this
)
->
get_sugar_by_num
(
nr
);
}
sugar
&
construct_sugar
(
const
std
::
string
&
compound_id
);
private
:
private
:
friend
sugar
;
friend
sugar
;
...
@@ -659,7 +674,7 @@ class branch : public std::vector<sugar>
...
@@ -659,7 +674,7 @@ class branch : public std::vector<sugar>
std
::
string
name
(
const
sugar
&
s
)
const
;
std
::
string
name
(
const
sugar
&
s
)
const
;
structure
*
m_structure
;
structure
*
m_structure
;
std
::
string
m_asym_id
;
std
::
string
m_asym_id
,
m_entity_id
;
};
};
// // --------------------------------------------------------------------
// // --------------------------------------------------------------------
...
@@ -851,6 +866,9 @@ class structure
...
@@ -851,6 +866,9 @@ class structure
/// \return The newly create asym ID
/// \return The newly create asym ID
std
::
string
create_non_poly
(
const
std
::
string
&
entity_id
,
std
::
vector
<
row_initializer
>
atoms
);
std
::
string
create_non_poly
(
const
std
::
string
&
entity_id
,
std
::
vector
<
row_initializer
>
atoms
);
/// \brief Create a new and empty (sugar) branch
branch
&
create_branch
();
/// \brief Create a new (sugar) branch with one first NAG containing atoms constructed from \a atoms
/// \brief Create a new (sugar) branch with one first NAG containing atoms constructed from \a atoms
branch
&
create_branch
(
std
::
vector
<
row_initializer
>
atoms
);
branch
&
create_branch
(
std
::
vector
<
row_initializer
>
atoms
);
...
...
src/compound.cpp
View file @
5476eef0
...
@@ -223,6 +223,28 @@ bool compound::atoms_bonded(const std::string &atomId_1, const std::string &atom
...
@@ -223,6 +223,28 @@ bool compound::atoms_bonded(const std::string &atomId_1, const std::string &atom
return
i
!=
m_bonds
.
end
();
return
i
!=
m_bonds
.
end
();
}
}
float
compound
::
bond_length
(
const
std
::
string
&
atomId_1
,
const
std
::
string
&
atomId_2
)
const
{
auto
i
=
find_if
(
m_bonds
.
begin
(),
m_bonds
.
end
(),
[
&
](
const
compound_bond
&
b
)
{
return
(
b
.
atom_id
[
0
]
==
atomId_1
and
b
.
atom_id
[
1
]
==
atomId_2
)
or
(
b
.
atom_id
[
0
]
==
atomId_2
and
b
.
atom_id
[
1
]
==
atomId_1
);
});
float
result
=
std
::
numeric_limits
<
float
>::
max
();
if
(
i
!=
m_bonds
.
end
())
{
auto
a
=
get_atom_by_atom_id
(
atomId_1
);
auto
b
=
get_atom_by_atom_id
(
atomId_2
);
result
=
distance
(
point
{
a
.
x
,
a
.
y
,
a
.
z
},
point
{
b
.
x
,
b
.
y
,
b
.
z
});
}
return
result
;
}
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// known amino acids and bases
// known amino acids and bases
...
...
src/model.cpp
View file @
5476eef0
This diff is collapsed.
Click to expand it.
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