Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ChemicalShiftSequence.hh
Go to the documentation of this file.
1 // vi: set ts=2 noet:
2 //
3 // (c) Copyright Rosetta Commons Member Institutions.
4 // (c) This file is part of the Rosetta software suite and is made available under license.
5 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
6 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
7 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
8 
9 /// @file ChemicalShiftSequence.hh
10 /// @brief class definition for a sequence profile that represents each
11 /// position in a sequence as a probability distribution over the allowed amino
12 /// acids at that position.
13 /// @author James Thompson
14 
15 #ifndef INCLUDED_core_sequence_ChemicalShiftSequence_hh
16 #define INCLUDED_core_sequence_ChemicalShiftSequence_hh
17 
19 
20 #include <core/types.hh>
23 
24 #include <utility/file/FileName.fwd.hh>
25 
26 #include <utility/vector1.hh>
27 
28 namespace core {
29 namespace sequence {
30 
34 
35 public:
36  /// @brief ctors
38 
40  FileName const & fn
41  ) {
42  read_from_file( fn );
43  }
44 
47  std::string const & seq,
48  std::string const & ident,
49  Size start_idx = 1
50  ) {
51  profile ( cs_prof );
52  sequence( seq );
53  id ( ident );
54  start ( start_idx );
55 
56  assert( profile().size() == length() );
57  }
58 
59  /// @brief copy ctor
62  {
63  *this = src;
64  }
65 
66  /// @brief assignment operator.
68  if ( this == &rhs ) return *this;
69 
70  id ( rhs.id() );
71  start ( rhs.start() );
72  gap_char( rhs.gap_char() );
73  sequence( rhs.sequence() );
74 
75  profile ( rhs.profile() );
76  alphabet( rhs.alphabet() );
77 
78  return *this;
79  }
80 
81  /// @brief dtor
83 
84  /// @brief Returns an owning pointer to a new ChemicalShiftSequence object,
85  /// with data that is a deep copy of the information in this object.
86  virtual SequenceOP clone() const {
87  SequenceOP new_seq_op( new ChemicalShiftSequence( *this ) );
88  return new_seq_op;
89  }
90 
91  /// @brief Read an profile matrix from the given filename using the
92  /// 2nd_inCS.tab format.
93  void read_from_file( FileName const & fn );
94 
95  /// @brief Return the alphabet used by this sequence profile. This is an
96  /// N-dimensional vector1 where N is the width of the profile, and the ith
97  /// entry of any row in the profile represents the probability of ith
98  /// character at that row in the sequence.
100  return alphabet_;
101  }
102 
104  alphabet_ = new_alphabet;
105  }
106 
107  /// @brief Print this ChemicalShiftSequence object to the given std::ostream.
108  friend std::ostream & operator<<(
109  std::ostream & out, const ChemicalShiftSequence & p
110  );
111 
112  Real sigma(
113  Size /*pos*/, Size idx
114  );
115 
116 private:
117  void check_internals_() const;
119 }; // class ChemicalShiftSequence
120 
121 } // sequence
122 } // core
123 
124 #endif