Macro AA_SeqLengthCounts the number of valid amino acid within each of the sequences in the selected sequence block. The result is placed in the first column to the right of the selected sequence block Usage:
Caution:
Sub AA_SeqLength() 'Counts number of valid amino acid within the selected sequences 'The result is placed in the column following the selected sequence block If Selection.Columns.Count = 0 Then 'Error, nothing selected MsgBox Prompt:="No cells selected, please select the sequences you wish to process" 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 a = 0 For j = j1 To j2 Step 1 'row i1-i2, column j1-j2' If Not (Cells(i, j) = "" Or Cells(i, j) = "." Or Cells(i, j) = " ") Then a = a + 1 Next j Cells(i, j2 + 1) = a Next i 'Format result Range(Cells(i1, j2 + 1), Cells(i2, j2 + 1)).Select Selection.ColumnWidth = 5 Selection.NumberFormat = "0" Selection.Font.Bold = True Selection.HorizontalAlignment = xlCenter Selection.VerticalAlignment = xlCenter End Sub |
|
|||||||||||||||||
Last Modified by A.Honegger |