Exemplo n.º 1
0
def cli(genome, database, **kwargs):
    """Add a strain GENOME to the wgMLST DATABASE."""

    try:

        with pymlst.open_wg(os.path.abspath(database)) as mlst:
            mlst.add_strain(genome, **utils.clean_kwargs(kwargs))

    except exceptions.PyMLSTError as err:
        raise click.ClickException(str(err))
Exemplo n.º 2
0
def cli(database, **kwargs):
    """Extract an strains list from a wgMLST DATABASE."""

    tab_kwargs,out_kwargs = utils.get_output(utils.clean_kwargs(kwargs))

    try:

        with pymlst.open_wg(os.path.abspath(database)) as mlst:
            mlst.extract(StrainExtractor(**tab_kwargs), **out_kwargs)

    except exceptions.PyMLSTError as err:
        raise click.ClickException(str(err))
Exemplo n.º 3
0
def cli(database, **kwargs):
    """Compute Multiple Sequence Alignment from a wgMLST DATABASE."""

    seq_kwargs, out_kwargs = utils.get_output(utils.clean_kwargs(kwargs))

    try:

        with pymlst.open_wg(os.path.abspath(database)) as mlst:
            mlst.extract(MsaExtractor(**seq_kwargs), **out_kwargs)

    except exceptions.PyMLSTError as err:
        raise click.ClickException(str(err))
Exemplo n.º 4
0
def cli(database, force, **kwargs):
    """Create a wgMLST DATABASE from a template COREGENE."""

    try:

        if os.path.exists(database):
            if force:
                open(database, "w").close()
            else:
                raise exceptions.PyMLSTError(
                    "Database alreadly exists, use --force to override it")

        with pymlst.open_wg(os.path.abspath(database)) as mlst:
            mlst.create(**utils.clean_kwargs(kwargs))

    except exceptions.DuplicatedGeneSequence as err:
        raise click.UsageError('{}, use -c or -r options to manage it'.format(
            str(err)))
    except exceptions.PyMLSTError as err:
        raise click.UsageError(str(err))