#!/bin/bash
#SBATCH -t 24:00:00
#SBATCH --nodes=1 --ntasks-per-node=20
#SBATCH --export=NONE
#SBATCH --mail-user=htrautmann@uri.edu
#SBATCH --mail-type=BEGIN,END,FAIL


grep -F ">" $1 > headers.txt

sed 's/^/="/' headers.txt > headers_mod.txt
sed 's/$/"/' headers_mod.txt > headers_mod2.txt

cat -n headers_mod2.txt > headers_numbers.txt

awk '{$1="%%>"$1"%%"}8' headers_numbers.txt > hn2.txt

awk '/^>/{print ">" ++i; next}{print}' <$1 >replaced_headers.fasta

awk '/^>/{$1=">%%"$1"%%"}8' replaced_headers.fasta > replaced_headers2.fasta

module purge
module load ClustalW2/2.1-foss-2016b
clustalw2 -INFILE=replaced_headers2.fasta -OUTPUT=PHYLIP

module load RAxML/8.2.10-goolf-2016b-hybrid-avx
raxmlHPC-HYBRID-AVX -m PROTGAMMAWAG -s replaced_headers2.phy -n treenew7 -f a -N 100 -x 11 -p 11 -T 4


