neurosnap.constants package#

Domain-organized constants used throughout Neurosnap.

class neurosnap.constants.AARecord(code, abr, name, standard_equiv_abr)[source]#

Bases: object

abr: str#
code: Optional[str]#
name: str#
standard_equiv_abr: Optional[str]#
class neurosnap.constants.AARecordTable(records)[source]#

Bases: object

Indexed lookup wrapper for a single amino-acid record table.

The table preserves the input record order for iteration while also exposing direct lookups by one-letter code, three-letter/CCD abbreviation, and full residue name.

__init__(records)[source]#

Build indexed lookups for a single amino-acid record table.

Parameters:

records (List[AARecord]) – Ordered amino-acid records to include in the table.

__iter__()[source]#

Iterate records in their original table order.

Returns:

Iterator over AARecord objects.

get_by_abr(abr)[source]#

Look up a record by residue abbreviation.

Parameters:

abr (str) – Three-letter or CCD-style residue abbreviation.

Return type:

Optional[AARecord]

Returns:

Matching AARecord, or None when the abbreviation is absent.

get_by_code(code)[source]#

Look up a record by one-letter amino-acid code.

Parameters:

code (str) – One-letter residue code.

Return type:

Optional[AARecord]

Returns:

Matching AARecord, or None when the code is absent.

get_by_name(name)[source]#

Look up a record by full residue name.

Parameters:

name (str) – Full residue name.

Return type:

Optional[AARecord]

Returns:

Matching AARecord, or None when the name is absent.

get_canonical_record(record_or_abr)[source]#

Resolve a record or abbreviation to its canonical-table record.

Parameters:

record_or_abr (Union[str, AARecord]) – Either an AARecord instance already associated with this table family, or a residue abbreviation to resolve against the table.

Return type:

Optional[AARecord]

Returns:

The canonical-table AARecord when one can be determined. If the supplied record is already present in this table, that record is returned unchanged. Returns None when the residue is unknown to the table or does not declare a standard parent that exists in this table.

get_standard_record(record_or_abr)[source]#

Resolve a record or abbreviation to its standard parent record.

Parameters:

record_or_abr (Union[str, AARecord]) – Either an AARecord instance or a residue abbreviation to resolve.

Return type:

Optional[AARecord]

Returns:

The standard-parent AARecord when one can be determined. Returns the input record unchanged when it is already a standard amino acid. Returns None when the residue is unknown or has no standard parent mapping.

items()[source]#

Return abbreviation-keyed record pairs.

Returns:

A dynamic view of (abr, record) pairs for the table.

values()[source]#

Return the records keyed by residue abbreviation.

Returns:

A dynamic view of the table’s AARecord objects.

Submodules#