Utils

Utils

General functions.


Classes:

Config

Config contains the parameters related to specific alignment file.

Configs

Configs contains the parameters related to config file.

Functions:

get_results_dir([config_file, results_dir])

Helper function that gets the results directory from either the config file or the results directory directly.

make_configs(config_file[, log_port, ...])

Create an instance of Configs from a config file

remove_directory(path[, missing_ok])

Remove everything in a directory

run_PMD(config)

Run the PMD command from metaDMG-cpp and output the result to the gzipped txt_out

split_string(s)

Split a string by comma, space, or both.

class metaDMG.utils.Config[source]

Config contains the parameters related to specific alignment file.

class metaDMG.utils.Configs[source]

Configs contains the parameters related to config file. Inherits from dict. Implements iterations.

Methods:

check_number_of_jobs()

Compare the number of configs to the number of parallel_samples used.

get_first()

Get the first config

get_nth(n)

Gets the n'th config

check_number_of_jobs()[source]

Compare the number of configs to the number of parallel_samples used.

Return type

None

get_first()[source]

Get the first config

Returns

A single configuration

Return type

Config

get_nth(n)[source]

Gets the n’th config

Parameters

n (int) – The index

Returns

A single configuration

Return type

Config

metaDMG.utils.get_results_dir(config_file=None, results_dir=None)[source]

Helper function that gets the results directory from either the config file or the results directory directly.

Parameters
  • config_file (Optional[Path]) – Config file, by default None

  • results_dir (Optional[Path]) – Results directory, by default None

Return type

Path to the results directory

Raises

AssertionError – If both config file and results directory are set, raise error

metaDMG.utils.make_configs(config_file, log_port=None, log_path=None, force=False)[source]

Create an instance of Configs from a config file

Parameters
  • config_file (Optional[Path]) – The config file to load

  • log_port (Optional[int]) – Optional log port, by default None

  • log_path (Optional[str]) – Optional log path, by default None

  • force (bool) – Whether or not the computations are force, by default False

Return type

An instance of Configs

Raises

typer.Abort – If not a proper config file

metaDMG.utils.remove_directory(path, missing_ok=False)[source]

Remove everything in a directory

Parameters

path (Union[Path, str]) – Directory to be deleted

Return type

None

metaDMG.utils.run_PMD(config)[source]

Run the PMD command from metaDMG-cpp and output the result to the gzipped txt_out

Parameters
  • alignment_file – Alignment file to compute the PMD scores on

  • txt_out – The (gzipped) output txt file

metaDMG.utils.split_string(s)[source]

Split a string by comma, space, or both.

Parameters

s (str) – Input string

Return type

List of strings