X BOL wishing you a very and Happy New year

Alternative content

Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Perl script to find palindromic pattern !

  • Public
By Rahul Nayak 2330 days ago
#!/usr/bin/perl use strict; use warnings; use strict; my %invert; @invert{ qw[ A C G T ] } = qw[ T G C A ]; my $in = do{ local $/; <DATA> }; chomp $in; print $in; for my $p1 ( 1 .. length( $in ) -2 ) { next unless substr( $in, $p1, 1 ) eq $invert{ substr $in, $p1+1, 1 }; my $pals = 0; for my $p2 ( 1 .. $p1 -1 ) { last unless substr( $in, $p1-$p2, 1 ) eq $invert{ substr $in, $p1+$p2+1, 1 }; ++$pals; } if( $pals ) { my $val=substr( $in, $p1-$pals, ($pals+1)*2 ); my $st=$p1-$pals; my $sLen=($pals+1)*2; my $ed=($st+$sLen)-1; print "$st\t$ed\t$sLen\t$val\n"; printf "%s%s at %d\n", ' 'x($p1-$pals), substr( $in, $p1-$pals, ($pals+1)*2 ), $p1-$pals; } } __DATA__ AGAGGTCAGTCTGCATCGTATCGATCGTCGACGATCGATACGATGCAGACTGACGAGAG