By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,089 Members | 2,432 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,089 IT Pros & Developers. It's quick & easy.

comparison of two dna sequences

P: 4
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
Share this Question
Share on Google+
6 Replies


100+
P: 332
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

P: 4
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

100+
P: 332
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

P: 4
ok cool I am gona try immediately...

thanks!
Sep 22 '11 #5

P: 4
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

100+
P: 332
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

Post your reply

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