Mapping classes of Ursgal


class ursgal.umapmaster.UParamMapper(*args, **kwargs)

UParamMapper class offers interface to ursgal.uparams

Be default, the ursgal.uparams are parsed and the UParamMapper class is set with the ursgal_params dictionary.


Lists all uparams and the fields specified in the mask

For example:

upapa.get_masked_params( mask = ['uvalue_type']) will return::
        '-xmx' : {
            'uvalue_type' : "str",
        'aa_exception_dict' : {
            'uvalue_type' : "dict",

Parses self.items() and build up lookups. Additionally, consistency check is performed to guarantee that each engine is mapping only on one style.

The lookup build and returned looks like:

lookup = {
    'style_2_engine' : {
        'xtandem_style_1' : [
        'omssa_style_1' ...
    # This is done during uNode initializations
    # each unode will register its style with umapmaster
    'engine_2_style' : {
        'xtandem_sledgehamer' : 'xtandem_style_1', ...
    'engine_2_params' : {
        'xtandem_sledgehamer' : [ uparam1, uparam2, ...], ...
    'style_2_params' : {
        'xtandem_style_1' : [ uparam1, uparam2, ... ], ...
    'params_triggering_rerun' : {
        'xtandem_style_1' : [ uparam1, uparam2 .... ]

yields all mapping dicts


class ursgal.umapmaster.UPeptideMapper(word_len=None)

UPeptideMapper class offers ultra fast peptide to sequence mapping using a fast cache, hereafter referred to fcache.

The fcache is build using the build_lookup_from_file or build_lookup functions. The fcache can be queried using the UPeptideMapper.map_peptide() function.


The UPeptideMapper is initialized during UNode instantiation thus all UNodes can access the mapper via self.upeptide_mapper.


Ursgal keeps one upeptide_mapper alive during code execution and because the fcache requires a significant amount of memory, it is recommended that the user takes care of purging the mapper if not needed anymore, using the UPeptideMapper.purge_fasta_info() function.

build_lookup(fasta_name=None, fasta_stream=None, force=True)

Builds the fast cache and regular sequence dict from a fasta stream

build_lookup_from_file(path_to_fasta_file, force=True)

Builds the fast cache and regular sequence dict from a fasta stream

return the internal fasta name, i.e. dirs stripped away from the path

map_peptide(peptide=None, fasta_name=None, force_regex=False)

Maps a peptide to a fasta database.

Returns a list of single hits which look for example like this:

    'start' : 12,
    'end'   : 18,
    'id'    : 'Protein Id passed to the function',
    'pre'   : 'A',
    'post'  : 'V',

Purges regular sequence lookup and fcache for a given fasta_name

word_len = None

Ultimately this will be passed over by the wrapper if this class is its own standalone script / UNode