Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProMod3
Manage
Activity
Members
Plan
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
ProMod3
Commits
d8f0f7ff
Commit
d8f0f7ff
authored
7 years ago
by
Gerardo Tauriello
Browse files
Options
Downloads
Patches
Plain Diff
SCHWED-1740
: extend IdxHandler::ToIdxVector for multi-loop case
parent
1055f271
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
loop/src/idx_handler.cc
+28
-0
28 additions, 0 deletions
loop/src/idx_handler.cc
loop/src/idx_handler.hh
+10
-0
10 additions, 0 deletions
loop/src/idx_handler.hh
loop/tests/test_idx_handler.cc
+26
-1
26 additions, 1 deletion
loop/tests/test_idx_handler.cc
with
64 additions
and
1 deletion
loop/src/idx_handler.cc
+
28
−
0
View file @
d8f0f7ff
...
@@ -46,6 +46,34 @@ std::vector<uint> IdxHandler::ToIdxVector(uint start_resnum, uint num_residues,
...
@@ -46,6 +46,34 @@ std::vector<uint> IdxHandler::ToIdxVector(uint start_resnum, uint num_residues,
return
idx
;
return
idx
;
}
}
std
::
vector
<
uint
>
IdxHandler
::
ToIdxVector
(
const
std
::
vector
<
uint
>&
start_resnums
,
const
std
::
vector
<
uint
>&
num_residues
,
const
std
::
vector
<
uint
>&
chain_indices
,
std
::
vector
<
uint
>&
loop_start_indices
,
std
::
vector
<
uint
>&
loop_lengths
,
bool
enable_log
)
const
{
// get loop indices (checks errors. resolves overlaps & reports merges/del.)
std
::
vector
<
uint
>
env_loop_start_indices
;
ToLoopIndices
(
start_resnums
,
num_residues
,
chain_indices
,
env_loop_start_indices
,
loop_lengths
,
enable_log
);
// process output to get idx-vector
std
::
vector
<
uint
>
indices
;
const
uint
num_loops
=
loop_lengths
.
size
();
loop_start_indices
.
resize
(
num_loops
);
for
(
uint
i_loop
=
0
;
i_loop
<
num_loops
;
++
i_loop
)
{
const
uint
loop_start_idx
=
indices
.
size
();
const
uint
loop_length
=
loop_lengths
[
i_loop
];
indices
.
resize
(
loop_start_idx
+
loop_length
);
loop_start_indices
[
i_loop
]
=
loop_start_idx
;
for
(
uint
i
=
0
;
i
<
loop_length
;
++
i
)
{
indices
[
loop_start_idx
+
i
]
=
env_loop_start_indices
[
i_loop
]
+
i
;
}
}
return
indices
;
}
void
IdxHandler
::
SetupScoreCalculation
(
const
loop
::
BackboneList
&
bb_list
,
void
IdxHandler
::
SetupScoreCalculation
(
const
loop
::
BackboneList
&
bb_list
,
uint
start_resnum
,
uint
chain_idx
,
uint
start_resnum
,
uint
chain_idx
,
uint
&
bb_list_size
,
uint
&
start_idx
,
uint
&
bb_list_size
,
uint
&
start_idx
,
...
...
This diff is collapsed.
Click to expand it.
loop/src/idx_handler.hh
+
10
−
0
View file @
d8f0f7ff
...
@@ -42,6 +42,16 @@ public:
...
@@ -42,6 +42,16 @@ public:
std
::
vector
<
uint
>
ToIdxVector
(
uint
start_resnum
,
uint
num_residues
,
std
::
vector
<
uint
>
ToIdxVector
(
uint
start_resnum
,
uint
num_residues
,
uint
chain_idx
)
const
;
uint
chain_idx
)
const
;
// returns vector of indices for multiple loops
// -> uses ToLoopIndices below but loop_start_indices refer to returned index
// vector (all loop index vectors combined one after the other)
std
::
vector
<
uint
>
ToIdxVector
(
const
std
::
vector
<
uint
>&
start_resnums
,
const
std
::
vector
<
uint
>&
num_residues
,
const
std
::
vector
<
uint
>&
chain_indices
,
std
::
vector
<
uint
>&
loop_start_indices
,
std
::
vector
<
uint
>&
loop_lengths
,
bool
enable_log
=
false
)
const
;
// check input and set commonly used variables
// check input and set commonly used variables
void
SetupScoreCalculation
(
const
loop
::
BackboneList
&
bb_list
,
void
SetupScoreCalculation
(
const
loop
::
BackboneList
&
bb_list
,
uint
start_resnum
,
uint
chain_idx
,
uint
start_resnum
,
uint
chain_idx
,
...
...
This diff is collapsed.
Click to expand it.
loop/tests/test_idx_handler.cc
+
26
−
1
View file @
d8f0f7ff
...
@@ -224,9 +224,34 @@ BOOST_AUTO_TEST_CASE(test_idx_handler_multi_loops) {
...
@@ -224,9 +224,34 @@ BOOST_AUTO_TEST_CASE(test_idx_handler_multi_loops) {
BOOST_CHECK_EQUAL
(
loop_lengths
.
size
(),
2u
);
BOOST_CHECK_EQUAL
(
loop_lengths
.
size
(),
2u
);
BOOST_CHECK
(
HasLoop
(
loop_start_indices
,
loop_lengths
,
10
,
8
));
BOOST_CHECK
(
HasLoop
(
loop_start_indices
,
loop_lengths
,
10
,
8
));
BOOST_CHECK
(
HasLoop
(
loop_start_indices
,
loop_lengths
,
5
,
2
));
BOOST_CHECK
(
HasLoop
(
loop_start_indices
,
loop_lengths
,
5
,
2
));
num_residues
[
0
]
=
2
;
// check ToIdxVector
std
::
vector
<
uint
>
res_indices
=
idx_handler
.
ToIdxVector
(
start_resnums
,
num_residues
,
chain_indices
,
loop_start_indices
,
loop_lengths
);
BOOST_CHECK_EQUAL
(
res_indices
.
size
(),
10u
);
BOOST_CHECK_EQUAL
(
loop_start_indices
.
size
(),
2u
);
BOOST_CHECK_EQUAL
(
loop_lengths
.
size
(),
2u
);
BOOST_CHECK_EQUAL
(
loop_start_indices
[
0
],
0u
);
BOOST_CHECK_EQUAL
(
loop_start_indices
[
1
],
loop_lengths
[
0
]);
// we cannot assume any order so we need to resolve both options
if
(
loop_lengths
[
0
]
==
8
)
{
BOOST_CHECK_EQUAL
(
loop_lengths
[
1
],
2u
);
for
(
uint
i
=
0
;
i
<
10
;
++
i
)
{
if
(
i
<
8
)
BOOST_CHECK_EQUAL
(
res_indices
[
i
],
10
+
i
);
else
BOOST_CHECK_EQUAL
(
res_indices
[
i
],
5
+
i
-
8
);
}
}
else
{
BOOST_CHECK_EQUAL
(
loop_lengths
[
0
],
2u
);
BOOST_CHECK_EQUAL
(
loop_lengths
[
1
],
8u
);
for
(
uint
i
=
0
;
i
<
10
;
++
i
)
{
if
(
i
<
2
)
BOOST_CHECK_EQUAL
(
res_indices
[
i
],
5
+
i
);
else
BOOST_CHECK_EQUAL
(
res_indices
[
i
],
10
+
i
-
2
);
}
}
// exceptions
// exceptions
num_residues
[
0
]
=
2
;
start_resnums
[
0
]
=
9
;
start_resnums
[
0
]
=
9
;
BOOST_CHECK_THROW
(
idx_handler
.
ToLoopIndices
(
start_resnums
,
num_residues
,
BOOST_CHECK_THROW
(
idx_handler
.
ToLoopIndices
(
start_resnums
,
num_residues
,
chain_indices
,
loop_start_indices
,
chain_indices
,
loop_start_indices
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment