Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dssp
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
dssp
Commits
08de217b
Unverified
Commit
08de217b
authored
Oct 24, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented operator[]
parent
3d93672f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
src/DSSP.cpp
+11
-0
test/dssp-unit-test.cpp
+38
-0
No files found.
src/DSSP.cpp
View file @
08de217b
...
@@ -2117,6 +2117,17 @@ DSSP::iterator DSSP::end() const
...
@@ -2117,6 +2117,17 @@ DSSP::iterator DSSP::end() const
return
iterator
(
res
);
return
iterator
(
res
);
}
}
DSSP
::
residue_info
DSSP
::
operator
[](
const
key_type
&
key
)
const
{
auto
i
=
std
::
find_if
(
begin
(),
end
(),
[
key
](
const
residue_info
&
res
)
{
return
res
.
asym_id
()
==
std
::
get
<
0
>
(
key
)
and
res
.
seq_id
()
==
std
::
get
<
1
>
(
key
);
});
if
(
i
==
end
())
throw
std
::
out_of_range
(
"Could not find residue with supplied key"
);
return
*
i
;
}
statistics
DSSP
::
get_statistics
()
const
statistics
DSSP
::
get_statistics
()
const
{
{
return
m_impl
->
mStats
;
return
m_impl
->
mStats
;
...
...
test/dssp-unit-test.cpp
View file @
08de217b
...
@@ -183,4 +183,41 @@ BOOST_AUTO_TEST_CASE(dssp_1)
...
@@ -183,4 +183,41 @@ BOOST_AUTO_TEST_CASE(dssp_1)
BOOST_CHECK_EQUAL
(
residue
.
seq_id
(),
seqID
);
BOOST_CHECK_EQUAL
(
residue
.
seq_id
(),
seqID
);
BOOST_CHECK_EQUAL
((
char
)
residue
.
type
(),
secstr
.
front
());
BOOST_CHECK_EQUAL
((
char
)
residue
.
type
(),
secstr
.
front
());
}
}
}
// --------------------------------------------------------------------
BOOST_AUTO_TEST_CASE
(
dssp_2
)
{
cif
::
file
f
(
gTestDir
/
"1cbs.cif.gz"
);
BOOST_ASSERT
(
f
.
is_valid
());
dssp
::
DSSP
dssp
(
f
.
front
(),
1
,
3
,
true
);
std
::
ifstream
t
(
gTestDir
/
"1cbs-dssp-test.tsv"
);
std
::
string
line
;
while
(
getline
(
t
,
line
))
{
auto
f
=
cif
::
split
(
line
,
"
\t
"
);
BOOST_CHECK_EQUAL
(
f
.
size
(),
3
);
if
(
f
.
size
()
!=
3
)
continue
;
int
seqID
;
std
::
from_chars
(
f
[
0
].
begin
(),
f
[
0
].
end
(),
seqID
);
std
::
string
asymID
{
f
[
1
]
};
std
::
string
secstr
{
f
[
2
]
};
if
(
secstr
==
"_"
)
secstr
=
" "
;
dssp
::
DSSP
::
key_type
key
{
asymID
,
seqID
};
auto
ri
=
dssp
[
key
];
BOOST_CHECK_EQUAL
(
ri
.
asym_id
(),
asymID
);
BOOST_CHECK_EQUAL
(
ri
.
seq_id
(),
seqID
);
BOOST_CHECK_EQUAL
((
char
)
ri
.
type
(),
secstr
.
front
());
}
}
}
\ No newline at end of file
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