Amino acid sequences in pyplot (Same regions in both sequences)
Question: I'm beginner at python, and need your help :) I have to compare two sequences,
when amino acid is similar at both sequences (doesn't matter which position it
is) program should put in into graph as point.

For example: If we have two sequences

x=['M','N','K','M']

y=['M','K','M']

Program should tick a point in position (1,1) (because of 2 M's), (1,3)
(same), (3,2) (because of 2 K's), (4,1) and (4,1)

At finish, with bigger sequence it should looks like that:

<http://wrzucaj.net/images/2016/03/02/853cd842715edd881296c804502d475b.png>

But i stuck, the effect of my works looks like that:

<http://wrzucaj.net/images/2016/03/02/005862962dea7e3a6eb24f3449704ef5.png>

In left side and bottom, there should be shown sequence which is covered by
other amino acids, i don't know why.

# Importing

    
    
    import wx
    import matplotlib.pyplot as plt
    

## And this is how program looks like:

    
    
    def pajplot(evt):
       Ktory1=Lista.GetSelection()
       Ktory2=Listaa.GetSelection()
       a=Sekwencje[Ktory1][3]
       b=Sekwencje[Ktory2][3]
       x1=[]
       y1=[]
       x2=[]
       y2=[]
       for i in range(30):
           for j in range(30):
               if a[i]==b[j]:
                   x1.append(i)
                   y1.append(j)
               else:
                   x2.append(i)
                   y2.append(j)
       Sekwencja1=[]
       Sekwencja2=[]
       for i in range(30):
           Sekwencja1.append(a[i])
       for j in range(30):
           Sekwencja2.append(b[j])
       plt.plot(x1 ,y1, 'ko')
       plt.plot(x2 ,y2, 'wo')
       plt.xticks(x1, Sekwencja1,'ko')
       plt.yticks(y1, Sekwencja2,'wo')
       plt.show()
    

Where Sekwencje is list, which have lists inside with names, etc and sequence
at 4 place. I tried to make it for 30 amino acids at start.

No need full answer, could be only a little hint.

Thank you in Advance.


Answer: It looks like you are putting x- and y-ticks only at the coordinates of your
matched amino acids. But you are using all the amino acid letters.

It is not entirely clear whether you want all of the labels (in their proper
places) or only labels where you find a match. So you could do **one** of
those two things depending on what you want:

**Only put labels where there are matches** : In that case you need to change
your definitions of `Sekwencja` 1 and 2:

    
    
    Sekwencja1 = [a[i] for i in x1]
    Sekwencja2 = [b[j] for j in y1]
    

**Put labels on everything** : In this case you need to use `range(30)`
instead of `x1` and `y1` when setting the ticks:

    
    
    plt.xticks([range(30)], Sekwencja1,'ko')
    plt.yticks([range(30)], Sekwencja2,'wo')
    

