minorg.parse_config module
- class minorg.parse_config.Lookup(name=None, alias_description='alias', value_description='value', param_set=None, param_sets=None, param_alias=None, param_inpt=None, config_sets: Optional[str] = None, config_aliases=None, fname_set=None, none=None, multikey=True, multiline=True, inverse=False, **parse_kwargs)[source]
Bases:
object
- class minorg.parse_config.Param(default, *names, false_true=('False', 'True'), show_any_default=True, description=None, alias_value_description=None, help_subcmd={}, **kwargs)[source]
Bases:
object
- minorg.parse_config.get_val_default(val, default=None, coerce=None)[source]
If val is empty (None or empty iterable), return default.
- minorg.parse_config.get_val_none(val, d: dict, none=None)[source]
Attempt to retrieve value of key-value pair in ‘d’ if val in d.keys(). Failing that, if val is not ‘’ (empty string), return val. Else, return None
- minorg.parse_config.inverse_dict(d: dict)[source]
Converts {<k1>:<v1>, <k2>:<v1>, <k3>:<v2>} into {<v1>:[<k1>,<k2>], <v2>:[<k3>]}
- minorg.parse_config.parse_attr_mod_sdict(s: str, attr_sep: str = ',', feature_sep: str = ';', fa_sep: str = ':', alias_sep: str = '=')[source]
Parse attribute modifications from string to dictionary.
- Parameters
s (str) – required, string of attribute modifications in format ‘<feature type>:<standard attribute field name>=<nonstandard attribute field name>,<standard attribute field name>=<nonstandard attribute field name>;<feature type>:<standard attribute field name>=<nonstandard attribute field name>’ (e.g. ‘mRNA:Parent=Locus_id’)
attr_sep (str) – delimiter for attribute modifications of same feature type (default=’,’)
feature_sep (str) – delimiter for feature types (default=’;’)
fa_sep (str) – delimiter between feature type and attribute modifications (default=’:’)
alias_sep (str) – delimiter between standard attribute field name and non-standard attribute field name (default=’=’)
- Returns
- parsed attribute modifications in format
{<feature>: {<standard attribute field name>: <nonstandard attribute field name>}}
- Return type
dict
- minorg.parse_config.parse_multiline_inv_sdict(s: str, v_sep: str = ',', **kwargs)[source]
Converts raw ‘<key>:<v1>,<v2>,…,<v5>’ string into {‘<v1>’:’<key>’,’<v2>’:’<key>’, …,’<v5>’:’<key>’} dict.