Analytics Module¶
Analysis and visualization tools.
analytics
¶
Typed interaction fingerprints¶
reference_ifp
¶
Typed extraction and comparison of protein--ligand interaction fingerprints.
AtomIdentity
dataclass
¶
Stable atom identity reported for one typed interaction occurrence.
Source code in src/cofolder/modules/analytics/reference_ifp.py
InteractionGeometry
dataclass
¶
Named ProLIF geometry value with an explicit physical unit.
Source code in src/cofolder/modules/analytics/reference_ifp.py
InteractionEvent
dataclass
¶
One atom-level occurrence contributing to a deduplicated interaction key.
Source code in src/cofolder/modules/analytics/reference_ifp.py
InteractionFingerprint
dataclass
¶
Source code in src/cofolder/modules/analytics/reference_ifp.py
serialized_events
¶
Return occurrence-level events in a deterministic JSON-safe form.
InteractionKey
dataclass
¶
Source code in src/cofolder/modules/analytics/reference_ifp.py
IFPExtractionConfig
dataclass
¶
Source code in src/cofolder/modules/analytics/reference_ifp.py
extract_interaction_fingerprint
¶
extract_interaction_fingerprint(
structure_path: Path,
*,
ligand: LigandSelector | None = None,
receptor_chains: Sequence[str] | None = None,
config: IFPExtractionConfig = DEFAULT_IFP_EXTRACTION_CONFIG
) -> InteractionFingerprint
Extract a normalized fingerprint from a PDB or mmCIF complex.
Source code in src/cofolder/modules/analytics/reference_ifp.py
InteractionFingerprint.interactions is the deduplicated residue/type feature set.
InteractionFingerprint.events contains every atom-level ProLIF occurrence. Event
geometry uses Å for distances and degrees for angles. The extractor accepts PDB and
mmCIF paths; mmCIF conversion remains contained in the isolated ProLIF worker.
from pathlib import Path
from cofolder.modules.analytics.reference_ifp import (
IFPExtractionConfig,
IFPTaxonomy,
LigandSelector,
extract_interaction_fingerprint,
)
fingerprint = extract_interaction_fingerprint(
Path("prediction.cif"),
ligand=LigandSelector(chain_id="B"),
receptor_chains=("A",),
config=IFPExtractionConfig(taxonomy=IFPTaxonomy.PROLIF),
)
asp168_backbone_n = [
event
for event in fingerprint.events
if any(
atom.residue_name == "ASP"
and atom.residue_number == 168
and atom.atom_name == "N"
for atom in event.protein_atoms
)
]
Interaction-fingerprint clustering¶
ifp_clustering
¶
Deterministic clustering and summaries for binary interaction fingerprints.
IFPClusteringResult
dataclass
¶
Stable cluster assignments and their audit-ready summary.
Source code in src/cofolder/modules/analytics/ifp_clustering.py
cluster_binary_ifps
¶
cluster_binary_ifps(
fingerprints: Sequence[Sequence[int]],
member_ids: Sequence[str],
*,
similarity_threshold: float
) -> IFPClusteringResult
Cluster compatible binary IFPs using average-linkage Jaccard distance.
Cluster IDs are normalized by the earliest input position, so callers never observe the implementation-specific integer labels returned by SciPy.
Source code in src/cofolder/modules/analytics/ifp_clustering.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
cluster_interaction_fingerprints
¶
cluster_interaction_fingerprints(
fingerprints: Sequence[InteractionFingerprint],
member_ids: Sequence[str],
*,
similarity_threshold: float,
feature_universe: Sequence[InteractionKey] | None = None
) -> IFPClusteringResult
Cluster typed fingerprints through their deterministic binary matrix.