473,385 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

comparison of two dna sequences

Hi,
I would ike to compare two dna sequences. let's say
seq_a= TGGAGGCAATGGCGGCCAGCACTTCCCTGCCTGACCCTGGAGACTTTGAC CGGAACGTG
CCCCGGATCTGTGGGGTGTGTGGAGACCGAGCCACTGGCTTTCACTTCAA TGCTATGACC
TGTGAAGGCTGCAAAGGCTTCTTCAGGCGAAGCATGAAGCGGAAGGCACT ATTCACCTGC
CCCTTCAACGGGGACTGCCGCATCACCAAGGACAACCGACGCCACTGCCA GGCCTGCCGG

and

seq_b=GACTCCTCCTCCTCCTGCTCAGATCACTGTATCACCTCTTCAGA CATGATGGAC---TCGTCCTTCTCCCTGCTGAATGAAAAATCAGATGACTCT---------------GTGCTAGAG
CTGTCCCAA-------------------------------------------------------------------------------------GACCTCACCTCTGAGGACCAGATCGTACTGCTGAAGTCAAGTGCCATTGA GGTCATCATGTTGCGCTCCAATGAGTCCTTCACC

how can I find differences in term of codons and position?
Sep 21 '11 #1
6 12188
Mariostg
332 100+
How does your program look so far?
What output do you expect based on your two sequences.
There are different ways to present a solution. So more details are required.
Sep 21 '11 #2
Hi, right now I done the script to find mismatches between those sequences as follow:
def sequence_compare(seq_a, seq_b):
len1= len(seq_a)
len2= len(seq_b)
mismatches = []
for pos in range (0,min(len1,len2)) :
if seq_a[pos] != seq_b[pos]:
mismatches.append(pos)
return mismatches
sequence_compare(seq_a,seq_b)

Thus eventually this gives me the right position of the mismatches between those two sequence. But at this point I get lost, because I want to know which codons are involved in comparison.
i.e I know that there is a mismatch at the position 19 but which codons is involved so far?, and what the related amino acid?
thanks
Sep 22 '11 #3
Mariostg
332 100+
Maybe something like this would help:
Expand|Select|Wrap|Line Numbers
  1. def sequence_compare(seq_a, seq_b):
  2.         len1= len(seq_a)
  3.         len2= len(seq_b)
  4.         mismatches = []
  5.         for pos in range (0,min(len1,len2)) :
  6.               if seq_a[pos] != seq_b[pos]:
  7.                   mismatches.append('|')
  8.               else:
  9.                   mismatches.append(' ')
  10.         print (seq_a)
  11.         print (mismatches)
  12.         print (seg_b)
  13. sequence_compare(seq_a,seq_b)
  14.  
  15. Would print and show the differences.
  16.  
  17. ACTGGCT
  18.  |  | |
  19. ATTGACA
  20.  
Sep 22 '11 #4
ok cool I am gona try immediately...

thanks!
Sep 22 '11 #5
ok it works quite nicely but what about if I want in addition to this I want to know the amino acid related to that specific codons change?

thanks
Sep 22 '11 #6
Mariostg
332 100+
I guess it all depends on how you want to visualize the output. Maybe add something similar to what I proposed earlier but instead of appending pipe and space characters, add a new list with the related amino acid.
Sep 22 '11 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: temp | last post by:
Hi All, I wonder could someone help me with this? What I want to do is search through a list of letters and look for adjacent groups of letters that form sequences, not in the usual way of...
125
by: Rhino | last post by:
One of my friends, Scott, is a consultant who doesn't currently have newsgroup access so I am asking these questions for him. I'll be telling him how to monitor the answers via Google Newsgroup...
10
by: Vilson farias | last post by:
Greetings, I'm getting a big performance problem and I would like to ask you what would be the reason, but first I need to explain how it happens. Let's suppose I can't use sequences (it seams...
4
by: Hemant Shah | last post by:
Folks, I have created bunch of sequences in DB2 7.2. How do I list all the defined sequences and if possible their current values? Thanks. --
46
by: yadurajj | last post by:
Hello i am newbie trying to learn C..I need to know about string comparisons in C, without using a library function,...recently I was asked this in an interview..I can write a small program but I...
18
by: Bruno Baguette | last post by:
Hello, I have to design a table wich will store some action reports. Each report have an ID like this 1/2004, 2/2004, ... and each years, they restart to 1 (1/2004, 1/2005, 1/2006,...). So, I...
5
by: Michael Fuhr | last post by:
I'd like to propose that certain GRANTs on a table cascade to the table's implicit sequences. In the current implementation (as of 7.4.5 and 8.0.0beta3), a table owner must typically issue GRANT...
43
by: michael.f.ellis | last post by:
The following script puzzles me. It creates two nested lists that compare identically. After identical element assignments, the lists are different. In one case, a single element is replaced. In...
14
by: Steve Bergman | last post by:
I'm looking for a module to do fuzzy comparison of strings. I have 2 item master files which are supposed to be identical, but they have thousands of records where the item numbers don't match in...
4
by: JJ | last post by:
Is there a way of checking that a line with escape sequences in it, has no strings in it (apart from the escape sequences)? i.e. a line with \n\t\t\t\t\t\t\t\r\n would have no string in it a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.