Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CompassScoringScheme.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 CompassScoringScheme.cc
11 /// @brief method implementations for CompassScoringScheme class.
12 /// @author James Thompson
13 
14 #include <core/types.hh>
15 // AUTO-REMOVED #include <basic/Tracer.hh>
20 
21 #include <utility/exit.hh>
22 // AUTO-REMOVED #include <utility/vector1.hh>
23 // AUTO-REMOVED #include <utility/io/izstream.hh>
24 // AUTO-REMOVED #include <utility/file/FileName.hh>
25 
26 // AUTO-REMOVED #include <core/chemical/AA.hh>
27 
28 // AUTO-REMOVED #include <ObjexxFCL/format.hh>
29 // AUTO-REMOVED #include <iostream>
30 #include <string>
31 
32 #include <utility/vector1.hh>
33 
34 
35 namespace core {
36 namespace sequence {
37 
39  SequenceOP seq1,
40  SequenceOP seq2,
41  Size pos1,
42  Size pos2
43  ) {
44  SequenceProfileOP prof1 = SequenceProfileOP( static_cast < SequenceProfile * > ( seq1() ) );
45  SequenceProfileOP prof2 = SequenceProfileOP( static_cast < SequenceProfile * > ( seq2() ) );
46 
47  runtime_assert( pos1 <= prof1->length() );
48  runtime_assert( pos2 <= prof2->length() );
49  runtime_assert( prof1->prof_row(pos1).size() == prof2->prof_row(pos2).size() );
50 
51  // compare the two profiles using Compass metric, which is defined as:
52  // S = c1 * sum( n(1,i) * log( Q(2,i) / p(i) ) )
53  // + c2 * sum( n(2,i) * log( Q(1,i) / p(i) ) )
54  // the terms are defined as such:
55  // i - column of the profile to be evaluated, represents a residue
56  // p(i) - prior probability of residue i in all sequences
57  // n(1,i) - the effective number of sequences from profile 1 with residue i
58  // Q(2,i) - the estimated frequency of residue i in sequence 2
59  // n(2,i) - the effective number of sequences from profile 2 with residue i
60  // Q(1,i) - the estimated frequency of residue i in sequence 1
61  // c1 - normalization constant for profile 1
62  // c2 - normalization constant for profile 2
63 
64  // naive. better to calculate using Neff from PSIC weighting.
65  //Real const c1(0.5), c2(0.5);
66  //c1 = 0.5;
67  //c2 = 0.5;
68 
69  // calculate normalization constants c1 and c2
70  Size n_aa1( prof1->prof_row(pos1).size() );
71  Size n_aa2( prof2->prof_row(pos2).size() );
72  Real score( 0.0 );
73  runtime_assert( n_aa1 == n_aa2 );
74  //for ( Size i = 1; i <= n_aa; ++i ) {
75 
76  //}
77 
78  return score;
79  } // score
80 
81 
82 } // sequence
83 } // core