Skip to content

Add pose IDs to mmCIF keywords via $PoseID token substitution - #82

Merged
tdudgeon merged 3 commits into
masterfrom
feature/pose-ids-in-mmcif-keywords
Jun 10, 2026
Merged

Add pose IDs to mmCIF keywords via $PoseID token substitution#82
tdudgeon merged 3 commits into
masterfrom
feature/pose-ids-in-mmcif-keywords

Conversation

@tdudgeon

Copy link
Copy Markdown
Collaborator

Summary

  • Adds read_fragalysis_csv() to parse the Fragalysis download metadata.csv (pose code in column 1, crystal name in column 3) into a {crystal_name: [pose_codes]} mapping
  • Wires the existing --fragalysis-csv / fragalysis_csv argument (previously unused) through run() into process_input()
  • Substitutes $PoseID with a comma-separated list of pose codes wherever the token appears in the mmcif-gen template output — handles loop items and key-value pair items, as well as the existing _struct.title loop
  • Uses csv.reader to correctly handle the quoted fields in the Fragalysis CSV

Closes #81

Test plan

  • Run python -m pdbdepo.pdb_deposition -w <collator_dir> -m <metadata.csv> -f <fragalysis_metadata.csv> against data/std_test/lb32627-66_2026-04-28
  • Check _struct_keywords.text in a generated _struc.cif contains the expected pose IDs (e.g. A71EV2A-x0836a, A71EV2A-x0836b for crystal A71EV2A-x0836)
  • Confirm no literal $PoseID tokens remain in any output CIF: grep -r '\$PoseID' pdb_depo_files/
  • Crystals with no Fragalysis entry produce an empty substitution (token removed, no crash)

🤖 Generated with Claude Code

tdudgeon and others added 3 commits June 10, 2026 09:49
Reads the Fragalysis download metadata.csv (column 1 = pose code, column 3 =
crystal name) to build a crystal→pose-codes mapping, then substitutes the
$PoseID token wherever it appears in the mmcif-gen template output (handles
both loop items and key-value pairs). Closes #81.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The CSV uses double-quoted fields so simple split(',') left quotes in the
parsed values, preventing dict lookups from matching crystal names. Switch to
csv.reader which strips the quotes correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tdudgeon
tdudgeon merged commit 4976cc5 into master Jun 10, 2026
6 checks passed
@tdudgeon
tdudgeon deleted the feature/pose-ids-in-mmcif-keywords branch June 10, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add pose IDs to mmCIF keywords in PDB deposition output

1 participant