Rosetta 3.5
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
core
sequence
DP_Matrix.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 src/core/sequence/DP_Matrix.hh
11
/// @brief class for holding information on a dynamic programming matrix.
12
/// @author James Thompson
13
14
15
#include <
core/sequence/DP_Matrix.hh
>
16
17
// C++ headers
18
// AUTO-REMOVED #include <iostream>
19
#include <string>
20
21
#include <ObjexxFCL/format.hh>
22
23
24
///////////////////////////////////////////////////////////////////////////////
25
namespace
core {
26
namespace
sequence {
27
28
using
core::Real
;
29
using
core::Size
;
30
using
std::string
;
31
using
utility::vector1
;
32
using
ObjexxFCL::fmt::A
;
33
using
ObjexxFCL::fmt::F;
34
35
Cell::~Cell
() {}
36
37
DP_Matrix::~DP_Matrix
() {}
38
39
void
40
DP_Matrix::clear
() {
41
scoring_matrix_
.erase(
scoring_matrix_
.begin(),
scoring_matrix_
.end() );
42
}
43
44
CellOP
45
DP_Matrix::operator ()
(
Size
row,
Size
col )
const
{
46
// matrix is implicitly surrounded by 0's
47
if
( row < 1 || row >
rows
() || col < 1 || col >
cols
() ) {
48
return
new
Cell
( 0 );
49
}
50
51
return
scoring_matrix_
[ row ][ col ];
52
}
53
54
Size
DP_Matrix::rows
()
const
{
55
return
scoring_matrix_
.size();
56
}
57
58
Size
DP_Matrix::cols
()
const
{
59
return
scoring_matrix_
[1].size();
60
}
61
62
void
63
DP_Matrix::xlab
(
vector1< char >
const
& xs ) {
64
xlabels_
= xs;
65
}
66
67
void
68
DP_Matrix::ylab
(
vector1< char >
const
& ys ) {
69
ylabels_
= ys;
70
}
71
72
vector1< char >
73
DP_Matrix::xlab
()
const
{
74
return
xlabels_
;
75
}
76
77
vector1< char >
78
DP_Matrix::ylab
()
const
{
79
return
ylabels_
;
80
}
81
82
std::ostream &
operator<<
( std::ostream & out,
const
DP_Matrix
& m ) {
83
Size
width = 8;
84
Size
precision
= 3;
85
86
vector1< char >
xlabs( m.
xlab
() ), ylabs( m.
ylab
() );
87
88
for
(
Size
i = 1; i <= m.
rows
(); ++i ) {
89
if
( ylabs.size() > 1 && i == 1 ) {
90
out <<
A
( width,
' '
);
91
92
for
(
Size
k = 1; k <= m.
cols
(); ++k )
93
out <<
A
( width, ylabs[k] );
94
out << std::endl;
95
}
96
97
for
(
Size
j = 1; j <= m.
cols
(); ++j ) {
98
if
( xlabs.size() > 1 && j == 1 ) {
99
out <<
A
( width, xlabs[i] );
100
}
101
102
out << F( width, precision, m(i,j)->score() );
103
}
104
out << std::endl;
105
}
106
107
return
out;
108
}
109
110
}
// sequence
111
}
// core
Generated on Sat Jun 1 2013 11:40:22 for Rosetta 3.5 by
1.8.4