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
25dfdd2f
Commit
25dfdd2f
authored
Oct 14, 2020
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- alternates handling
- getResidue in structure
parent
88879a5d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
1 deletions
+63
-1
include/cif++/Structure.hpp
+12
-1
src/Structure.cpp
+51
-0
No files found.
include/cif++/Structure.hpp
View file @
25dfdd2f
...
@@ -244,6 +244,15 @@ class Residue
...
@@ -244,6 +244,15 @@ class Residue
bool
hasAlternateAtoms
()
const
;
bool
hasAlternateAtoms
()
const
;
/// \brief Return the list of unique alt ID's present in this residue
std
::
set
<
std
::
string
>
getAlternateIDs
()
const
;
/// \brief Return the list of unique atom ID's
std
::
set
<
std
::
string
>
getAtomIDs
()
const
;
/// \brief Return the list of atoms having ID \a atomID
AtomView
getAtomsByID
(
const
std
::
string
&
atomID
)
const
;
// some routines for 3d work
// some routines for 3d work
std
::
tuple
<
Point
,
float
>
centerAndRadius
()
const
;
std
::
tuple
<
Point
,
float
>
centerAndRadius
()
const
;
...
@@ -436,6 +445,8 @@ class Structure
...
@@ -436,6 +445,8 @@ class Structure
// const std::string& compID, int seqID, const std::string& altID = "",
// const std::string& compID, int seqID, const std::string& altID = "",
// const std::string& pdbxAuthInsCode = "");
// const std::string& pdbxAuthInsCode = "");
const
Residue
&
getResidue
(
const
std
::
string
&
asymID
,
const
std
::
string
&
compID
,
int
seqID
)
const
;
// map between auth and label locations
// map between auth and label locations
std
::
tuple
<
std
::
string
,
int
,
std
::
string
>
MapAuthToLabel
(
const
std
::
string
&
asymID
,
std
::
tuple
<
std
::
string
,
int
,
std
::
string
>
MapAuthToLabel
(
const
std
::
string
&
asymID
,
...
@@ -536,7 +547,7 @@ class Structure
...
@@ -536,7 +547,7 @@ class Structure
void
updateAtomIndex
();
void
updateAtomIndex
();
File
&
mFile
;
File
&
mFile
;
uint32_t
mModelNr
;
uint32_t
mModelNr
;
AtomView
mAtoms
;
AtomView
mAtoms
;
std
::
vector
<
size_t
>
mAtomIndex
;
std
::
vector
<
size_t
>
mAtomIndex
;
std
::
list
<
Polymer
>
mPolymers
;
std
::
list
<
Polymer
>
mPolymers
;
...
...
src/Structure.cpp
View file @
25dfdd2f
...
@@ -879,6 +879,20 @@ AtomView Residue::unique_atoms() const
...
@@ -879,6 +879,20 @@ AtomView Residue::unique_atoms() const
return
result
;
return
result
;
}
}
std
::
set
<
std
::
string
>
Residue
::
getAlternateIDs
()
const
{
std
::
set
<
std
::
string
>
result
;
for
(
auto
a
:
mAtoms
)
{
auto
alt
=
a
.
labelAltID
();
if
(
not
alt
.
empty
())
result
.
insert
(
alt
);
}
return
result
;
}
Atom
Residue
::
atomByID
(
const
std
::
string
&
atomID
)
const
Atom
Residue
::
atomByID
(
const
std
::
string
&
atomID
)
const
{
{
Atom
result
;
Atom
result
;
...
@@ -966,6 +980,26 @@ bool Residue::hasAlternateAtoms() const
...
@@ -966,6 +980,26 @@ bool Residue::hasAlternateAtoms() const
return
std
::
find_if
(
mAtoms
.
begin
(),
mAtoms
.
end
(),
[](
const
Atom
&
atom
)
{
return
atom
.
isAlternate
();
})
!=
mAtoms
.
end
();
return
std
::
find_if
(
mAtoms
.
begin
(),
mAtoms
.
end
(),
[](
const
Atom
&
atom
)
{
return
atom
.
isAlternate
();
})
!=
mAtoms
.
end
();
}
}
std
::
set
<
std
::
string
>
Residue
::
getAtomIDs
()
const
{
std
::
set
<
std
::
string
>
ids
;
for
(
auto
a
:
mAtoms
)
ids
.
insert
(
a
.
labelAtomID
());
return
ids
;
}
AtomView
Residue
::
getAtomsByID
(
const
std
::
string
&
atomID
)
const
{
AtomView
atoms
;
for
(
auto
a
:
mAtoms
)
{
if
(
a
.
labelAtomID
()
==
atomID
)
atoms
.
push_back
(
a
);
}
return
atoms
;
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
Residue
&
res
)
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
Residue
&
res
)
{
{
os
<<
res
.
compoundID
()
<<
' '
<<
res
.
asymID
()
<<
':'
<<
res
.
seqID
();
os
<<
res
.
compoundID
()
<<
' '
<<
res
.
asymID
()
<<
':'
<<
res
.
seqID
();
...
@@ -1747,6 +1781,23 @@ Atom Structure::getAtomByLabel(const std::string& atomID, const std::string& asy
...
@@ -1747,6 +1781,23 @@ Atom Structure::getAtomByLabel(const std::string& atomID, const std::string& asy
throw
std
::
out_of_range
(
"Could not find atom with specified label"
);
throw
std
::
out_of_range
(
"Could not find atom with specified label"
);
}
}
const
Residue
&
Structure
::
getResidue
(
const
std
::
string
&
asymID
,
const
std
::
string
&
compID
,
int
seqID
)
const
{
for
(
auto
&
poly
:
mPolymers
)
{
if
(
poly
.
asymID
()
!=
asymID
)
continue
;
for
(
auto
&
res
:
poly
)
{
if
(
res
.
seqID
()
==
seqID
and
res
.
compoundID
()
==
compID
)
return
res
;
}
}
throw
std
::
out_of_range
(
"Could not find residue "
+
asymID
+
'/'
+
std
::
to_string
(
seqID
));
}
File
&
Structure
::
getFile
()
const
File
&
Structure
::
getFile
()
const
{
{
return
mFile
;
return
mFile
;
...
...
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