in reply to Maximum string length

Hi Berislav,

I notice that this is your fisrt post, welcome to the Monastery! Please read the PerlMonks FAQ if you have not already done so. I think it would be best if you post your Perl code and a short example of the input data. That way, people here can point out any problems or provide any enhancements to your code.

Hope this helps.

Martin

Replies are listed 'Best First'.
Re^2: Maximum string length
by Berislav (Acolyte) on Feb 22, 2006 at 14:08 UTC
    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.
      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....:-)