From: Diane Trout Date: Thu, 7 Sep 2006 00:32:32 +0000 (+0000) Subject: go back to using const char * in seqcomp X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=commitdiff_plain;h=a1b5ecc1ff79d588ffd1b68bc443e695825291c5 go back to using const char * in seqcomp 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. --- diff --git a/alg/flp_seqcomp.cpp b/alg/flp_seqcomp.cpp index 2c7ad7a..04eca42 100644 --- a/alg/flp_seqcomp.cpp +++ b/alg/flp_seqcomp.cpp @@ -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; diff --git a/alg/sequence.cpp b/alg/sequence.cpp index 550d747..b2fa011 100644 --- a/alg/sequence.cpp +++ b/alg/sequence.cpp @@ -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 { diff --git a/alg/sequence.hpp b/alg/sequence.hpp index f77160c..34c28b6 100644 --- a/alg/sequence.hpp +++ b/alg/sequence.hpp @@ -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