#
# Arguments: a scaffold id and a directory to put output files in
mysql -u test -ptest genomics_test -B -e "select Orf2Ec.orfId, Orf2Ec.ecNum, score, identity, AutoAnno.evalue keggE, TIGRInfo.ec, InterPro.evalue iprE from Orf2Ec, AutoAnno, InterPro, TIGRInfo WHERE Orf2Ec.scaffoldId = $1 AND AutoAnno.db=\"KEGG\" AND AutoAnno.orfId = Orf2Ec.orfId AND InterPro.orfId=Orf2Ec.orfId AND InterPro.domainId=TIGRInfo.tigrId AND TIGRInfo.ec=Orf2Ec.ecNum group by Orf2Ec.orfId;" > $2/TIGRec
mysql -u test -ptest genomics_test -B -e "select AutoAnno.orfId, identity, evalue, score,ecNum from Orf2Ec, AutoAnno WHERE Orf2Ec.scaffoldId = $1 AND Orf2Ec.orfId = AutoAnno.orfId AND AutoAnno.db=\"KEGG\" group by Orf2Ec.orfId;" > $2/KEGGec
~/utils/join.pl -match 1.ecNum=2.ec $2/KEGGec $2/tigrECs > $2/KEGGec2 # KEGG assignments in categories covered by TIGR
~/utils/join.pl -match 1.orfId=2.orfId -only 1 $2/KEGGec2 $2/TIGRec > $2/TIGRec3 # KEGG assignments not made by TIGR in those categories
