File Formats
Pharmacon persists every analysis result as a signed, self-describing HDF5
artifact. There are two concrete formats — .pta for trajectory analysis
and .psa for structure analysis — both built on top of the shared
PharmaconHDF5File base class.
Schema version: 1.0
Both formats are plain HDF5 files and can be opened with h5py, h5dump,
HDFView, or any HDF5-aware library. Pharmacon-specific metadata lives in
HDF5 attributes on the root group and on each analysis group.
Common root-level attributes
Every Pharmacon artifact (.pta or .psa) carries the following metadata
block on the root group, written automatically at creation time.
Attribute |
Type |
Meaning |
|---|---|---|
|
str |
Pharmacon version that wrote the file (e.g. |
|
str |
HDF5 layout version ( |
|
str |
|
|
str |
Top-level command (e.g. |
|
str |
Specific subcommand (e.g. |
|
str |
Human-readable one-liner describing the run |
|
str |
ISO-8601 UTC timestamp at which the file was opened for writing |
|
str |
|
|
str |
128-bit BLAKE2b hex digest — tamper-check hint for the identity block |
|
str |
Deterministic hash of the run inputs (topology, selections, flags).
Used by |
|
str |
HMAC-style token bound to the blueprint |
|
str |
Token scheme version (currently |
|
str |
|
|
str |
Exit code ( |
|
str |
|
|
str |
|
In addition, each subcommand appends its own run-specific attributes (e.g.
begin, end, step, total_frames, ligand, protein,
water, fitting_group, …) so a file is fully reproducible from its
metadata alone.
Signature, fingerprint, and blueprint
These three tokens look similar but answer different questions:
signature — a stable identity string built from
PHARMACON::<format>::<version>::<command>::<subcommand>::<salt>, prefix-chunked for readability. Two files with the same signature were produced by the same command/subcommand flavour of Pharmacon.fingerprint — a 128-bit BLAKE2b over the same payload. Acts as a cheap tamper-check hint for the identity block.
blueprint — hashes the actual inputs (topology, trajectory, selections, flags). Two files share a blueprint only if they were run against equivalent inputs.
pharmacon merge resultsuses this to refuse merging incompatible replicates.
None of these are cryptographic signatures — they are integrity hints, not authentication.
PTA — Pharmacon Trajectory Analysis
Extension: .pta
Stores results from trajectory-based analyses. Each subcommand writes one or more analysis groups at the root, containing per-frame datasets.
General layout:
results.pta
├── @ pharmacon_version, signature, fingerprint, blueprint,
│ command, subcommand, begin, end, step, total_frames, …
└── <analysis_group>/
├── @ completed=True
├── frame_0/
│ └── <dataset>
├── frame_1/
│ └── <dataset>
└── …
Group names per subcommand:
Subcommand |
Root group |
Per-frame dataset(s) |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Interaction row schema
The interactions dataset for pl-interactions, pp-interactions,
and h-bonds is a variable-length array of rows with a fixed 21-column
core schema:
Column |
Description |
|---|---|
|
Frame index in the source trajectory |
|
Interaction type tag (see table below) |
|
Atom index (first partner) |
|
Atom name |
|
Atom ID |
|
Atom type |
|
Element symbol |
|
Residue name |
|
Residue ID |
|
Chain ID |
|
Segment ID |
|
Same 9 fields for the second partner |
|
Dict of interaction-specific geometry fields (see below) |
Details fields per interaction type:
Interaction tag |
|
|---|---|
|
|
|
|
|
|
|
|
|
|
|
16 fields: bridging water + two distances + two angle pairs + orientation |
|
28 fields: two bridging waters + three distances + three angle pairs + orientation (reserved — not yet implemented) |
|
|
|
|
Aggregated interaction views
For interaction analyses, Pharmacon additionally writes mode tables alongside the per-frame data:
modes/mode<N>/table— per-file aggregated tables (residue × frame, residue × interaction type, residue × ligand atom, …) computed at write time so plotters do not need to re-walk every frame.modes_merged/<mode_name>/table— present only on files produced bypharmacon merge results. Contains the aggregate across all merged replicates. Merged files drop per-frame datasets in favour of these tables.
PSA — Pharmacon Structure Analysis
Extension: .psa
Stores results from static structure analyses. Inherits the entire root
attribute schema from .pta and adds structure-specific groups.
Sequence layout:
sequence.psa
├── @ pharmacon_version, signature, …, command="Structure Analysis", subcommand="sequence"
└── sequence/
├── @ completed=True
└── A/ ← one subgroup per chain
├── aa1_seq ← single-letter sequence
├── aa3_list ← three-letter residue list
└── resid_seq ← residue ID sequence
Properties layout:
properties.psa
├── @ pharmacon_version, signature, …
└── properties/
├── @ completed=True
├── properties_table ← scalar descriptors per molecule
└── fingerprints/
├── morgan
├── topological_torsion
├── atom_pair
└── maccs_keys
Inspecting artifacts
Using the Pharmacon CLI (rich formatted panels):
pharmacon dump pta -i run.pta
pharmacon dump psa -i structure.psa
Using h5py directly:
import h5py
with h5py.File("run.pta", "r") as f:
print(dict(f.attrs)) # root metadata
print(list(f.keys())) # analysis groups
Exporting artifacts
pharmacon export pta -i rmsd.pta -f csv -o ./results/
pharmacon export pta -i pl_interactions.pta -f tsv -o ./results/
pharmacon export psa -i sequence.psa -f fasta -o ./results/
pharmacon export psa -i properties.psa -f csv -o ./results/