Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > Perl and the DBI > Matches and mismatches in perl

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-22-08, 23:41
srisha srisha is offline
Registered User
 
Join Date: Jan 2008
Location: India
Posts: 3
Exclamation Matches and mismatches in perl

When we give an input sequence , the tool 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
  #2 (permalink)  
Old 01-30-08, 15:34
sco08y sco08y is offline
Registered User
 
Join Date: Oct 2002
Location: Fort Polk, LA
Posts: 500
You're probably looking for a diff algorithm.

http://search.cpan.org/~yappo/String...String/Diff.pm

Beyond that, you haven't specified the problem completely enough to come up with an actual answer. And it sounds like a homework problem to me.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On