Skip to main content

CLI tool to view CIF files from various sources in your editor

Project description

view-cif

PyPI Python Test License

CLI tool to view CIF files from various sources in your preferred editor.

Features

  • Open CIF files by file path, PDB code, or compound name
  • Automatic download from PDB (including next-gen format)
  • BIRD individual lookup — auto-detects PRD_, PRDCC_, FAM_ prefixes
  • CCD and PRD/PRDCC bulk file support
  • Configurable editor and data paths via YAML config
  • Cache-based viewing (no blocking --wait)

Installation

Requires Python 3.12+.

# From PyPI
pip install view-cif

# Or with uv
uv tool install view-cif

Usage

# Open a local CIF file
view-cif /path/to/structure.cif

# Open by PDB code (uses local mirror or auto-downloads)
view-cif 1abc

# Open next-gen PDB format
view-cif 1abc --next-gen

# Open from a specific directory
view-cif ABC /path/to/cif/dir

# Open CCD chemical component
view-cif ATP

# Individual BIRD lookups (auto-detected by prefix)
view-cif PRD_000010      # PRD definition
view-cif PRDCC_000240    # PRD chemical component
view-cif FAM_000160      # PRD family

# Bulk files
view-cif prd             # prd-all.cif.gz
view-cif prdcc           # prdcc-all.cif.gz
view-cif ccd             # components.cif.gz

Options

Option Short Description
--next-gen -n Use pdb_next_gen format

Configuration

On first run, a default config is created at ~/.config/view-cif/config.yaml. See config.example.yaml for a fully commented template.

Managing config via CLI

# Show current configuration
view-cif config show

# Change editor
view-cif config set editor nvim

# Set data paths
view-cif config set paths.chem_comp /data/chem_comp
view-cif config set paths.prd /data/bird

Config keys

Key Description Example
editor Editor command (any terminal command) code, nvim, vim
cache_dir Directory for cached CIF output ~/.cache/view-cif
paths.pdb_next_gen Next-gen PDB archive root /data/pdb_nextgen
paths.bird BIRD bulk files (prd-all.cif.gz, prdcc-all.cif.gz) /data/bird/prd
paths.monomers CCD monomers (components.cif.gz) /data/monomers
paths.chem_comp Chemical component reference data /data/chem_comp
paths.prd BIRD reference root (prd/, prdcc/, family/ subdirs) /data/refdata/bird

Directory structure expectations

Path resolution follows the PDB FTP/rsync mirror directory layout. If you maintain a local mirror, point each config path to the corresponding directory.

~ and environment variables ($HOME, $PDB_ROOT, etc.) are expanded automatically.

paths.pdb_next_gen/
  entries/divided/{ab}/pdb_{id}/pdb_{id}_xyz-enrich.cif.gz

paths.bird/
  prd-all.cif.gz
  prdcc-all.cif.gz

paths.monomers/
  components.cif.gz

paths.chem_comp/
  {X}/{ABC}/ABC.cif          # nested by first character

paths.prd/
  prd/    {N}/PRD_NNNNNN.cif
  prdcc/  {N}/PRDCC_NNNNNN.cif
  family/ {N}/FAM_NNNNNN.cif

Development

# Install with dev dependencies
uv sync --group dev

# Run tests
uv run pytest --cov=view_cif -v

# Lint
uv run ruff check .

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

view_cif-0.2.3.tar.gz (31.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

view_cif-0.2.3-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file view_cif-0.2.3.tar.gz.

File metadata

  • Download URL: view_cif-0.2.3.tar.gz
  • Upload date:
  • Size: 31.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for view_cif-0.2.3.tar.gz
Algorithm Hash digest
SHA256 d13b439793503b6b3ce228804168277347a4731b3088ea323783a454cbae152f
MD5 cca43d78b4eee96450324ed066be4266
BLAKE2b-256 e53f1a78c41e5d93c33e3f91523d9e90c55c4703534dd9e02ce743cb1a8b7f51

See more details on using hashes here.

Provenance

The following attestation bundles were made for view_cif-0.2.3.tar.gz:

Publisher: publish.yml on N283T/view-cif

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file view_cif-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: view_cif-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for view_cif-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 29b88a2e699a814f4230a8400106425dc885bde2e28f0b50452c33be63f4a6a6
MD5 b00c5ba4f90fa82f5d500e50899064d5
BLAKE2b-256 ac24f77fdf711ecc4aa907f65d36acc586eb960b4a4925b9c7dd67a0d857498c

See more details on using hashes here.

Provenance

The following attestation bundles were made for view_cif-0.2.3-py3-none-any.whl:

Publisher: publish.yml on N283T/view-cif

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page