configuration¶
Options to run MacSyFinder can be specified in a Configuration file. The API described below handles all configuration options for MacSyFinder.
The macsypy.config.MacsyDefaults
hold the default values for macsyfinder whereas
the macsypy.config.Config
hold the values for a macsyfinder run.
Config¶
-
class
macsypy.config.
Config
(defaults, parsed_args)[source]¶ Handle configuration values for macsyfinder. This values come from default and ar superseded by the configuration files, then the command line settings.
-
__init__
(defaults, parsed_args)[source]¶ Store macsyfinder configuration options and propose an interface to access to them.
The config object is populated with the defaults then superseded with the value specified in configuration files and finally by the options set on the command line.
- Parameters
defaults (a
MacsyDefaults
object) –parsed_args (a
argspace.Namescape
object) – the command line arguments parsed
-
__weakref__
¶ list of weak references to the object (if defined)
-
_config_file_2_dict
(defaults, files, previous_run=False)[source]¶ parse config files files, the last one have precedence on the previous on so on, and return a dict with properties, values. The defaults is just used to know the type of the properties and cast them. It is not used to fill the dict with default values.
- Parameters
defaults (a
macsypy.config.MacsyDefaults
object) – the macsyfinder defaults valuefiles (list of string) – the configuration files to parse
- Returns
dict
-
_set_db_type
(value)[source]¶ set value for ‘db_type’ option
- Parameters
value (str) – the value for db_type, allowed values are : ‘ordered_replicon’, ‘gembase’, ‘unordered’
- Raises
ValueError – if value is not allowed
-
_set_inter_gene_max_space
(value)[source]¶ set value for ‘inter_gene_max_space’ option
- Parameters
value (str) – the string parse representing the model fully qualified name and it’s associated value and so on the model_fqn is a string, the associated value must be cast in int
- Raises
ValueError – if value is not well formed
-
_set_max_nb_genes
(value)[source]¶ set value for ‘max_nb_genes’ option
- Parameters
value (str) – the string parse representing the model fully qualified name and it’s associated value and so on the model_fqn is a string, the associated value must be cast in int
- Raises
ValueError – if value is not well formed
-
_set_min_genes_required
(value)[source]¶ set value for ‘min_genes_required’ option
- Parameters
value (str) – the string parse representing the model fully qualified name and it’s associated value and so on the model_fqn is a string, the associated value must be cast in int
- Raises
ValueError – if value is not well formed
-
_set_min_mandatory_genes_required
(value)[source]¶ set value for ‘min_mandatory_genes_required’ option
- Parameters
value (str) – the string parse representing the model fully qualified name and it’s associated value and so on the model_fqn is a string, the associated value must be cast in int
- Raises
ValueError – if value is not well formed
-
_set_models
(value)[source]¶ - Parameters
value –
The models to search as return by the command line parsing or the configuration files
- if value come from command_line
[[‘model1’, ‘def1’, ‘def2’, ‘def3’], [‘model2’, ‘def4’], …]
- if value come from config file
[(‘set_1’, ‘T9SS, T3SS, T4SS_typeI’), (‘set_2’, ‘T4P’)] [(model_family, [def_name1, …]), … ]
-
_set_models_dir
(path)[source]¶ - Parameters
path (str) – the path to the models (definitions + profiles) are stored.
-
_set_multi_loci
(value)[source]¶ - Parameters
value (str) – the models fqn list separated by comma of multi loc models
-
_set_replicon_topology
(value)[source]¶ set the default replicon topology
- Parameters
value (str) – ‘circular’ or ‘linear’
-
_set_sequence_db
(path)[source]¶ - Parameters
path (str) – set the path to the sequence file (in fasta format) to analysed
-
_set_topology_file
(path)[source]¶ test if the path exists and set it in config
- Parameters
path (str) – the path to the topology file
-
_str_2_tuple
(value)[source]¶ transform a string with syntax {model_fqn int} in list of tuple
- Parameters
value (str) – the string to parse
- Returns
- Return type
[(model_fqn, int), ..]
-
hmmer_dir
()[source]¶ - Returns
The name of the directory containing the hmmsearch results (output, error, parsing)
-
inter_gene_max_space
(model_fqn)[source]¶ - Parameters
model_fqn (str) – the model fully qualifed name
- Returns
the gene_max_space for the model_fqn or None if it’s does not specify
- Return type
int or None
-
max_nb_genes
(model_fqn)[source]¶ - Parameters
model_fqn (str) – the model fully qualifed name
- Returns
the max_nb_genes for the model_fqn or None if it’s does not specify
- Return type
int or None
-
min_genes_required
(model_fqn)[source]¶ - Parameters
model_fqn (str) – the model fully qualifed name
- Returns
the min_genes_required for the model_fqn or None if it’s does not specify
- Return type
int or None
-
min_mandatory_genes_required
(model_fqn)[source]¶ - Parameters
model_fqn (str) – the model fully qualifed name
- Returns
the min_mandatory_genes_required for the model_fqn or None if it’s does not specify
- Return type
int or None
-
multi_loci
(model_fqn)[source]¶ - Parameters
model_fqn (str) – the model fully qualified name
- Returns
True if the model is multi loci, False otherwise
- Return type
bool
-
-
class
macsypy.config.
MacsyDefaults
(**kwargs)[source]¶ Handle all default values for macsyfinder. the default values must be defined here, NOT in argument parser nor in config the argument parser or config must use a MacsyDefaults object
-
__init__
(**kwargs)[source]¶ - Parameters
kwargs – allow to overwrite a default value. It mainly used in unit tests
To define a new default value just add an attribute with the default value
-
__weakref__
¶ list of weak references to the object (if defined)
-