Skip to content

crispr_analysis_utils.guide_alignment.sites

crispr_analysis_utils.guide_alignment.sites

One genomic site of a guide, as the scan reports it.

NO_PAM_CLASS module-attribute

NO_PAM_CLASS = 'none'

The Site.pam_class of a site whose genomic PAM matches no pattern.

Site dataclass

One genomic site of a guide, as verified against the reference.

Attributes:

  • guide_id (str) –

    The guide's id.

  • chr (str) –

    The contig.

  • start (int) –

    The first base of the protospacer, 0-based.

  • end (int) –

    One past the last base of the protospacer: the protospacer is [start, end).

  • strand (str) –

    + or -: the strand the protospacer reads 5' to 3' on.

  • pam (str) –

    The genomic PAM, uppercased, in guide orientation.

  • pam_class (str) –

    The first pattern the genomic PAM matches, trying the PAM and then any alternatives in their order, or none. A genomic N matches only an N of the pattern.

  • n_mismatches (int) –

    The mismatches between the spacer and the genomic protospacer. A genomic N counts as one; the added G never counts.

  • mismatch_positions (tuple[int, ...]) –

    The 1-based spacer positions of those mismatches, counted from the guide's 5' end.

  • mapped_sequence (str) –

    What was aligned here, 5' to 3': the base 5' of the protospacer where the genome has that same base, the protospacer, then the genomic PAM.

  • genomic_protospacer (str) –

    The reference bases of the protospacer, uppercased, in guide orientation.

  • genomic_5p_base (str | None) –

    The genomic base under the sequence's base 5' of the protospacer, in guide orientation; None when it has none.

Source code in src/crispr_analysis_utils/guide_alignment/sites.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
@dataclass(frozen=True)
class Site:
    """One genomic site of a guide, as verified against the reference.

    Attributes
    ----------
    guide_id
        The guide's id.
    chr
        The contig.
    start
        The first base of the protospacer, 0-based.
    end
        One past the last base of the protospacer: the protospacer is
        ``[start, end)``.
    strand
        ``+`` or ``-``: the strand the protospacer reads 5' to 3' on.
    pam
        The genomic PAM, uppercased, in guide orientation.
    pam_class
        The first pattern the genomic PAM matches, trying the PAM and then any
        alternatives in their order, or ``none``. A genomic ``N`` matches only
        an ``N`` of the pattern.
    n_mismatches
        The mismatches between the spacer and the genomic protospacer. A
        genomic ``N`` counts as one; the added G never counts.
    mismatch_positions
        The 1-based spacer positions of those mismatches, counted from the
        guide's 5' end.
    mapped_sequence
        What was aligned here, 5' to 3': the base 5' of the protospacer where
        the genome has that same base, the protospacer, then the genomic PAM.
    genomic_protospacer
        The reference bases of the protospacer, uppercased, in guide
        orientation.
    genomic_5p_base
        The genomic base under the sequence's base 5' of the protospacer, in
        guide orientation; None when it has none.
    """

    guide_id: str
    chr: str
    start: int
    end: int
    strand: str
    pam: str
    pam_class: str
    n_mismatches: int
    mismatch_positions: tuple[int, ...]
    mapped_sequence: str
    genomic_protospacer: str
    genomic_5p_base: str | None