LOR.validate_prefix

LOR.validate_prefix(prefix)[source]

Validates and standardises a PRIDE/LOR code prefix.

If the provided prefix is not found in the list of valid prefixes, an attempt is made to find the closest matching valid prefix. If no match is found, an error is raised.

Parameters:

prefix (str) – The PRIDE/LOR code prefix to validate.

Raises:

AssertionError – If the prefix is not a valid PRIDE/LOR prefix.

Returns:

A validated and standardised uppercase prefix.

Return type:

str

Examples:

>>> from pyrcs.line_data import LOR  # from pyrcs import LOR
>>> lor = LOR()
>>> lor.validate_prefix(prefix='cy')
'CY'
>>> lor.validate_prefix(prefix='ca')
Traceback (most recent call last):
    ...
AssertionError: `prefix` must be one of ['CY', 'EA', 'GW', 'LN', 'MD', 'NW', 'NZ', ...