The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to get the count only if two column matches? gobinath Shell Programming and Scripting 3 05-27-2008 01:01 AM
Until the file extension matches Sreejith_VK Shell Programming and Scripting 7 05-08-2008 08:56 PM
How to remove all matches in a string with sed lumix Shell Programming and Scripting 0 12-14-2007 05:09 PM
Extract if pattern matches Raynon Shell Programming and Scripting 20 10-29-2007 01:44 AM
how to get the pos() of 2 str matches in one loop in perl umen Shell Programming and Scripting 1 07-26-2006 06:30 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-22-2008
Registered User
 

Join Date: Jan 2008
Location: India
Posts: 2
Thumbs up Matches and mismatches in perl

When we give an input sequence , the program should match with the pattern and give the matches and mismatches in the output.

i will give you 2 small examples. if you cant get it pls let me know.
i will try to give a clear idea.

example 1:

$a=APPLE; # let it be a pattern
$b=<STDIN>; # input sequence

suppose my input sequence ($b) is : MYAPPLES
Then the input ($b) will match with $a only from 3rd letter to 7th letter.( i.e APPLE)
i want to get out put as below:

The matching region is - - APPLE- (i.e mismatches should be shown as hiphen)

If the pattern is "MYAPPLE" and the input is "APPLEMY"

Then the output should be:

- -APPLE- -

i.e the first 2 hiphens represent gaps and last 2 hiphens represent mismatches.


Example2:
$a="agaaaagavvgglggy" # a pattern signature
$b=<STDIN>;

let the input seq is "ttttttttttagaaaagavtttggyttttttt";

here the input matches with $a only with the letters in bold : ttttttttttagaaaagavtttggyttttttt

i want to know what we can do to give input showing both matches and mismatches in the input.(mismatches in the seq should be shown as a hiphen)
That means the output should be like this:
The given sequence matches with the pattern at - - - - - - - - - - agaaaagav- - -ggy - - - - - -
Reply With Quote
Google The UNIX and Linux Forums
Forum Sponsor
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:53 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0