Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CompositeScoringScheme.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 CompositeScoringScheme.cc
11 /// @brief class definition for a given scoring scheme for an alignment.
12 /// @detailed Scoring scheme based on comparing single characters from two sequences
13 /// with three types of score:
14 /// - score for a match (characters are equal)
15 /// - score for a mismatch (characters are not equal)
16 /// - affine gap penalties of the form penalty = A + Bk
17 /// @author James Thompson
18 
19 #include <core/types.hh>
23 
24 #include <utility/exit.hh>
25 
26 // AUTO-REMOVED #include <iostream>
27 #include <string>
28 
29 #include <utility/vector1.hh>
30 
31 
32 namespace core {
33 namespace sequence {
34 
35 
37  utility_exit_with_message( "CompositeScoringScheme::read_from_file method stubbed out!");
38 }
39 
41  scoring_schemes_.push_back( scheme->clone() );
42 }
43 
45  SequenceOP seq1,
46  SequenceOP seq2,
47  core::Size pos1,
48  core::Size pos2
49 ) {
50  runtime_assert( pos1 <= seq1->length() );
51  runtime_assert( pos2 <= seq2->length() );
52 
53  Real total_score( 0.0 );
54  CompositeSequenceOP cs1( dynamic_cast< CompositeSequence * >( seq1() ) );
55  CompositeSequenceOP cs2( dynamic_cast< CompositeSequence * >( seq2() ) );
56  runtime_assert( cs1 );
57  runtime_assert( cs2 );
58  runtime_assert( cs1->n_seqs() == cs2->n_seqs() );
59  runtime_assert( count() == cs2->n_seqs() );
60 
61  for ( Size idx = 1; idx <= count(); ++idx ) {
62  total_score += scoring_schemes_[idx]->score(
63  cs1->seq(idx), cs2->seq(idx), pos1, pos2
64  );
65  }
66  return total_score;
67 }
68 
69 } // sequence
70 } // core