IntroductionNumberingSequencesStructuresModellingMacrosPublicationsLinks
ColoringSequence StatisticsRenumberingAccessibilityTorsion AnglesStructural VariabilityHydrogen BondsDownloads

Macro AA_ConvertNN2AA

Translates nucleotide tripletts in individual cells to the corresponding amino acid one letter code

Usage:

  • Select the range of cells containing the sequences to be converted
  • Choose "Macro" for the "Tool" menu
  • run macro AA_ConvertNtoAA

Caution:

The translation replaces the original sequence. If you wish to keep a copy of the original sequence, duplicate the worksheet before running the macro

Sub AA_Convert_NtoAA()

'Translates nucleotide code to 1-letter amino acid code
'replaces Nucleotides with the amino acids => duplicate worksheet before translating
'requires Worksheet "Code". Each cell has to contain one triplet, defining the reading frame

    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
    
    For i = i1 To i2 Step 1
        For j = j1 To j2 Step 1
            If (VarType(Cells(i, j)) <> 8) Then     'cell does not contain a text string
                Cells(i, j) = "?"
                Cells(i, j).Select
                With Selection.Interior
                    .ColorIndex = 3
                    .Pattern = xlSolid
                End With
            Else
                For k = 1 To 64 Step 1
                   If Cells(i, j) Like Workbooks("AHo_macros.xls").Sheets("code").Cells(k, 1) Then
                      Cells(i, j) = Workbooks("AHo_macros.xls").Sheets("code").Cells(k, 2)
                      Exit For
                   End If
                Next k
            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