go back to using const char * in seqcomp
authorDiane Trout <diane@caltech.edu>
Thu, 7 Sep 2006 00:32:32 +0000 (00:32 +0000)
committerDiane Trout <diane@caltech.edu>
Thu, 7 Sep 2006 00:32:32 +0000 (00:32 +0000)
it appears that the string iterator version is about half as fast
as just using raw const char * pointers.

Hopefully the string pointers won't get moved around behind the scenes
while seqcomp is running. (Currently shouldn't as once a sequence is
set it's supposed to be constant.

alg/flp_seqcomp.cpp
alg/sequence.cpp
alg/sequence.hpp

index 2c7ad7a4adb9cb2145461149f74f32e55cf49d25..04eca42dd0711266d3876a505c6e1e6bccedb348 100644 (file)
@@ -52,8 +52,8 @@ FLPs::seqcomp(const Sequence& sseq1, const Sequence& sseq2, bool is_RC)
   int start_i, seq1_i, seq2_i, win_i;      // loop variables
   int matches;                    // number of matches in to a window
   int i2_offset;
-  Sequence::const_iterator seq1 = sseq1.begin();
-  Sequence::const_iterator seq2 = sseq2.begin();
+  const char *seq1 = sseq1.c_str();
+  const char *seq2 = sseq2.c_str();
 
   int seq1_win_num = sseq1.size() - window_size + 1;
   int seq2_win_num = sseq2.size() - window_size + 1;
index 550d7477b2cc3af7ae96a2a8056275d4bed37ba5..b2fa0114a3676f5dbf0e7a9b9d336449d1485548 100644 (file)
@@ -610,6 +610,10 @@ Sequence::clear()
   motif_list.clear();
 }
 
+const char *Sequence::c_str() const
+{
+  return seq->c_str();
+}
 
 Sequence::const_iterator Sequence::begin() const
 {
index f77160cdf88b88d7cd66a4cada7c5e868f02cc42..34c28b69b26972dc9b64db3afc06eee7c1c5c06a 100644 (file)
@@ -133,6 +133,8 @@ public:
   const_reference at(size_type n) const;
   //! clear the sequence and its annotations
   void clear();
+  //! return c pointer to the sequence data
+  const char *c_str() const;
   //! forward iterator
   const_iterator begin() const;
   //! last iterator