Skip to main content

macromolecular structures (.pdb/.mmCIF) as pandas dataframes

Project description

MacroMolecular DataFrames (mmdf)

License PyPI Python Version CI codecov

MacroMolecular DataFrames (mmdf) is a small package for reading and writing macromolecular structure files (.pdb/.mmCIF) using pandas dataframes.

The heavy lifting of reading structure files is performed by gemmi.

Usage

import mmdf

# Read a PDBx/mmCIF file into a dataframe
df = mmdf.read('4v6x.cif')
df.head()
Out[3]: 
  model chain residue  residue_id  ...       z charge occupancy  b_isotropic
0     1    Az     ASN           3  ... -54.829      0       1.0         10.0
1     1    Az     ASN           3  ... -54.691      0       1.0         10.0
2     1    Az     ASN           3  ... -53.642      0       1.0         10.0
3     1    Az     ASN           3  ... -53.007      0       1.0         10.0
4     1    Az     ASN           3  ... -54.239      0       1.0         10.0
[5 rows x 13 columns]

# Other dataframe manipulation...

# Write dataframe to a PDBx/mmCIF file
mmdf.write('4v6x_new.cif', df)

You can also fetch structures by their PDB ID, they will be cached in your home directory.

import mmdf

df = mmdf.read("pdb:1crn")

Changelog

v0.0.4 (05/12/25)

  • add pdb download functionality

v0.0.3 (12/12/24)

  • added basic write functionality
  • resolved gemmi 0.7.0 incompatibility issues

v0.0.2 (20/01/24)

  • added atomic properties to dataframe output
  • added support for Path arguments in mmdf.read()
  • moved to pyproject.toml based packaging

v0.0.1

  • first release

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

mmdf-0.0.5.tar.gz (5.7 MB view details)

Uploaded Source

Built Distribution

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

mmdf-0.0.5-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file mmdf-0.0.5.tar.gz.

File metadata

  • Download URL: mmdf-0.0.5.tar.gz
  • Upload date:
  • Size: 5.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mmdf-0.0.5.tar.gz
Algorithm Hash digest
SHA256 af2c12bc22d1a5d0f36cfb1823209d61aa0813e2bd1f545554869e8139277b6a
MD5 029673f8e52b57253fa134da964a6ad5
BLAKE2b-256 b14cee31a4f8404347990d91090c327667ff43e439f4f1648e061236aba27eaf

See more details on using hashes here.

Provenance

The following attestation bundles were made for mmdf-0.0.5.tar.gz:

Publisher: ci.yml on teamtomo/mmdf

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

File details

Details for the file mmdf-0.0.5-py3-none-any.whl.

File metadata

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

File hashes

Hashes for mmdf-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6164718171ee9789dea17818ff82a6b901a891b5b001ecba58adb669f3add645
MD5 a52493f44ce8d91d6bdff0d6d54d8549
BLAKE2b-256 d78b9d613d2ed8056f1e179fd0a897797338a726b8a583cdcf5559694777f6db

See more details on using hashes here.

Provenance

The following attestation bundles were made for mmdf-0.0.5-py3-none-any.whl:

Publisher: ci.yml on teamtomo/mmdf

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