Skip to content
Prev 205150 / 398506 Next

caculate the frequencies of the Amino Acids

On Jan 2, 2010, at 12:55 AM, che wrote:

            
Sorry. I did not read to the very end. My apologies, hopefully the  
following
oneliner will make up for my dereliction of attention.
After copy-pasting the sequences from a browser window to a character  
object, "seqnc", I then processed it:

 > seqlines <- readLines(textConnection(seqnc))

# Then for the first sequence:

 > table(strsplit(seqlines[1], vector())  )

  A  D  E  F  G  I  K  L  M  N  P  Q  R  S  T  V  W  Y
21 25 28 27 24 34 39 31 11 20 16 10 17 25 22 33  3 15

# For "mass production": The names that resulted from my first effort  
were a bit
unwieldly ( > 200 characters long) so I unnamed it:

unname( sapply(seqlines, function(x) table(strsplit(x, vector() ) ) )  )

[[1]]

  A  D  E  F  G  I  K  L  M  N  P  Q  R  S  T  V  W  Y
21 25 28 27 24 34 39 31 11 20 16 10 17 25 22 33  3 15

[[2]]

  A  C  D  E  F  G  H  I  K  L  M  N  P  Q  R  S  T  V  W  Y
34  5 15 25  6 35  7 24 23 32  9 12 15 10 17 14 13 36  2 13

[[3]]

  A  C  D  E  F  G  H  I  K  L  M  N  P  Q  R  S  T  V  W  Y
33  5 17 24  7 36  7 24 24 32  9 13 14  9 17 12 14 36  2 12

[[4]]

  A  C  D  E  F  G  H  I  K  L  M  N  P  Q  R  S  T  V  W  Y
33  5 16 25  5 35  6 24 23 33  8 12 15  9 17 17 12 35  2 15

[[5]]

  A  C  D  E  F  G  H  I  K  L  M  N  P  Q  R  S  T  V  W  Y
33  4 15  6 21 30  3 19 23 22  8  8  8 14 17 14 12 24  5 12

[[6]]

  A  C  D  E  F  G  H  I  K  L  M  N  P  Q  R  S  T  V  W  Y
30  3 13  4 16 22  2 17 16 17  6  6  7 11 15 11 12 18  3 11

[[7]]

  A  C  D  E  F  G  H  I  K  L  M  N  P  Q  R  S  T  V  W  Y
39  5 21  8 22 39  2 23 29 25 10  8  7 13 22 14 21 25  7 16

[[8]]

  A  C  D  E  F  G  H  I  K  L  M  N  P  Q  R  S  T  V  W  Y
34  4 17  6 19 30  2 20 24 21  8  7  7 12 17 14 16 21  5 14

[[9]]

  A  C  D  E  F  G  H  I  K  L  M  N  P  Q  R  S  T  V  W  Y
35  4 17  6 18 31  3 20 23 21  8  7  7 12 18 12 17 21  5 13

[[10]]

A
5