bytedance / bytedance/PXMeter

Protenix maps bonds on non-contiguous duplicate chains to the wrong entity

Open Beginner friendly
#11 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
100
Forks
12
PR merge metrics
No merged PRs in 30d

Description

## Description

`ProtenixInput.from_sequences()` assigns the wrong entity ID to a repeated sequence when identical chains are separated by a different entity in `Sequences.sequences`.

## Minimal reproduction

Construct three chains in this order:

```text
chain 0: protein AA (entity 1, copy 1)
chain 1: protein GG (entity 2, copy 1)
chain 2: protein AA (entity 1, copy 2)
```

Add a bond from chain 2 to chain 0 and convert with `ProtenixInput.from_sequences()`.

Expected first endpoint:

```text
entity_id=1, copy_id=2
```

Actual first endpoint:

```text
entity_id=2, copy_id=2
```

The generated entities themselves are correct: entity 1 is `AA` with count 2 and entity 2 is `GG` with count 1.

## Root cause

In the repeated-sequence branch, `chain_to_entity_and_copy` uses the loop's current `entity_id`. That counter identifies the most recently created entity, not necessarily `seqs_to_entities[seq].entity_id`.

## Impact

Covalent bonds involving a non-contiguous repeated chain can be serialized against the wrong molecule. The JSON remains structurally valid, so the topology corruption is silent.

## Environment

- PXMeter commit: `72117242154d0c9f52ce727dc352210aab76d495`
- Python 3.11 on Windows

A focused in-memory test can reproduce this without CIF files or external services.

Contributor guide

Open the contributing guide

Research direction

Start with ProtenixInput.from_sequences() and the repeated-sequence branch that builds chain_to_entity_and_copy from Sequences.sequences. Reproduce the three-chain case with an in-memory focused test, then verify the bond endpoint uses entity 1 and copy 2 for the non-contiguous repeated chain while the generated entities remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
bioinformatics
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.