Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
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
openstructure
Commits
6674be51
Commit
6674be51
authored
12 years ago
by
Valerio Mariani
Browse files
Options
Downloads
Patches
Plain Diff
Fixed problem with merged distance lists
parent
bcbf9fde
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
modules/mol/alg/src/local_dist_diff_test.cc
+24
-3
24 additions, 3 deletions
modules/mol/alg/src/local_dist_diff_test.cc
modules/mol/alg/src/local_dist_diff_test.hh
+3
-0
3 additions, 0 deletions
modules/mol/alg/src/local_dist_diff_test.hh
with
27 additions
and
3 deletions
modules/mol/alg/src/local_dist_diff_test.cc
+
24
−
3
View file @
6674be51
...
@@ -7,6 +7,13 @@ namespace ost { namespace mol { namespace alg {
...
@@ -7,6 +7,13 @@ namespace ost { namespace mol { namespace alg {
namespace
{
namespace
{
bool
is_distance_invalid
(
const
std
::
pair
<
Real
,
Real
>&
value
)
{
if
(
value
.
first
==
-
1.0
&&
value
.
second
==
-
1
)
return
true
;
return
false
;
}
// helper function
// helper function
String
swapped_name
(
const
String
&
name
)
String
swapped_name
(
const
String
&
name
)
{
{
...
@@ -299,10 +306,10 @@ void merge_distance_lists(GlobalRDMap& ref_dist_map, const GlobalRDMap& new_dist
...
@@ -299,10 +306,10 @@ void merge_distance_lists(GlobalRDMap& ref_dist_map, const GlobalRDMap& new_dist
// if you don't find it in the residue new, check that it is not missing because it is too long
// if you don't find it in the residue new, check that it is not missing because it is too long
UniqueAtomIdentifier
first_atom_to_find
=
ref_rd
.
first
;
UniqueAtomIdentifier
first_atom_to_find
=
ref_rd
.
first
;
UniqueAtomIdentifier
second_atom_to_find
=
ref_rd
.
second
;
UniqueAtomIdentifier
second_atom_to_find
=
ref_rd
.
second
;
// if both atoms are there, remove the distance from the ref_dist_map
,
// if both atoms are there, remove the distance from the ref_dist_map
(set it to invalid)
if
((
ref
.
FindAtom
(
first_atom_to_find
.
GetChainName
(),
first_atom_to_find
.
GetResNum
(),
first_atom_to_find
.
GetAtomName
()).
IsValid
()
&&
if
((
ref
.
FindAtom
(
first_atom_to_find
.
GetChainName
(),
first_atom_to_find
.
GetResNum
(),
first_atom_to_find
.
GetAtomName
()).
IsValid
()
&&
ref
.
FindAtom
(
second_atom_to_find
.
GetChainName
(),
second_atom_to_find
.
GetResNum
(),
second_atom_to_find
.
GetAtomName
()).
IsValid
())
)
{
ref
.
FindAtom
(
second_atom_to_find
.
GetChainName
(),
second_atom_to_find
.
GetResNum
(),
second_atom_to_find
.
GetAtomName
()).
IsValid
())
)
{
ref_
dist
_map_it
->
second
.
erase
(
ref_res_map_it
);
ref_
res
_map_it
->
second
=
std
::
make_pair
<
Real
,
Real
>
(
-
1.0
,
-
1.0
);
}
}
}
}
}
}
...
@@ -336,11 +343,25 @@ void merge_distance_lists(GlobalRDMap& ref_dist_map, const GlobalRDMap& new_dist
...
@@ -336,11 +343,25 @@ void merge_distance_lists(GlobalRDMap& ref_dist_map, const GlobalRDMap& new_dist
if
(
find_ref_res_ci
==
ref_dist_map
.
end
())
{
if
(
find_ref_res_ci
==
ref_dist_map
.
end
())
{
ref_dist_map
[
new_resnum
]
=
new_dist_map_it
->
second
;
ref_dist_map
[
new_resnum
]
=
new_dist_map_it
->
second
;
}
}
}
}
// finally, clean up the merged list by removing invalid distances
for
(
GlobalRDMap
::
const_iterator
ref_dist_map_it
=
ref_dist_map
.
begin
();
ref_dist_map_it
!=
ref_dist_map
.
end
();
++
ref_dist_map_it
)
{
ResidueRDMap
new_residue_map
;
for
(
ResidueRDMap
::
const_iterator
res_ref_list_it
=
ref_dist_map_it
->
second
.
begin
();
res_ref_list_it
!=
ref_dist_map_it
->
second
.
end
();
++
res_ref_list_it
)
{
if
(
is_distance_invalid
(
res_ref_list_it
->
second
))
continue
;
new_residue_map
[
res_ref_list_it
->
first
]
=
res_ref_list_it
->
second
;
}
ref_dist_map
[
ref_dist_map_it
->
first
]
=
new_residue_map
;
}
}
}
}
}
void
UniqueAtomIdentifier
::
Print
()
const
{
std
::
cout
<<
chain_
<<
" "
<<
residue_
<<
" "
<<
residue_name_
<<
" "
<<
atom_
<<
std
::
endl
;
}
// helper function
// helper function
bool
IsStandardResidue
(
String
rn
)
bool
IsStandardResidue
(
String
rn
)
{
{
...
...
This diff is collapsed.
Click to expand it.
modules/mol/alg/src/local_dist_diff_test.hh
+
3
−
0
View file @
6674be51
...
@@ -49,6 +49,9 @@ public:
...
@@ -49,6 +49,9 @@ public:
/// \brief Returns the name of the atom, as a String
/// \brief Returns the name of the atom, as a String
String
GetAtomName
()
const
{
return
atom_
;
}
String
GetAtomName
()
const
{
return
atom_
;
}
/// \brief Prints the UniqueAtomIdentifier information to standard output
void
Print
()
const
;
// required because UniqueAtomIdentifier is used as a key for a std::map
// required because UniqueAtomIdentifier is used as a key for a std::map
bool
operator
==
(
const
UniqueAtomIdentifier
&
rhs
)
const
{
bool
operator
==
(
const
UniqueAtomIdentifier
&
rhs
)
const
{
...
...
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