smftools.informatics.reference_identity

Contents

smftools.informatics.reference_identity#

Canonical, name-independent reference identity via sequence hashing.

Different experiments sometimes name the same locus differently across FASTAs. A sequence hash gives a stable reference_uid that is identical whenever the underlying (unpadded, uppercased) reference sequence is identical, regardless of the FASTA record name -- so the project layer can harmonize references automatically. Near-identical (not byte-identical) references are handled separately by manual aliases in the project reference_registry.yaml.

Functions

reference_uid(sequence[, length])

Return a canonical sequence-identity hash for a reference.

smftools.informatics.reference_identity.reference_uid(sequence, length=None)#

Return a canonical sequence-identity hash for a reference.

Parameters:
  • sequence (str) -- The reference sequence (may include trailing padding).

  • length (int | None (default: None)) -- If given, the true unpadded length; the sequence is trimmed to it before hashing so per-experiment padding does not change the uid.

Return type:

str

Returns:

A short hex digest (name-independent) identifying the sequence.