scripts
The are 4 entry points.
macsyfinder: which is the main script
macsydata: which allow to manage the models (command name msf_data)
macsyconfig: an interactive conversational utility to generate macsyfinder configuration file (command name msf_config)
macsyprofile: an utility dedicated to modelers which gather information about hmmer output (command name msf_profile)
API reference
macsyfinder
Main entrypoint to macsyfinder
- macsyfinder.scripts.msf.alarm_handler(signum: Signals, frame) None[source]
Handle signal alarm flush loggers :param signum: :param frame: :raise: Timeout
- macsyfinder.scripts.msf.list_models(args: Namespace) str[source]
- Parameters:
args – The command line argument once parsed
- Returns:
a string representation of all models and submodels installed.
- macsyfinder.scripts.msf.main(args: list[str] | None = None, loglevel: Literal['NOTSET', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] | int | None = None)[source]
main entry point to MacSyFinder do some check before to launch
main_search_systems()which is the real function that perform a search- Parameters:
args – the arguments passed on the command line without the program name
loglevel – the output verbosity
macsydata
wrapper to macsylib.macsydata
macsyconfig
Entrypoint for macsyconfig command which generate a MacSyFinder config file
- class macsyfinder.scripts.macsyconfig.ConfigParserWithComments(defaults=None, dict_type=<class 'dict'>, allow_no_value=False, *, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section='DEFAULT', interpolation=<object object>, converters=<object object>, allow_unnamed_section=False)[source]
Extend ConfigParser to allow comment in serialization
- add_comment(section: str, option: str, comment: str, comment_nb: int = count(1), add_space_before: bool = False, add_space_after: bool = True) None[source]
Write a comment in .ini-format (start line with #)
- Parameters:
section – the name of the section
option – the name of the option
comment – the comment linked to this option
comment_nb – the identifier of the comment by default an integer
add_space_before
add_space_after
- class macsyfinder.scripts.macsyconfig.Theme(ERROR: str = '\x1b[1m\x1b[31m', WARN: str = '\x1b[33m', SECTION: str = '\x1b[35m', RESET: str = '\x1b[0m', RETRY: str = '\x1b[33m', QUESTION: str = '\x1b[32m', EMPHASIZE: str = '\x1b[1m', EXPLANATION: str = '\x1b[0m', DEFAULT: str = '\x1b[1m\x1b[32m')[source]
Handle color combination to highlight interactive question
- __delattr__(name)
Implement delattr(self, name).
- __eq__(other)
Return self==value.
- __hash__()
Return hash(self).
- __init__(ERROR: str = '\x1b[1m\x1b[31m', WARN: str = '\x1b[33m', SECTION: str = '\x1b[35m', RESET: str = '\x1b[0m', RETRY: str = '\x1b[33m', QUESTION: str = '\x1b[32m', EMPHASIZE: str = '\x1b[1m', EXPLANATION: str = '\x1b[0m', DEFAULT: str = '\x1b[1m\x1b[32m') None
- __repr__()
Return repr(self).
- __setattr__(name, value)
Implement setattr(self, name, value).
- __weakref__
list of weak references to the object
- macsyfinder.scripts.macsyconfig._validator(cast_func: Callable, raw: Any, default: Any, sequence: bool = False) Any[source]
- Parameters:
cast_func – the function which will cast the raw value
raw – the raw value
default – the default value
sequence – True if the value is a sequence, False otherwise
- Returns:
The cast Value
- Raises:
MacsypyError – if the raw value cannot be cast
- macsyfinder.scripts.macsyconfig.ask(question: str, validator: Callable, default: Any = None, expected: Any = None, explanation: str = '', sequence: bool = False, question_color: str | None = None, retry: int = 2)[source]
ask a question on the terminal and return the user response check if the user response is allowed (right type, among allowed values, …)
- Parameters:
question – The question to prompt to the user on the terminal
validator – what validator to be used to check the user response
default – the default value
expected – the values allowed (can be a list of value
explanation – some explanation about the option
sequence – True if the parameter accept a sequence of value (comma separated values)
question_color – the color of the question display to the user
retry – The number of time to repeat the question if the response is rejected
- Returns:
the value casted in right type
- macsyfinder.scripts.macsyconfig.check_bool(raw: str, default: bool, expected, sequence: bool = False) bool[source]
Check if value can be cast in str
- Parameters:
raw – the value return by the user
default – the default value for the option
expected – not used here to have the same signature for all check_xxx functions
- Returns:
value
- Raises:
MacsypyError – if the value cannot be cast in right type
- macsyfinder.scripts.macsyconfig.check_choice(raw: str, default: str, expected: list[str], sequence: bool = False) str[source]
Check if value is in list of expected values
- Parameters:
raw – the value return by the user
default – the default value for the option
expected – the allowed values for this option
sequence – True if parameter accept a sequence of value, False otherwise
- Returns:
value
- Raises:
MacsypyError – if the value cannot be cast in right type
- macsyfinder.scripts.macsyconfig.check_dir(raw: str, default: str, expected, sequence: bool = False) str[source]
Check if value point to a directory
- Parameters:
raw – the value return by the user
default – the default value for the option
expected – not used here to have the same signature for all check_xxx functions
- Returns:
value
- Raises:
MacsypyError – if the value cannot be cast in right type
- macsyfinder.scripts.macsyconfig.check_exe(raw: str, default: str, expected, sequence: bool = False) str[source]
Check if value point to an executable
- Parameters:
raw – the value return by the user
default – the default value for the option
expected – not used here to have the same signature for all check_xxx functions
- Returns:
value
- Raises:
MacsypyError – if the value cannot be cast in right type
- macsyfinder.scripts.macsyconfig.check_file(raw: str, default: str, expected, sequence: bool = False) str[source]
Check if value point to a file
- Parameters:
raw – the value return by the user
default – the default value for the option
expected – not used here to have the same signature for all check_xxx functions
- Returns:
value
- Raises:
MacsypyError – if the value cannot be cast in right type
- macsyfinder.scripts.macsyconfig.check_float(raw: str, default: float, expected, sequence: bool = False) float[source]
Check if value can be cast in float
- Parameters:
raw – the value return by the user
default – the default value for the option
expected – not used here to have the same signature for all check_xxx functions
- Returns:
value
- Raises:
MacsypyError – if the value cannot be cast in right type
- macsyfinder.scripts.macsyconfig.check_positive_int(raw: str, default: int, expected, sequence: bool = False) int[source]
Check if value can be cast in integer >=0
- Parameters:
raw – the value return by the user
default – the default value for the option
expected – not used here to have the same signature for all check_xxx functions
- Returns:
value
- Raises:
MacsypyError – if the value cannot be cast in right type
- macsyfinder.scripts.macsyconfig.check_str(raw: str, default: str, expected, sequence: bool = False) str[source]
Check if value can be cast in str
- Parameters:
raw – the value return by the user
default – the default value for the option
expected – not used here to have the same signature for all check_xxx functions
- Returns:
value
- Raises:
MacsypyError – if the value cannot be cast in right type
- macsyfinder.scripts.macsyconfig.epilog(path: str) str[source]
- Returns:
the text to the user before to start the configuration
- macsyfinder.scripts.macsyconfig.main(args: list[str] | None = None) None[source]
The main entrypoint of the script
- Parameters:
args – the command line arguments.
- macsyfinder.scripts.macsyconfig.parse_args(args: list[str], color: bool = True) Namespace[source]
parse command line
- Parameters:
args – the command line arguments
- Returns:
- macsyfinder.scripts.macsyconfig.prolog() str[source]
- Returns:
the text displayed to the user when the configuration file is generated
- macsyfinder.scripts.macsyconfig.serialize(config: ConfigParserWithComments, path: str) None[source]
save the configuration on file
- Parameters:
config – the config to save
path (str) – where to store the configuration
- macsyfinder.scripts.macsyconfig.set_base_options(config: ConfigParserWithComments, defaults: MacsyDefaults, use_defaults: bool = False) None[source]
Options for base section
- Parameters:
config – The config to setup
defaults – the macsyfinder defaults values
use_defaults (bool) – If True do not ask any question use the defaults values
- macsyfinder.scripts.macsyconfig.set_general_options(config: ConfigParserWithComments, defaults: MacsyDefaults, use_defaults: bool = False) None[source]
Options for general section
- Parameters:
config – The config to setup
defaults – the macsyfinder defaults values
use_defaults (bool) – If True do not ask any question use the defaults values
- macsyfinder.scripts.macsyconfig.set_hmmer_options(config: ConfigParserWithComments, defaults: MacsyDefaults, use_defaults: bool = False) None[source]
Options for hmmer section
- Parameters:
config – The config to setup
defaults – the macsyfinder defaults values
use_defaults (bool) – If True do not ask any question use the defaults values
- macsyfinder.scripts.macsyconfig.set_path_options(config: ConfigParserWithComments, defaults: MacsyDefaults, use_defaults: bool = False) None[source]
Options for directories section
- Parameters:
config – The config to setup
defaults – the macsyfinder defaults values
use_defaults (bool) – If True do not ask any question use the defaults values
- macsyfinder.scripts.macsyconfig.set_score_options(config: ConfigParserWithComments, defaults: MacsyDefaults, use_defaults: bool = False) None[source]
Options for scoring section
- Parameters:
config – The config to setup
defaults – the macsyfinder defaults values
use_defaults (bool) – If True do not ask any question use the defaults values
- macsyfinder.scripts.macsyconfig.set_section(sec_name: str, options: dict[slice(<class 'str'>, typing.Any, None)], config: ~macsyfinder.scripts.macsyconfig.ConfigParserWithComments, defaults: ~macsylib.config.MacsyDefaults, use_defaults: bool = False) ConfigParserWithComments[source]
iter over options of a section ask question for each option and set this option in the config
- Parameters:
sec_name – the name of the section
options – a dictionnary with the options to set up for this section
config – The config to fill in.
defaults – the macsyfinder defaults values
use_defaults – The user skip this section so use defaults to set in config object
- Returns:
configuration
macsyprofile
wrapper to macsylib.macsyprofile