#!/bin/bash

tar -xvzf SSURef_106_tax_silva.fasta.tgz
sed "s/ Archaea;/.A - Archaea;/" SSURef_106_tax_silva.fasta > temp1
sed "s/ Eukaryota;/.E - Eukaryota;/" temp1 > temp2
sed "s/ Bacteria;/.B - Bacteria;/" temp2 > temp1
sed "s/\.B - \(Bacteria;.*;[Mm]itochondria;\)/.M - \1/" temp1 > temp2
sed "s/\.B - \(Bacteria;.*;[Cc]hloroplast;\)/.C - \1/" temp2 > temp1
sed "s/ Unclassified;/.O - Unclassified;/" temp1 > temp2
grep ">" temp2 | cut -f 1 -d " " | rev | cut -f 1 -d "." | sort | uniq -c
sed "s/ - .*;/ - /" temp2 > temp1
mv temp1 SSURef.fasta
rm temp2
formatdb -i SSURef.fasta -t "SSURef Metaxa DB" -o T -p F

## Written by Johan Bengtsson, July 2011
## Please send beers, pizzas, cakes, fruit pies, job positions and other types of feedback to:
## johan.bengtsson [at] microbiology.se
## Looking forward to hearing from you.... visit my website: www.microbiology.se for info on my research