LOR.collect_codes_by_prefix

LOR.collect_codes_by_prefix(prefix, update=False, verbose=False)[source]

Collects the data of PRIDE/LOR codes based on the given prefix.

Parameters:
  • prefix (str) – The prefix of LOR codes to collect.

  • update (bool) – Whether to check for updates to the package data; defaults to False.

  • verbose (bool | int) – Whether to print relevant information to the console; defaults to False.

Returns:

A dictionary containing the LOR codes for the given prefix, or None if no data is available.

Return type:

dict | None

Examples:

>>> from pyrcs.line_data import LOR  # from pyrcs import LOR
>>> lor = LOR()
>>> lor_codes_cy = lor.collect_codes_by_prefix(prefix='CY')
>>> type(lor_codes_cy)
dict
>>> list(lor_codes_cy.keys())
['CY', 'Notes', 'Last updated date']
>>> cy_codes = lor_codes_cy['CY']
>>> type(cy_codes)
pandas.core.frame.DataFrame
>>> cy_codes.head()
     Code  ...                       RA Note
0   CY240  ...           Caerwent branch RA4
1  CY1540  ...  Pembroke - Pembroke Dock RA6
[2 rows x 5 columns]
>>> lor_codes_nw = lor.collect_codes_by_prefix(prefix='NW')
>>> type(lor_codes_nw)
dict
>>> list(lor_codes_nw.keys())
['NW/NZ', 'Notes', 'Last updated date']
>>> nw_codes = lor_codes_nw['NW/NZ']
>>> nw_codes.head()
     Code  ... RA Note
0  NW1001  ...
1  NW1002  ...
2  NW1003  ...
3  NW1004  ...
4  NW1005  ...
[5 rows x 5 columns]
>>> lor_codes_xr = lor.collect_codes_by_prefix(prefix='XR')
>>> type(lor_codes_xr)
dict
>>> list(lor_codes_xr.keys())
['XR', 'Last updated date']
>>> xr_codes = lor_codes_xr['XR']
>>> type(xr_codes)
dict
>>> list(xr_codes.keys())
['Current codes', 'Current codes note', 'Past codes', 'Past codes note']
>>> xr_codes['Past codes'].head()
    Code  ... RA Note
0  XR001  ...
1  XR002  ...
[2 rows x 5 columns]
>>> xr_codes['Current codes'].head()
    Code  ...                     RA Note
0  XR001  ...  Originally reported as RA4
1  XR002  ...  Originally reported as RA4
[2 rows x 5 columns]