in reply to Re: Maximum string length
in thread Maximum string length

Thank You everyone for your replies....:-) In the meantime I've found out where the problem was, but i will post the code, and an example of input data, nevertheless. Please note that the purpose of this code is to test an algorithm, and it's not a final version of the program i have in mind.
system "clear"; print "Palindrome - gamma version\n"; print "--------------------------\n\n"; print "Please enter DNA filename: "; $filename=<STDIN>; chomp $filename; unless (-e $filename) { print "No such file...exiting\n\n"; exit; } unless (open(DNASEQ, $filename)) { print "Cannot open file...exiting\n\n"; exit; } @dna=<DNASEQ>; $dna=join('', @dna); $dna=~ s/\s//g; $count_of_2=0; for ($lb=0; $lb<length $dna; ++$lb) { $lba=substr ($dna, $lb, 1); $rba=substr ($dna, $lb+1, 1); $rba=~ tr/atgc/tacg/; if ($lba eq $rba) { ++$count_of_2; } else { } } print "Number of 2bp palindromes: ", $count_of_2, "\n"; exit;
Input data are files that contain DNA sequences arranged in the following format:
CGACAGCTACGATCGTAC CAGTATCATCACTACGTA CACGAGAGTACGATCGAC ......etc.........

The program should work with both lower- and uppercase sequences, but i forgot to add something like
$dna=~ tr/ATGC/atgc/;

so when i loaded uppercase DNA sequence it just didn' do the job right. Now the two programs give the same results, i've tested them with sequences containing up to 29160000 characters.

Replies are listed 'Best First'.
Re^3: Maximum string length
by holli (Abbot) on Feb 22, 2006 at 14:19 UTC
    Out of curiosity: How long is the C sourcecode your friend wrote? And ... Have you ever looked at bioperl?


    holli, /regexed monk/
      I'm not sure how long the C sourcecode is, but the entire .exe is about 400-500 kb. Besides, it has additional features, like GUI, together with severeal other character comparison options...
      And, yes, i've looked at bioperl, but couldn't find what i needed, so i started from scratch. I plan to do some Monte Carlo simulations, and most of the things i need for the job are ready (like PRNG with **BIG** period), and i've almost ready to start working on Random and Markov chain string generator - (come to think of it, i haven't looked if these two already exist...:-)). I do hope that I didn't overlook the existence of the scripts i need....:-)
        like PRNG with **BIG** period ... I do hope that I didn't overlook the existence of the scripts i need

        Did you see Math::Random::MT. Would it's 219937 be big enough for your needs?


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.