RosettaCommons / RosettaCommons/atomworks

Bug/documentation issue: Requesting altloc ("label_alt_id") in `extra_fields` gets overwritten by `"first"` if occupancy is not also in `extra_fields`

Open
#70 1 comment 0 reactions 1 assignee View on GitHub

@nscorley is already working on this.

Since Dec 17, 2025.

Dominant language
Python
Stars
446
Forks
52
PR merge metrics
No merged PRs in 30d

Description

https://github.com/RosettaCommons/atomworks/blob/c314ddd1a069f3e7d051a59f24fbfc908f51c514/src/atomworks/io/utils/io_utils.py#L279C17-L279C83

I ran into an issue using load_any to parse a mmCIF file into an AtomArrayStack.

>>> # This is the mmCIF with PDB ID 6B8X downloaded from RCSB
>>> st = load_any('tests/resources/6b8x/6B8X.cif', altloc='all', extra_fields=["label_alt_id", ]) 
>>> # We know this has non-hetatm alt B records
>>> st[0].query("~hetero and label_alt_id == 'B'")
AtomArray([
])

The issue appears to be in the atomworks version of get_structure, which silently assumes the altloc is "first" unless occupancy is also specified as an extra field. This should be documented or fixed.

Preferably, this would return with "first" only if no additional altloc/occupancy related extra fields are provided.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.