Skip to content

Instantly share code, notes, and snippets.

@genomewalker
Last active January 22, 2016 08:23
Show Gist options
  • Save genomewalker/cf4cb3f50092e398762b to your computer and use it in GitHub Desktop.
Save genomewalker/cf4cb3f50092e398762b to your computer and use it in GitHub Desktop.
#!/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}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment