Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DPScoringScheme.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 and 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 DPScoringScheme.cc
11 /// @brief method implementations for DPScoringScheme class.
12 /// @author James Thompson
13 
14 #include <core/types.hh>
19 
20 #include <utility/exit.hh>
21 // AUTO-REMOVED #include <iostream>
22 #include <string>
23 
24 // AUTO-REMOVED #include <complex>
25 
26 #include <utility/vector1.hh>
27 
28 
29 
30 namespace core {
31 namespace sequence {
32 
34  SequenceOP seq1,
35  SequenceOP seq2,
36  Size pos1,
37  Size pos2
38 ) {
40  static_cast < SequenceProfile * > ( seq1() )
41  );
43  static_cast < SequenceProfile * > ( seq2() )
44  );
45 
46  runtime_assert( pos1 <= prof1->length() );
47  runtime_assert( pos2 <= prof2->length() );
48  runtime_assert( prof1->prof_row(pos1).size() == prof2->prof_row(pos2).size() );
49 
50  // compare the two profiles using a dot-product between the two profile
51  // vectors.
52  Size n_aa( prof1->prof_row(pos1).size() );
53  Real score( 0.0 );
54  for ( Size i = 1; i <= n_aa; ++i ) {
55  Real const & p1_num( prof1->prof_row(pos1)[i] );
56  Real const & p2_num( prof2->prof_row(pos2)[i] );
57  if ( is_good( p1_num ) && is_good( p2_num ) && i == 2 ) {
58  //if ( is_good( p1_num ) && is_good( p2_num ) ) {
59  //for ( Size jj = 1; jj < i; ++jj ) std::cout << " ";
60  //std::cout << "comparing " << p1_num << " and " << p2_num << std::endl;
61  //score += std::min( std::abs( p1_num * p2_num ), 1.0 );
62  score += p1_num * p2_num;
63  }
64  }
65 
66  //score = score - 6;
67  //std::cout << "score(" << pos1 << "," << pos2 << ") = " << score << std::endl << std::endl;
68 
69  return score;
70 } // score
71 
72 } // sequence
73 } // core