Metadata-Version: 2.4
Name: view-cif
Version: 0.2.2
Summary: CLI tool to view CIF files from various sources in your editor
Project-URL: Homepage, https://github.com/N283T/view-cif
Project-URL: Repository, https://github.com/N283T/view-cif
Project-URL: Changelog, https://github.com/N283T/view-cif/blob/main/CHANGELOG.md
Author-email: N283T <w255508b@yokohama-cu.ac.jp>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Chemistry
Requires-Python: >=3.12
Requires-Dist: gemmi>=0.7.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: typer>=0.15.2
Description-Content-Type: text/markdown

# view-cif

[![PyPI](https://img.shields.io/pypi/v/view-cif)](https://pypi.org/project/view-cif/)
[![Python](https://img.shields.io/pypi/pyversions/view-cif)](https://pypi.org/project/view-cif/)
[![Test](https://github.com/N283T/view-cif/actions/workflows/test.yml/badge.svg)](https://github.com/N283T/view-cif/actions/workflows/test.yml)
[![License](https://img.shields.io/github/license/N283T/view-cif)](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)
- 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+.

```bash
# From PyPI
pip install view-cif

# Or with uv
uv tool install view-cif
```

## Usage

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

# Open by PDB code (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

# Open PRD definition
view-cif prd --ccd-definition
```

### Options

| Option | Short | Description |
|:-------|:------|:------------|
| `--ccd-definition` | `-d` | Use CCD definition file type |
| `--next-gen` | `-n` | Use pdb_next_gen format |

## Configuration

On first run, a default config is created at `~/.config/view-cif/config.yaml`.

### Managing config via CLI

```bash
# 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.monomers /data/monomers
```

### Config keys

| Key | Description |
|:----|:------------|
| `editor` | Editor command to open CIF files (e.g., `code`, `nvim`, `emacs`) |
| `cache_dir` | Directory for cached CIF output |
| `paths.pdb_next_gen` | Root directory for next-gen PDB files |
| `paths.bird` | Root directory for BIRD (PRD) data |
| `paths.monomers` | Directory containing `components.cif.gz` |
| `paths.chem_comp` | Directory for chemical component CIF files |
| `paths.prd` | Directory for PRD definition CIF files |

## Development

```bash
# Install with dev dependencies
uv sync --group dev

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

# Lint
uv run ruff check .
```

## License

[MIT](LICENSE)
