Skip to content

fasta_lake.entrapment_classes#

fasta_lake.entrapment_classes #

Entrapment control metadata with explicit interpretation limits.

Control membership does not establish absence or exchangeability. Construction matches are diagnostics unless a defensible estimator and counting-level ratio are supplied. Source FASTAs must be provided explicitly for copied controls.

EntrapmentClass dataclass #

One entrapment class and everything needed to interpret its FDP.

Source code in fasta_lake/entrapment_classes.py
@dataclass(frozen=True)
class EntrapmentClass:
    """One entrapment class and everything needed to interpret its FDP."""

    name: str
    prefix: str
    generation: str  # 'shuffle' (derive from target) or 'copy' (tag a source FASTA)
    difficulty: str
    estimates: str
    description: str
    caveat: str
    default_source: str | None = None
    requires_source: bool = False
    is_definitional_null: bool = False
    recommended_headline: bool = False
    poolable: bool = True

    def as_metadata(self) -> dict:
        """Serialisable metadata for embedding in an FDP report."""
        return asdict(self)

as_metadata #

as_metadata() -> dict

Serialisable metadata for embedding in an FDP report.

Source code in fasta_lake/entrapment_classes.py
def as_metadata(self) -> dict:
    """Serialisable metadata for embedding in an FDP report."""
    return asdict(self)

get_class #

get_class(name: str) -> EntrapmentClass

Look up an entrapment class by name.

Source code in fasta_lake/entrapment_classes.py
def get_class(name: str) -> EntrapmentClass:
    """Look up an entrapment class by name."""
    try:
        return ENTRAPMENT_CLASSES[name]
    except KeyError:
        raise ValueError(
            f"Unknown entrapment class {name!r}. Available: {', '.join(sorted(ENTRAPMENT_CLASSES))}"
        ) from None

class_names #

class_names() -> list[str]

Registered class names, preserving the historical display order.

Source code in fasta_lake/entrapment_classes.py
def class_names() -> list[str]:
    """Registered class names, preserving the historical display order."""
    names = sorted(ENTRAPMENT_CLASSES)
    names.remove("shuffled")
    return ["shuffled", *names]