Macro AA_Type
Macro AA_Type colors a selected sequence block according to amino acid type. Aromatic amino acids (Trp, Phe, Tyr) are colored orange, aliphatic and hydrophobic ones (Leu, Ile, Val, Pro, Ala, Met, Cys) yellow, Gly green-yellow, uncharged hydrophilic residues (Ser, Thr, Asn, Gln) green, acidic ones (Asp, Glu) red, His cyan, Arg and Lys blue.
Select a sequence block and run AA_Type on it to get this style of coloring: (Color Code)
AA_Type can be seen as a combination of coloring by hydropathy and highlighting charged amino acids. It allows optimal perception of conserved residue properties in large sequence alignments
Usage:
- Select the range of cells containing the sequences to be colored
- Choose "Macro" for the "Tool" menu
- Run macro AA_Type
-
Sub AA_Type()
'Color an Amino Acid Alignment by Amino Acid Type: Tyr, Phe, Trp: orange; Leu, Ile, Val, Pro, Ala, Met, Cys: yellow;
'Gly: green-yellow; Thr, Ser, Asn, Gln: green; His: cyan; Arg, Lys: blue; Asp, Glu: red
If Selection.Columns.Count = 0 Then 'Error, nothing selected
MsgBox Prompt:="No cells selected, please select the sequences you wish to color"
Exit Sub
End If
'get extent of current selection
i1 = Selection.Row
i2 = i1 + Selection.Rows.Count - 1
j1 = Selection.Column
j2 = j1 + Selection.Columns.Count - 1
'Format selected area
Selection.Borders(xlLeft).LineStyle = xlNone
Selection.Borders(xlRight).LineStyle = xlNone
Selection.Borders(xlTop).LineStyle = xlNone
Selection.Borders(xlBottom).LineStyle = xlNone
Selection.BorderAround Weight:=xlThick
Selection.Interior.ColorIndex = xlNone
Selection.Font.Name = "Geneva"
Selection.Font.FontStyle = "Regular"
Selection.Font.Size = 9
Selection.Font.ColorIndex = 1
Selection.Font.Bold = True
Selection.HorizontalAlignment = xlCenter
Selection.VerticalAlignment = xlCenter
For i = i1 To i2 Step 1
For j = j1 To J2 Step 1 'row i1-i2, column j1-j2'
k = 1
'gap or unidentifiable residue, color black
If ((Cells(i, j) = "W") Or (Cells(i, j) = "F") Or (Cells(i, j) = "Y")) Then
'aromatic, color orange'
k = 4
ElseIf ((Cells(i, j) = "L") Or (Cells(i, j) = "I") Or (Cells(i, j) = "V") Or (Cells(i, j) = "P") Or (Cells(i, j) = "A")) Then
'aliphatic, color yellow'
k = 5
ElseIf ((Cells(i, j) = "M") Or (Cells(i, j) = "C")) Then
'hydrophobic, color yellow'
k = 5
ElseIf ((Cells(i, j) = "G")) Then
'+/- hydrophilic, color light green'
k = 6
ElseIf ((Cells(i, j) = "S") Or (Cells(i, j) = "T") Or (Cells(i, j) = "N") Or (Cells(i, j) = "Q")) Then
'hydrophilic, color green'
k = 7
ElseIf ((Cells(i, j) = "H")) Then
'+/-charged, color light blue'
k = 9
ElseIf ((Cells(i, j) = "D") Or (Cells(i, j) = "E")) Then
'acidic, color red'
k = 3
ElseIf ((Cells(i, j) = "K") Or (Cells(i, j) = "R")) Then
'basic, color blue'
k = 11
End If
'color cell
Cells(i, j).Select
With Selection.Interior
.ColorIndex = k
.Pattern = xlSolid
If k = 1 Or k = 3 Or k = 11 Then 'Cell background dark, character white
Selection.Font.ColorIndex = 2
End If
End With
Next j
Next i
End Sub
|