Fast CIF file parsing for molecular structures
Project description
Overview
ciffy is a fast CIF file parser for molecular structures, with a C backend and Python interface.
Installation
From PyPI
pip install ciffy
From Source
git clone https://github.com/hmblair/ciffy.git
cd ciffy
pip install -r requirements.txt
pip install torch-scatter --no-build-isolation
pip install -e .
Note on torch-scatter
ciffy requires torch-scatter, which may need to be installed separately depending on your platform:
Linux/Windows with CUDA:
# Replace CUDA with your version (e.g., cu118, cu121) or cpu
pip install torch-scatter -f https://data.pyg.org/whl/torch-2.7.0+${CUDA}.html
macOS or if pre-built wheels are unavailable:
pip install torch-scatter --no-build-isolation
Usage
import ciffy
# Load a structure from a CIF file
polymer = ciffy.load("structure.cif")
# Basic information
print(polymer) # Summary of chains, residues, atoms
# Access coordinates and properties
coords = polymer.coordinates # (N, 3) tensor
atoms = polymer.atoms # (N,) tensor of atom types
sequence = polymer.str() # Sequence string
# Geometric operations
centered, means = polymer.center(ciffy.MOLECULE)
aligned, Q = polymer.align(ciffy.CHAIN)
distances = polymer.pd(ciffy.RESIDUE)
# Selection
rna_chains = polymer.subset(ciffy.RNA)
backbone = polymer.backbone()
# Iterate over chains
for chain in polymer.chains(ciffy.RNA):
print(chain.id(), chain.str())
# Compute RMSD between structures
rmsd = ciffy.rmsd(polymer1, polymer2, ciffy.MOLECULE)
Module Structure
ciffy/
├── types/ # Scale, Molecule enums
├── biochemistry/ # Element, Residue, nucleotide definitions
├── operations/ # Reduction, alignment operations
├── io/ # File loading and writing
└── utils/ # Helper functions and base classes
Testing
pip install pytest
pytest tests/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ciffy-0.4.7.tar.gz
(47.7 kB
view details)
File details
Details for the file ciffy-0.4.7.tar.gz.
File metadata
- Download URL: ciffy-0.4.7.tar.gz
- Upload date:
- Size: 47.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
966b47f032fa944128e8cfc497f0a7de8bf61121334cb1824fd0b8858c078481
|
|
| MD5 |
f6ac9891348f6796772196113f2aa6b0
|
|
| BLAKE2b-256 |
6c6a6f48cba4c463a05f162ae0050a42c8605c0b811ca036fc4538a563d3f883
|
Provenance
The following attestation bundles were made for ciffy-0.4.7.tar.gz:
Publisher:
pypi.yml on hmblair/ciffy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ciffy-0.4.7.tar.gz -
Subject digest:
966b47f032fa944128e8cfc497f0a7de8bf61121334cb1824fd0b8858c078481 - Sigstore transparency entry: 756038691
- Sigstore integration time:
-
Permalink:
hmblair/ciffy@b5b863ae81f17da8f4010d35ae4d399c80ffb16d -
Branch / Tag:
refs/tags/v0.4.7 - Owner: https://github.com/hmblair
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@b5b863ae81f17da8f4010d35ae4d399c80ffb16d -
Trigger Event:
push
-
Statement type: