hello perl monks

I am trying to find palindromic sequence from file, which contains multiple sequences.

the script is providing result of palindromes present in file but it is not able to print the title of sequence

also after using "use strict and use warnings" script stop running and shows compilation error

please help me

here is the script I am using

#!/usr/bin/perl open (TEXT, "sample.txt")||die"Cannot"; my $pat=qr'^(Contig +([0-9]*))\s'; my $count = 0; for my $n (5..20) { my $re = qr /[CAGU]{$n}/; $regexes[$n-5] = $re; } NEXTLINE: while ($count < 1000) { my $line = <TEXT> ; $count++; foreach my $value (@regexes) { my $start = 0; while ($line =~ /$value/g) { my $endline = $'; my $match = $&; my $revmatch = reverse($match); $revmatch =~ tr/CAGU/GUCA/; if ($endline =~ /^([CAGU]{0,15})($revmatch)/) { $start = 1; my $palindrome = $match . "*" . $1 . "*" . $2; $palhash{$palindrome}++; } } if ($start == 0) { goto NEXTLINE; } } } print "L.$pat\n"; close TEXT; while(($key, $value) = each (%palhash)) { print "$key => $value\n"; } exit;

Here is sample.txt example

Contig1 NAAAAGUAUAGGCUCGAGAGAGAAGUCCUGGCCUAUCGGAUUACACCACGNGUCAGAUCU GUCACUUCAAGGAGCUUUUCAGCGUCUUUGACAAGAAUGGCNGACGGUUGCCGUCCUUCC AGGGAGAUUGGGGCAGAAUUCGAGUCACUGCCNGUGGAUUCCUUAGUGAUCCAGAUGUCG GAUAUAUGUCCAAUAUAGCCAAUNGUUGUUGGACAUAGCACCAUCAAUCAUCAAGAUUGC UAUUUCGCCACCUCNAUGUAGAGUGGAAGAUCCAAAUGCGGGAAUGGAUUUCAAGGUUGG UUAAGNAUGGGGGCAGCGGAUGAGUUAACAGUACAGCAAGCUAGGCAGCUCCAUUUNUGA CUUGGAAUCUUCAUACGAUUCAUUUAUGGCAGCUUUGCCUAAUGUUGNGUACUUGAAAGU AAAAUCCAAUAUUUCCAUAUUUUUGUUUAGUGCUUCAAAUCUGGUGAGAACGGAUGUUUU AAGUUGGUAAAACAGUGUAUUCAUUUUGAAGAGUUCUUGGAUUGUUUAAAGCUCAAGAUG CUAUUUGUGUGCUGCUGAUUUGUCGUUCUAUGAGAAAGAAUAUAUGCUUUAAUUUGGUUU UGUAAUAUUAANUAUAUUCAUUCCCCUUGAUUGUUGUUUUGUNNNNNNNNNNNNNNNNNN NN Contig2 NUGUUUUUUCUUUACUCGGUGUCUCGUCGGUACUCGACGACUAAANGGGNUAUAGGAGGG GCGCGAACGNCGAAACGGGAGUGGGUACAAAGCGUGGUCCNGGAUAGACGAGAGCGGACG CGCCGGGUGAAGCUCGGCGCGACGCGAGGCANAGAGGGGCCCGCAGANNNNNNNNNNNNN NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN NNNNNNNNNNAAGNCCCAGGAUGCGCAUCGCCCCAGGGGUGAAACCCCCAUCCCAAAGAA UGCUNCUCCUNCGCGGUAGGGCAGCUNCCCGAAGCACCCGACCGCUUUNAGGCCANCCAU AUGAUAAAGNAACGUUGUGUGGUGAAUGGGAUGAAGAUGAUUGAAGNAGAGUAGAGUUUU GCCUCUANAUCUUGAUAUGUAUAUCUUUAAUUAUAUAANUAUAGCUCAUUAUAUUGUGCN UUAGCAUGUAAUAUUUAAGUCUAAAAUUAANUGGACCUCAGCUCGAGGUCGNCAUUCUUU GUUACUUUAGAUCAGAUCUGUANUUCCCUUUGUAUUGUUCAGGNUUUCCAACCAUAAAUU AUUGGUACUAUCUUNAUUGUUAUCAUAAUUGACGUGUGUUUAAGUUCNNNNNNNNNNNNN NNNNN

I want my result in this form:(but it is not happening)

Contig1 GACGG*UUG*CCGUC => 1 GAUGC**GCAUC => 1 CGCCG*GGUGAAGCU*CGGCG => 1 Contig2 CAAUC*AUCAA*GAUUG => 1 GAUAU*GU*AUAUC => 1 AAAAU*CCAAUAUUUCCAU*AUUUU => 1

PROBLEM SOLVED


In reply to Palindrome sequence from file containing mutliple sequences by reciter

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.