File: amino-acid-composition

package info (click to toggle)
ncbi-entrez-direct 10.9.20190219%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,192 kB
  • sloc: perl: 6,282; sh: 1,685; makefile: 77
file content (25 lines) | stat: -rwxr-xr-x 526 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash -norc
abbrev=( Ala Asx Cys Asp Glu Phe Gly His Ile \
         Xle Lys Leu Met Asn Pyl Pro Gln Arg \
         Ser Thr Sec Val Trp Xxx Tyr Glx )

AminoAcidComp() {
  local count
  while read num lttr
  do
    idx=$(printf %i "'$lttr'")
    ofs=$((idx-97))
    count[$ofs]="$num"
  done <<< "$1"
  for i in {0..25}
  do
    echo -e "${abbrev[$i]}\t${count[$i]-0}"
  done |
  sort
}

while read seq
do
  comp="$(echo "$seq" | tr A-Z a-z | sed 's/[^a-z]//g' | fold -w 1 | sort-uniq-count)"
  AminoAcidComp "$comp"
done