File: convertFasta2Phylip.sh

package info (click to toggle)
raxml 8.2.12%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,516 kB
  • sloc: ansic: 57,710; perl: 125; sh: 63; makefile: 52
file content (13 lines) | stat: -rw-r--r-- 337 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
#! /bin/sh

if [ $# != 1 ]; then
    echo "USAGE: ./script <fasta-file>"
    exit
fi

numSpec=$(grep -c  ">" $1)
tmp=$(cat $1 | sed "s/>[ ]*\(\w*\).*/;\1</"  | tr -d "\n" | tr -d ' '  | sed 's/^;//' | tr "<" " " )
length=$(($(echo $tmp | sed 's/[^ ]* \([^;]*\);.*/\1/'   | wc -m ) - 1))

echo "$numSpec $length"
echo  $tmp | tr ";" "\n"