# utils

Here some useful functions in the rest of macsyfinder code

## utils API reference

## get_def_to_detect

macsypy.utils.get_def_to_detect(models: list[tuple[str, tuple[str]]], model_registry: ModelRegistry) → tuple[list[DefinitionLocation], str, str]
  Parameters:

    - models (list of tuple with the following structure: [('model_fqn', ('def1, def2, ...)), ('model_2', ('def1', ...)), ...]) – the list of models to detect as returned by config.models.

    - model_registry – the models registry for this run.

  Returns:

    the definitions to parse

  Raises:

    ValueError – if a model name provided in models is not in model_registry.

## get_replicon_names

macsypy.utils.get_replicon_names(genome_path, db_type) → list[str]

## threads_available

macsypy.utils.threads_available() → int
  Returns:

    The maximal number of threads available. It’s nice with cluster scheduler or linux. On Mac it uses the number of physical cores

## parse_time

macsypy.utils.parse_time(user_time: int | str) → int

  parse user-friendly time and return it in seconds user time supports units as s h m d for sec min hour day or a combination of them 1h10m50s means 1 hour 10 minutes 50 seconds all terms will be converted in seconds and added

  Parameters:

    user_time

  Returns:

    seconds

  Raise:

    ValueError if user_time is not parseable

Fork me on GitHub