X-Git-Url: http://woldlab.caltech.edu/gitweb/?a=blobdiff_plain;f=sequence.cc;h=4351f8915bf528a9c350b11f0f343fe0ef30f51e;hb=c117a6a41d8e8f04511919f5d3c224480816b685;hp=c706f47cbface27d21c4117ab8696c5a95158bb6;hpb=f4beb6fe3e304bb62d01ad259354b17f1773ee54;p=mussa.git diff --git a/sequence.cc b/sequence.cc index c706f47..4351f89 100644 --- a/sequence.cc +++ b/sequence.cc @@ -1,3 +1,23 @@ +// This file is part of the Mussa source distribution. +// http://mussa.caltech.edu/ +// Contact author: Tristan De Buysscher, tristan@caltech.edu + +// This program and all associated source code files are Copyright (C) 2005 +// the California Institute of Technology, Pasadena, CA, 91125 USA. It is +// under the GNU Public License; please see the included LICENSE.txt +// file for more information, or contact Tristan directly. + + +// This file is part of the Mussa source distribution. +// http://mussa.caltech.edu/ +// Contact author: Tristan De Buysscher, tristan@caltech.edu + +// This program and all associated source code files are Copyright (C) 2005 +// the California Institute of Technology, Pasadena, CA, 91125 USA. It is +// under the GNU Public License; please see the included LICENSE.txt +// file for more information, or contact Tristan directly. + + // ---------------------------------------- // ---------- sequence.cc ----------- // ---------------------------------------- @@ -301,6 +321,7 @@ void Sequence::set_seq(string a_seq) { sequence = a_seq; + length = sequence.length(); } @@ -543,15 +564,19 @@ Sequence::find_motif(string a_motif) cout << "motif is: " << a_motif << endl; a_motif = motif_validate(a_motif); - cout << "motif is: " << a_motif << endl; + //cout << "motif is: " << a_motif << endl; - motif_scan(a_motif, &motif_match_starts); - a_motif_rc = rc_motif(a_motif); - // make sure not to do search again if it is a palindrome - if (a_motif_rc != a_motif) - motif_scan(a_motif_rc, &motif_match_starts); + if (a_motif != "") + { + cout << "Sequence: none blank motif\n"; + motif_scan(a_motif, &motif_match_starts); + a_motif_rc = rc_motif(a_motif); + // make sure not to do search again if it is a palindrome + if (a_motif_rc != a_motif) + motif_scan(a_motif_rc, &motif_match_starts); + } return motif_match_starts; } @@ -563,6 +588,7 @@ Sequence::motif_scan(string a_motif, vector * motif_match_starts) // faster to loop thru the sequence as a old c string (ie char array) seq_c = (char*)sequence.c_str(); + //cout << "Sequence: motif, seq len = " << sequence.length() << endl; motif_len = a_motif.length(); //cout << "motif_length: " << motif_len << endl; @@ -570,12 +596,13 @@ Sequence::motif_scan(string a_motif, vector * motif_match_starts) motif_i = 0; - cout << "motif: " << a_motif << endl; + //cout << "motif: " << a_motif << endl; - //cout << "length: " << length << endl; + //cout << "Sequence: motif, length= " << length << endl; seq_i = 0; while (seq_i < length) { + cout << seq_c[seq_i]; //if ((seq_i > 10885) && (seq_i < 10917)) //cout << seq_c[seq_i] << "?" << a_motif[motif_i] << ":" << motif_i << " "; // this is pretty much a straight translation of Nora's python code