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, model_registry)[source]
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 (macsypy.registries.ModelRegistry object.) – the models registry for this run.

Returns

the definitions to parse

Return type

list of macsypy.registries.DefinitionLocation objects

Raises

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

get_replicon_names

macsypy.utils.get_replicon_names(genomee_path, db_type)[source]

threads_available

macsypy.utils.threads_available()[source]
Returns

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

Return type

int

parse_time

macsypy.utils.parse_time(user_time)[source]

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 (int or str) –

Returns

seconds

Return type

int

Raise

ValueError if user_time is not parseable