in reply to Re: Maximum string length
in thread Maximum string length
Input data are files that contain DNA sequences arranged in the following format: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;
CGACAGCTACGATCGTAC CAGTATCATCACTACGTA CACGAGAGTACGATCGAC ......etc.........
$dna=~ tr/ATGC/atgc/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Maximum string length
by holli (Abbot) on Feb 22, 2006 at 14:19 UTC | |
by Anonymous Monk on Feb 22, 2006 at 14:58 UTC | |
by BrowserUk (Patriarch) on Feb 22, 2006 at 15:44 UTC | |
by Anonymous Monk on Feb 22, 2006 at 18:54 UTC |