Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CompositeSequence.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 CompositeSequence.cc
11 /// @author James Thompson
12 
13 #include <core/types.hh>
14 #include <basic/Tracer.hh>
17 
18 #include <utility/pointer/owning_ptr.hh>
19 
20 // AUTO-REMOVED #include <core/chemical/AA.hh>
21 
22 // AUTO-REMOVED #include <iostream>
23 #include <string>
24 
25 #include <utility/exit.hh>
26 #include <utility/vector1.hh>
27 #include <ObjexxFCL/string.functions.hh>
28 
29 
30 namespace core {
31 namespace sequence {
32 
33 static basic::Tracer tr( "core.sequence.CompositeSequence" );
34 
35 std::ostream & operator<<(
36  std::ostream & out, const CompositeSequence & p
37 ) {
38  out << p.to_string();
39  return out;
40 }
41 
43  return seqs_.size();
44 }
45 
47  return seqs_;
48 }
49 
51  if ( seqs_.size() > 0 ) runtime_assert( length() == seq->length() );
52  id (seq->id() );
53  gap_char(seq->gap_char());
54  sequence(seq->sequence());
55  seqs_.push_back(seq);
56 }
57 
59  if ( seqs_.size() == 0 ) return 0;
60  return seqs_[1]->length();
61 }
62 
64  for ( Size ii = 1; ii <= n_seqs(); ++ii ) {
65  seqs_[ii]->delete_position(pos);
66  }
68 }
69 
70 void CompositeSequence::insert_char( core::Size pos, char new_char ) {
71  Sequence::insert_char( pos, new_char );
72  for ( Size ii = 1; ii <= n_seqs(); ++ii ) {
73  seqs_[ii]->insert_char(pos,new_char);
74  }
75 }
76 
78  //runtime_assert( idx <= seqs_.size() );
79  return seqs_[idx];
80 }
81 
82 /// @brief dtor
84 
85 /// @brief Returns an owning pointer to a new CompositeSequence object,
86 /// with data that is a deep copy of the information in this object.
88  SequenceOP new_seq_op( new CompositeSequence( *this ) );
89  return new_seq_op;
90 }
91 
93  using ObjexxFCL::string_of;
94  std::string retval("");
95  retval = Sequence::to_string();
96  //retval += "*** IN CompositeSequence::to_string() ***\n";
97  //retval += "*** print out " + string_of(n_seqs()) + " sequences\n";
98  //retval += "*** base sequence " + sequence() + "\n";
99  //for ( Size ii = 1; ii <= n_seqs(); ++ii ) {
100  // retval += seqs_[ii]->to_string() + "\n";
101  //}
102  return retval;
103  //retval += "*** DONE WITH CompositeSequence::to_string() ***\n";
104 }
105 
107  return "composite_sequence";
108 }
109 
110 } // sequence
111 } // core