parser.add_argument("-a", "--assemblyAccession", required=True)
    parser.add_argument("-mdb", "--mongodbname", required=True)
    parser.add_argument("-mydbtax", "--mysqldbtaxname", default="bioseqdb")
    parser.add_argument("--cpus", default=multiprocessing.cpu_count())
    parser.add_argument("-mydbunip", "--mysqldbunip", default="unipmap")
    parser.add_argument("-myu", "--mysqldbuser", default="root")

    args = parser.parse_args()
    args.cpus = int(args.cpus)
    mdb = BioMongoDB(args.mongodbname)
    tax_db.initialize(
        MySQLDatabase(args.mysqldbtaxname,
                      user=args.mysqldbuser,
                      passwd=args.dbpass))
    ProteinAnnotator.connect_to_db(database=args.mysqldbunip,
                                   user=args.mysqldbuser,
                                   password=args.dbpass)

    assert not mdb.seq_col_exists(
        args.assemblyAccession), "assembly already exists"
    Entrez.email = "*****@*****.**"
    assembly_id = Entrez.read(
        Entrez.esearch(db="assembly", term=args.assemblyAccession,
                       retmax=1))["IdList"][0]
    resource = Entrez.read(
        Entrez.esummary(db="assembly", id=assembly_id, validate=False))
    try:

        data = resource["DocumentSummarySet"]["DocumentSummary"][0]
        name = data["AssemblyName"]
        genome = str(data["SpeciesName"])
Entrez.email = "*****@*****.**"
_log = logging.getLogger(__name__)
if __name__ == "__main__":
    logger = logging.getLogger('peewee')
    logger.setLevel(logging.INFO)
    init_log()

    mdb = BioMongoDB("saureus")
    tax_db.initialize(MySQLDatabase('bioseqdb', user='******', passwd="mito"))
    mysql_db.initialize(MySQLDatabase('sndg', user='******', passwd="mito"))
    assemblies = list(ExternalAssembly.select().where(
        ExternalAssembly.sample_source.is_null(False)))

    ProteinAnnotator.connect_to_db(database="unipmap",
                                   user="******",
                                   password="******")
    with tqdm(assemblies) as pbar:
        for x in pbar:
            if mdb.seq_col_exists(x.assembly_accession):
                continue
            pbar.set_description(x.assembly_accession)
            try:
                dst_dir = "/data/organismos/" + x.assembly_accession + "/annotation/"
                mkdir(dst_dir)
                gbpath = x.download_gbk(dst_dir)
                from_ref_seq(x.assembly_accession,
                             gbpath,
                             tax=x.ncbi_tax,
                             tmp_dir=dst_dir)
    parser.add_argument("-p", "--user_pass", required=True)
    parser.add_argument("-dba", "--db_annotation", default="unipmap")
    parser.add_argument("-dbu", "--user_db", default="root")
    parser.add_argument("-cpu", "--cpu", default="1")

    parser.add_argument("-l", "--log_path", default=None)

    args = parser.parse_args()
    _log = logging.getLogger("protein_annotation")

    if not args.log_path:
        args.log_path = "/tmp/annotation.log"
    init_log(args.log_path, logging.INFO)

    pa = ProteinAnnotator()
    pa.connect_to_db(database=args.db_annotation,
                     user=args.user_db,
                     password=args.user_pass)

    BioMongoDB(args.mongo_db, host=args.mdb_host, port=args.mdb_port)

    if not os.path.exists(args.blast):
        _log.info(args.blast + " does not exists, running blast...")
        if args.fasta:
            assert os.path.exists(args.fasta), args.fasta + " does not exists"
            fasta = args.fasta
        else:
            _log.info("no fasta input, using proteins from the mongo db")
            fasta = tempfile.mktemp()
            with open(fasta, "w") as h: