#!/usr/bin/env python3
import argparse

from furious_fastas.parse.species2uniprot import parse
from furious_fastas.update.plgs import update_plgs
from furious_fastas.update.peaks import update_peaks

if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description='Update the fasta databases.')
    parser.add_argument("db_path",
        help="Path to the folder treated as database.")
    parser.add_argument("species2url_path",
        help="Path to the file mapping species names to urls.")
    parser.add_argument("db_format",
        help="peaks or plgs.",
        choices=['plgs', 'peaks'])
    a = parser.parse_args()
    update = {'plgs': update_plgs,
              'peaks': update_peaks}[a.db_format]
    update(db_path=a.db_path,
           species2url=parse(a.species2url_path))