#!/bin/bash
source activate deltaBS 
### Genome annotation (Prokka)
for f in ./*.fna
do
prokka $f --metagenome --kingdom bacteria --outdir ${f%}_prokka_result
done

for j in ./GCA_*genomic.fna_prokka_result
do

cd $j
mv PROKKA_*.gff ${j%}.gff
mv PROKKA_*.faa ${j%}.faa
cp *.gff ../
cp *.faa ../
cd ../
done

###Pan-genome analysis (Roary)
roary -e --mafft -p 8 *.gff

###Bitscore calculation (DeltaBS)
mkdir search
for f in ./*.faa
do
/home/shenzy/software/deltaBS/trimtruncations.pl $f
hmmsearch --domtblout ./search/${f%}.search /home/shenzy/software/deltaBS/database/gproNOG.hmm ${f%}.trim
/home/shenzy/software/deltaBS/parse_hmmsearch.pl ./search/${f%}.search
done
./parse_bitscores.pl gene_presence_absence.csv search
