CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Comparing 2 different-sized strings

 



AdrianJ217
Novice

Aug 8, 2013, 8:30 AM

Post #1 of 3 (2053 views)
Comparing 2 different-sized strings Can't Post

Hi,

I'm kind of new to Perl and I am comparing 2 strings of different size containing DNA nucleotides. I want the script to take the smaller string and locate it in the much larger string allowing for mismatches and providing me with the sequence it found in the larger string plus adjacent 5 nucleotides on either side.

So for example if I have 2 strings:

#1 ATGATCCTG
#2 TCGAGTGGCCATGAACGTGCCAATTG

I want the script to take #1 and find the same sequence in #2 which is present but with 2 mismatches, along with 5 nucleotides on either side.

Thank you so much!


BillKSmith
Veteran

Aug 8, 2013, 1:30 PM

Post #2 of 3 (2033 views)
Re: [AdrianJ217] Comparing 2 different-sized strings [In reply to] Can't Post

Am I missing something? Every substring of the right length matches except for the differences. If that is what you want, take a substring of the right length beginning at each character of the longer string. Count the mismatches in each.
Good Luck,
Bill


Laurent_R
Veteran / Moderator

Aug 8, 2013, 2:45 PM

Post #3 of 3 (2026 views)
Re: [BillKSmith] Comparing 2 different-sized strings [In reply to] Can't Post

This is crossposted on (at least) :
- Perlmonks: http://www.perlmonks.org/?node_id=1048596
- Devshed: http://forums.devshed.com/perl-programming-6/comparing-2-different-sized-strings-in-perl-949907.html#post2896087
- Stackoverflow: http://stackoverflow.com/questions/18130000/comparing-2-different-sized-strings

Just quoting again from a post by someone else on Perlmonks:


Quote
It is considered polite to inform about crossposting so people not attending both sites do not waste their time hacking a solution to a problem already solved at the other end of the Internet.


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives