Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SequenceIdentity.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite && is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file protocols/frag_picker/scores/SequenceIdentity.cc
11 /// @brief a base class for fragment scoring
12 /// @author Dominik Gront (dgront@chem.uw.edu.pl)
13 
15 
16 // type headers
17 #include <core/types.hh>
18 
19 // package headers
23 
24 #include <utility/vector1.hh>
25 
26 
27 namespace protocols {
28 namespace frag_picker {
29 namespace scores {
30 
32  FragmentScoreMapOP empty_map) {
33 
34  // describe_score(f, empty_map, std::cerr);
35 
36  Real totalScore = 0;
37  for (Size i = 1; i <= f->get_length(); i++) {
38  VallResidueOP r = f->get_residue(i);
39  if (r->aa() == query_[i + f->get_first_index_in_query() - 2])
40  totalScore += REWARD;
41  else
42  totalScore += PENALTY;
43  }
44  totalScore /= (Real) f->get_length();
45  empty_map->set_score_component(totalScore, id_);
46  if ((totalScore > lowest_acceptable_value_) && (use_lowest_ == true))
47  return false;
48  return true;
49 }
50 
52  FragmentScoreMapOP empty_map, std::ostream& out) {
53 
54  Real totalScore = 0;
55 
56  out << f->get_chunk()->get_pdb_id() << " " << I(5,
57  f->get_first_index_in_vall()) << " ";
58  for (Size i = 1; i <= f->get_length(); i++)
59  out << f->get_residue(i)->aa();
60  out << std::endl << " ";
61  for (Size i = 1; i <= f->get_length(); i++) {
62  VallResidueOP r = f->get_residue(i);
63  if (r->aa() == query_[i + f->get_first_index_in_query() - 2]) {
64  totalScore += REWARD;
65  out << "+";
66  } else {
67  totalScore += PENALTY;
68  out << "-";
69  }
70  }
71  out << "\nquery " << I(5, f->get_first_index_in_query()) << " ";
72  for (Size i = 1; i <= f->get_length(); i++)
73  out << query_[i + f->get_first_index_in_query() - 2];
74  if ((totalScore > lowest_acceptable_value_) && (use_lowest_ == true))
75  out << "\nTotal score " << F(5, 3, totalScore) << " ACCEPTED"
76  << std::endl;
77  else
78  out << "\nTotal score " << F(5, 3, totalScore) << " REJECTED"
79  << std::endl;
80 
81  totalScore /= (Real) f->get_length();
82  empty_map->set_score_component(totalScore, id_);
83  if ((totalScore > lowest_acceptable_value_) && (use_lowest_ == true))
84  return false;
85  return true;
86 }
87 
88 } // scores
89 } // frag_picker
90 } // protocols
91 
92