Macro AA_ConvertNN2AATranslates nucleotide tripletts in individual cells to the corresponding amino acid one letter code Usage:
Caution:
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 |
|
|||||||||||||||||
Last Modified by A.Honegger |