
#this uses the filtered contigs to map to reference and make consensus CDS

cat [sample]CONTIGS_in.fna > miniplus.fas

cp filters/[LOCUS].fas ref.fna
bwa index ref.fna

k=101
bwa mem -k$k ref.fna miniplus.fas -M >oot.sam

java -jar -Xmx8g SamFormatConverter.jar INPUT=oot.sam OUTPUT=test.bam
samtools sort test.bam test.sorted
tg_index -b test.sorted.bam
gap5_consensus -format fasta test.sorted.0
mv cons.fasta [sample]oot.fas

#or we can simply get it from the final superscaffold 
PRIM1=[32bp start of gene]
PRIM2=[32bp start of gene]
grep -o "$PRIM1".* $SAMPLE"_GF2_15.gapfilled.final.fa" 
sed 's|'$PRIM2'.*|'$PRIM2'|' 
#revcomp if needed.. (I use Emboss revseq)
