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
44f0aa14
Commit
44f0aa14
authored
7 years ago
by
Studer Gabriel
Browse files
Options
Downloads
Patches
Plain Diff
reduce code redundancy
parent
482d91ca
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scoring/src/ss_agreement_env_listener.cc
+70
-126
70 additions, 126 deletions
scoring/src/ss_agreement_env_listener.cc
scoring/src/ss_agreement_env_listener.hh
+5
-0
5 additions, 0 deletions
scoring/src/ss_agreement_env_listener.hh
with
75 additions
and
126 deletions
scoring/src/ss_agreement_env_listener.cc
+
70
−
126
View file @
44f0aa14
...
@@ -67,68 +67,7 @@ void SSAgreementEnvListener::SetEnvironment(const BackboneScoreEnv& base_env,
...
@@ -67,68 +67,7 @@ void SSAgreementEnvListener::SetEnvironment(const BackboneScoreEnv& base_env,
env_
.
Add
(
&
env_data_
[
*
i
],
ca_pos_data
[
*
i
]);
env_
.
Add
(
&
env_data_
[
*
i
],
ca_pos_data
[
*
i
]);
}
}
// additionally, we also set connectivity and ca / h positions
this
->
Update
(
idx
);
for
(
std
::
vector
<
uint
>::
const_iterator
i
=
idx
.
begin
();
i
!=
idx
.
end
();
++
i
){
// set connectivity of the residue itself
if
(
*
i
<
idx_handler_
->
GetNumResidues
()
-
1
&&
env_set_
[
*
i
+
1
]
&&
geom
::
Length2
(
env_data_
[
*
i
].
c_pos
-
env_data_
[
*
i
+
1
].
n_pos
)
<=
6.25
)
{
connected_to_next_
[
*
i
]
=
1
;
}
else
{
connected_to_next_
[
*
i
]
=
0
;
}
// set connectivity of the residue before
if
(
*
i
>
0
)
{
if
(
env_set_
[
*
i
-
1
]
&&
geom
::
Length2
(
env_data_
[
*
i
-
1
].
c_pos
-
env_data_
[
*
i
].
n_pos
)
<=
6.25
)
{
connected_to_next_
[
*
i
-
1
]
=
1
;
}
else
{
connected_to_next_
[
*
i
-
1
]
=
0
;
}
}
ca_positions_
[
*
i
]
=
env_data_
[
*
i
].
pos
;
// h_pos of this residue
if
(
!
env_data_
[
*
i
].
is_proline
)
{
if
(
*
i
>
0
&&
env_set_
[
*
i
-
1
]
&&
connected_to_next_
[
*
i
-
1
])
{
geom
::
Vec3
dir_vec
=
geom
::
Normalize
(
env_data_
[
*
i
-
1
].
c_pos
-
env_data_
[
*
i
-
1
].
o_pos
);
env_data_
[
*
i
].
h_pos
=
env_data_
[
*
i
].
n_pos
+
dir_vec
;
env_data_
[
*
i
].
valid_h_pos
=
true
;
}
else
{
env_data_
[
*
i
].
valid_h_pos
=
false
;
}
}
// the h_pos of the next residue might have changed
// no check for index validity of idx + 1... this informatin is contained
// in connected_to_next_
if
(
connected_to_next_
[
*
i
])
{
if
(
!
env_data_
[
*
i
+
1
].
is_proline
)
{
geom
::
Vec3
dir_vec
=
geom
::
Normalize
(
env_data_
[
*
i
].
c_pos
-
env_data_
[
*
i
].
o_pos
);
env_data_
[
*
i
+
1
].
h_pos
=
env_data_
[
*
i
+
1
].
n_pos
+
dir_vec
;
env_data_
[
*
i
+
1
].
valid_h_pos
=
true
;
}
else
{
env_data_
[
*
i
+
1
].
valid_h_pos
=
false
;
}
}
}
// and finally update all donor information in the close environment
std
::
set
<
int
>
stuff_to_update
;
for
(
std
::
vector
<
uint
>::
const_iterator
i
=
idx
.
begin
();
i
!=
idx
.
end
();
++
i
)
{
this
->
AddCloseResidues
(
*
i
,
stuff_to_update
);
}
for
(
std
::
set
<
int
>::
iterator
i
=
stuff_to_update
.
begin
();
i
!=
stuff_to_update
.
end
();
++
i
)
{
this
->
FindOptimalDonors
(
*
i
);
}
}
}
void
SSAgreementEnvListener
::
ResetEnvironment
(
const
BackboneScoreEnv
&
base_env
,
void
SSAgreementEnvListener
::
ResetEnvironment
(
const
BackboneScoreEnv
&
base_env
,
...
@@ -156,71 +95,9 @@ void SSAgreementEnvListener::ResetEnvironment(const BackboneScoreEnv& base_env,
...
@@ -156,71 +95,9 @@ void SSAgreementEnvListener::ResetEnvironment(const BackboneScoreEnv& base_env,
env_data_
[
*
i
].
c_pos
=
c_pos_data
[
*
i
];
env_data_
[
*
i
].
c_pos
=
c_pos_data
[
*
i
];
env_data_
[
*
i
].
o_pos
=
o_pos_data
[
*
i
];
env_data_
[
*
i
].
o_pos
=
o_pos_data
[
*
i
];
env_
.
Reset
(
&
env_data_
[
*
i
],
old_pos
,
ca_pos_data
[
*
i
]);
env_
.
Reset
(
&
env_data_
[
*
i
],
old_pos
,
ca_pos_data
[
*
i
]);
}
}
// additionally, we also set connectivity and ca / h positions
this
->
Update
(
idx
);
for
(
std
::
vector
<
uint
>::
const_iterator
i
=
idx
.
begin
();
i
!=
idx
.
end
();
++
i
){
// set connectivity of the residue itself
if
(
*
i
<
idx_handler_
->
GetNumResidues
()
-
1
&&
env_set_
[
*
i
+
1
]
&&
geom
::
Length2
(
env_data_
[
*
i
].
c_pos
-
env_data_
[
*
i
+
1
].
n_pos
)
<=
6.25
)
{
connected_to_next_
[
*
i
]
=
1
;
}
else
{
connected_to_next_
[
*
i
]
=
0
;
}
// set connectivity of the residue before
if
(
*
i
>
0
)
{
if
(
env_set_
[
*
i
-
1
]
&&
geom
::
Length2
(
env_data_
[
*
i
-
1
].
c_pos
-
env_data_
[
*
i
].
n_pos
)
<=
6.25
)
{
connected_to_next_
[
*
i
-
1
]
=
1
;
}
else
{
connected_to_next_
[
*
i
-
1
]
=
0
;
}
}
ca_positions_
[
*
i
]
=
env_data_
[
*
i
].
pos
;
// h_pos of this residue
if
(
!
env_data_
[
*
i
].
is_proline
)
{
if
(
*
i
>
0
&&
env_set_
[
*
i
-
1
]
&&
connected_to_next_
[
*
i
-
1
])
{
geom
::
Vec3
dir_vec
=
geom
::
Normalize
(
env_data_
[
*
i
-
1
].
c_pos
-
env_data_
[
*
i
-
1
].
o_pos
);
env_data_
[
*
i
].
h_pos
=
env_data_
[
*
i
].
n_pos
+
dir_vec
;
env_data_
[
*
i
].
valid_h_pos
=
true
;
}
else
{
env_data_
[
*
i
].
valid_h_pos
=
false
;
}
}
// the h_pos of the next residue might have changed
// no check for index validity of idx + 1... this informatin is contained
// in connected_to_next_
if
(
connected_to_next_
[
*
i
])
{
if
(
!
env_data_
[
*
i
+
1
].
is_proline
)
{
geom
::
Vec3
dir_vec
=
geom
::
Normalize
(
env_data_
[
*
i
].
c_pos
-
env_data_
[
*
i
].
o_pos
);
env_data_
[
*
i
+
1
].
h_pos
=
env_data_
[
*
i
+
1
].
n_pos
+
dir_vec
;
env_data_
[
*
i
+
1
].
valid_h_pos
=
true
;
}
else
{
env_data_
[
*
i
+
1
].
valid_h_pos
=
false
;
}
}
}
// and finally update all donor information in the close environment
std
::
set
<
int
>
stuff_to_update
;
for
(
std
::
vector
<
uint
>::
const_iterator
i
=
idx
.
begin
();
i
!=
idx
.
end
();
++
i
)
{
this
->
AddCloseResidues
(
*
i
,
stuff_to_update
);
}
for
(
std
::
set
<
int
>::
iterator
i
=
stuff_to_update
.
begin
();
i
!=
stuff_to_update
.
end
();
++
i
)
{
this
->
FindOptimalDonors
(
*
i
);
}
}
}
void
SSAgreementEnvListener
::
ClearEnvironment
(
const
BackboneScoreEnv
&
base_env
,
void
SSAgreementEnvListener
::
ClearEnvironment
(
const
BackboneScoreEnv
&
base_env
,
...
@@ -253,7 +130,7 @@ void SSAgreementEnvListener::ClearEnvironment(const BackboneScoreEnv& base_env,
...
@@ -253,7 +130,7 @@ void SSAgreementEnvListener::ClearEnvironment(const BackboneScoreEnv& base_env,
env_data_
[
*
i
+
1
].
valid_h_pos
=
false
;
env_data_
[
*
i
+
1
].
valid_h_pos
=
false
;
}
}
// we
already
call FindOptimalDonors for the deleted residues.
// we call FindOptimalDonors for the deleted residues.
// the only thing that will happen:
// the only thing that will happen:
// according donor_for_one_ / donor_for_two_ gets set to -1
// according donor_for_one_ / donor_for_two_ gets set to -1
FindOptimalDonors
(
*
i
);
FindOptimalDonors
(
*
i
);
...
@@ -477,4 +354,71 @@ void SSAgreementEnvListener::FindOptimalDonors(uint idx, bool check_env_set) {
...
@@ -477,4 +354,71 @@ void SSAgreementEnvListener::FindOptimalDonors(uint idx, bool check_env_set) {
}
}
}
}
void
SSAgreementEnvListener
::
Update
(
const
std
::
vector
<
uint
>&
idx
)
{
// assumes env_data_ to be set...
for
(
std
::
vector
<
uint
>::
const_iterator
i
=
idx
.
begin
();
i
!=
idx
.
end
();
++
i
){
ca_positions_
[
*
i
]
=
env_data_
[
*
i
].
pos
;
// set connectivity of the residue itself
if
(
*
i
<
idx_handler_
->
GetNumResidues
()
-
1
&&
env_set_
[
*
i
+
1
]
&&
geom
::
Length2
(
env_data_
[
*
i
].
c_pos
-
env_data_
[
*
i
+
1
].
n_pos
)
<=
6.25
)
{
connected_to_next_
[
*
i
]
=
1
;
}
else
{
connected_to_next_
[
*
i
]
=
0
;
}
// set connectivity of the residue before
if
(
*
i
>
0
)
{
if
(
env_set_
[
*
i
-
1
]
&&
geom
::
Length2
(
env_data_
[
*
i
-
1
].
c_pos
-
env_data_
[
*
i
].
n_pos
)
<=
6.25
)
{
connected_to_next_
[
*
i
-
1
]
=
1
;
}
else
{
connected_to_next_
[
*
i
-
1
]
=
0
;
}
}
// h_pos of this residue
if
(
!
env_data_
[
*
i
].
is_proline
)
{
if
(
*
i
>
0
&&
env_set_
[
*
i
-
1
]
&&
connected_to_next_
[
*
i
-
1
])
{
geom
::
Vec3
dir_vec
=
geom
::
Normalize
(
env_data_
[
*
i
-
1
].
c_pos
-
env_data_
[
*
i
-
1
].
o_pos
);
env_data_
[
*
i
].
h_pos
=
env_data_
[
*
i
].
n_pos
+
dir_vec
;
env_data_
[
*
i
].
valid_h_pos
=
true
;
}
else
{
env_data_
[
*
i
].
valid_h_pos
=
false
;
}
}
// the h_pos of the next residue might have changed
// no check for index validity of idx + 1... this informatin is contained
// in connected_to_next_
if
(
connected_to_next_
[
*
i
])
{
if
(
!
env_data_
[
*
i
+
1
].
is_proline
)
{
geom
::
Vec3
dir_vec
=
geom
::
Normalize
(
env_data_
[
*
i
].
c_pos
-
env_data_
[
*
i
].
o_pos
);
env_data_
[
*
i
+
1
].
h_pos
=
env_data_
[
*
i
+
1
].
n_pos
+
dir_vec
;
env_data_
[
*
i
+
1
].
valid_h_pos
=
true
;
}
else
{
env_data_
[
*
i
+
1
].
valid_h_pos
=
false
;
}
}
}
// and finally update all donor information in the close environment
std
::
set
<
int
>
stuff_to_update
;
for
(
std
::
vector
<
uint
>::
const_iterator
i
=
idx
.
begin
();
i
!=
idx
.
end
();
++
i
)
{
this
->
AddCloseResidues
(
*
i
,
stuff_to_update
);
}
for
(
std
::
set
<
int
>::
iterator
i
=
stuff_to_update
.
begin
();
i
!=
stuff_to_update
.
end
();
++
i
)
{
this
->
FindOptimalDonors
(
*
i
);
}
}
}}
// ns
}}
// ns
This diff is collapsed.
Click to expand it.
scoring/src/ss_agreement_env_listener.hh
+
5
−
0
View file @
44f0aa14
...
@@ -63,6 +63,11 @@ public:
...
@@ -63,6 +63,11 @@ public:
private
:
private
:
// helper function that sets hydrogen positions in env_data_, the ca_positions_,
// donor_for_one_, donor_for_two_, and connected_to_next_ for all residues
// affected by indices in idx
void
Update
(
const
std
::
vector
<
uint
>&
idx
);
void
AddCloseResidues
(
uint
idx
,
std
::
set
<
int
>&
close_residues
)
const
;
void
AddCloseResidues
(
uint
idx
,
std
::
set
<
int
>&
close_residues
)
const
;
void
FindOptimalDonors
(
uint
idx
,
bool
check_env_set
=
true
);
void
FindOptimalDonors
(
uint
idx
,
bool
check_env_set
=
true
);
...
...
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