#!/bin/bash
# We need one fasta file export with the aligned sequences and another with the SS SAI filter
ALIGN=${1}
OFILE=${1/.fasta/.stk}
# Creating the first part of the file
# we need to linearize the fasta file
awk '
BEGIN{
RS=">"
print "# STOCKHOLM 1.0"
}
{
if ($0 ~ /HelBacte/)
{
exit
}
}
{
sub("\n","\t");
gsub("\n","");
gsub(" ","");
gsub("\t"," ");
print $0
}
' ${ALIGN} > ${OFILE}
# We linearize the SS SAI and add to the converted file
awk 'BEGIN{RS="HelBacte"}NR>1{sub("\n","\t"); gsub("\n",""); gsub(" ",""); gsub("\t"," "); print $0}' ${ALIGN} |awk '{print "#=GC SS_cons"$0"\n//"}' >> ${OFILE}