IntroductionNumberingSequencesStructuresModellingMacrosPublicationsLinks
ColoringSequence StatisticsRenumberingAccessibilityTorsion AnglesStructural VariabilityHydrogen BondsDownloads

Macro AA_Charge

Highlights acidic and basic amino acids: Asp and Glu, red, His, cyan, Arg and Lys, blue

Usage:

  • Select the range of cells containing the sequences to be colored
  • Choose "Macro" for the "Tool" menu
  • Run macro AA_Charge
Sub AA_Charge()

'Highlights Charged Amino Acids

    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
    
'select Cells row i1-i2, column j1-j2; change only indicated Amino Acids
    
For i = i1 To i2 Step 1
    For j = j1 To j2 Step 1 'row i1-i2, column j1-j2'
        If ((Cells(i, j) = "H")) Then
            '+/- charged, color light blue'
            Cells(i, j).Select
            With Selection.Interior
                .ColorIndex = 9
                .Pattern = xlSolid
            End With
        Else
            If ((Cells(i, j) = "D") Or (Cells(i, j) = "E")) Then
                'acidic, color red'
                Cells(i, j).Select
                With Selection.Interior
                    .ColorIndex = 3
                    .Pattern = xlSolid
                    Selection.Font.ColorIndex = 2
                    End With
            Else
                If ((Cells(i, j) = "K") Or (Cells(i, j) = "R")) Then
                    'basic, color blue'
                    Cells(i, j).Select
                    With Selection.Interior
                        .ColorIndex = 11
                        .Pattern = xlSolid
                        Selection.Font.ColorIndex = 2
                    End With
                End If
            End If
        End If
    Next j
Next i

End Sub
AAAAA Homepage Zürich University Dept. of Biochemistry Plückthun Group Annemarie Honegger

Last Modified by A.Honegger Wednesday, January 26, 2005