IntaRNA 3.4.1
RNA-RNA interaction prediction | C++ API
Loading...
Searching...
No Matches
PredictionTrackerProfileMinE.h
Go to the documentation of this file.
1
2#ifndef INTARNA_PREDICTIONTRACKERPROFILEMINE_H_
3#define INTARNA_PREDICTIONTRACKERPROFILEMINE_H_
4
7
8#include <iostream>
9
10#include <boost/algorithm/string.hpp>
11
12namespace IntaRNA {
13
21{
22
23public:
24
44 , const std::string & seq1streamName
45 , const std::string & seq2streamName
46 , const std::string & E_INF_string = "NA"
47 , const std::string & sep = ";"
48 );
49
65 , std::ostream * seq1stream
66 , std::ostream * seq2stream
67 , const std::string & E_INF_string = "NA"
68 , const std::string & sep = ";"
69 );
70
75
76
86 virtual
87 void
88 updateOptimumCalled( const size_t i1, const size_t j1
89 , const size_t i2, const size_t j2
90 , const E_type energy
91 );
92
93
94protected:
95
98
101
103 std::ostream * seq1stream;
104
106 std::ostream * seq2stream;
107
109 const std::string E_INF_string;
110
112 const std::string sep_string;
113
115 typedef std::vector<E_type> MinEProfile;
116
119
122
131 static
132 void
134 , const size_t i
135 , const size_t j
136 , const E_type E);
137
147 template < typename MinEProfileIterator >
148 static
149 void
150 writeProfile( std::ostream &out
151 , const MinEProfileIterator & begin
152 , const MinEProfileIterator & end
153 , const RnaSequence & rna
154 , const std::string & E_INF_string
155 , const std::string & sep_string
156 );
157
158
159};
160
162
163template < typename MinEProfileIterator >
164inline
165void
167writeProfile( std::ostream &out
168 , const MinEProfileIterator & begin
169 , const MinEProfileIterator & end
170 , const RnaSequence & rna
171 , const std::string & E_INF_string
172 , const std::string & sep_string
173 )
174{
175 // write in CSV-like format (column data)
176
177 // print header : seq.ID ; minE
178 out <<"idx"<<sep_string<<boost::replace_all_copy(rna.getId(), sep_string, "_")<<sep_string<<"minE" <<'\n';
179 // print minE data
180 size_t i=0;
181 for (MinEProfileIterator curE = begin; curE!=end; curE++) {
182 out
183 // out index
184 <<rna.getInOutIndex(i)<<sep_string
185 // out nucleotide (index starts with 0)
186 <<rna.asString().at(i)<<sep_string
187 ;
188 // out infinity replacement if needed
189 if ( E_isINF( *curE ) ) {
190 out<<E_INF_string <<'\n';
191 } else {
192 out <<E_2_Ekcal(*curE) <<'\n';
193 }
194 // increase position counter
195 i++;
196 }
197}
198
200
201} // namespace
202
203#endif /* PREDICTIONTRACKERPROFILEMINE_H_ */
Definition InteractionEnergy.h:20
Definition PredictionTrackerProfileMinE.h:21
const std::string sep_string
the output string representation of column separators
Definition PredictionTrackerProfileMinE.h:112
static void writeProfile(std::ostream &out, const MinEProfileIterator &begin, const MinEProfileIterator &end, const RnaSequence &rna, const std::string &E_INF_string, const std::string &sep_string)
Definition PredictionTrackerProfileMinE.h:167
std::ostream * seq1stream
if non-NULL, the stream to write the minE-profile for seq1 to
Definition PredictionTrackerProfileMinE.h:103
MinEProfile seq1minE
the position-wise minimal energy values for seq1
Definition PredictionTrackerProfileMinE.h:118
static void updateProfile(MinEProfile &profile, const size_t i, const size_t j, const E_type E)
MinEProfile seq2minE
the position-wise minimal energy values for seq2
Definition PredictionTrackerProfileMinE.h:121
std::vector< E_type > MinEProfile
container definition for minE profile data
Definition PredictionTrackerProfileMinE.h:115
const std::string E_INF_string
the output string representation of E_INF values in the profile output
Definition PredictionTrackerProfileMinE.h:109
const bool deleteStreamsOnDestruction
whether or not the streams are to be deleted on destruction
Definition PredictionTrackerProfileMinE.h:100
PredictionTrackerProfileMinE(const InteractionEnergy &energy, std::ostream *seq1stream, std::ostream *seq2stream, const std::string &E_INF_string="NA", const std::string &sep=";")
PredictionTrackerProfileMinE(const InteractionEnergy &energy, const std::string &seq1streamName, const std::string &seq2streamName, const std::string &E_INF_string="NA", const std::string &sep=";")
const InteractionEnergy & energy
energy handler used for predictions
Definition PredictionTrackerProfileMinE.h:97
std::ostream * seq2stream
if non-NULL, the stream to write the minE-profile for seq2 to
Definition PredictionTrackerProfileMinE.h:106
virtual void updateOptimumCalled(const size_t i1, const size_t j1, const size_t i2, const size_t j2, const E_type energy)
Definition PredictionTracker.h:15
Definition RnaSequence.h:29
long getInOutIndex(const size_t i) const
Definition RnaSequence.h:376
const std::string & getId() const
Definition RnaSequence.h:346
const String_type & asString() const
Definition RnaSequence.h:442
#define E_isINF(e)
check if a given energy is set to E_INF
Definition general.h:143
#define E_2_Ekcal(e)
convert internal energy type to energy value in kcal/mol units
Definition general.h:107
Definition Accessibility.h:13
int E_type
type for energy values (energy + accessibility [ED]) (internally)
Definition general.h:78