Skip to content

Jamesk/fix alignchains biopython error#2225

Open
jamesmkrieger wants to merge 7 commits intoprody:mainfrom
jamesmkrieger:jamesk/fix-alignchains-biopython-error
Open

Jamesk/fix alignchains biopython error#2225
jamesmkrieger wants to merge 7 commits intoprody:mainfrom
jamesmkrieger:jamesk/fix-alignchains-biopython-error

Conversation

@jamesmkrieger
Copy link
Contributor

This builds on copilot's solution and seems to completely fix #2205

Now I can use alignChains both with and without match_func=sameChid with Biopython 1.80

In [1]: import prody

In [2]: prody_model = prody.parsePDB("centered_model.pdb")
@> 2280 atoms and 1 coordinate set(s) were parsed in 0.02s.

In [3]: prody_ref_model = prody.parsePDB("ref_model.pdb")
@> 2243 atoms and 1 coordinate set(s) were parsed in 0.02s.

In [4]: prody_ref_amap = prody.alignChains(prody_ref_model, prody_model, overlap=15)
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain A from ref_model (len=1132) with Chain A from centered_model:
@>      Mapped: 1132 residues match with 100% sequence identity and 99% overlap.
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain B from ref_model (len=381) with Chain A from centered_model:
@> Trying to map atoms based on local sequence alignment:
@>   Comparing Chain B from ref_model (len=381) with Chain A from centered_model:
@>      Failed to match chains (seqid=33%, overlap=32%).
@> Trying to map atoms based on CEalign:
@>   Comparing Chain B from ref_model (len=381) with Chain A from centered_model:
@>      Failed to match chains (seqid=12%, overlap=6%).
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain E from ref_model (len=709) with Chain A from centered_model:
@> Trying to map atoms based on local sequence alignment:
@>   Comparing Chain E from ref_model (len=709) with Chain A from centered_model:
/Users/kriegej/miniforge3/envs/prody-github/lib/python3.10/site-packages/Bio/pairwise2.py:278: BiopythonDeprecationWarning: Bio.pairwise2 has been deprecated, and we intend to remove it in a future release of Biopython. As an alternative, please consider using Bio.Align.PairwiseAligner as a replacement, and contact the Biopython developers if you still need the Bio.pairwise2 module.
  warnings.warn(
@>      Failed to match chains (seqid=33%, overlap=59%).
@> Trying to map atoms based on CEalign:
@>   Comparing Chain E from ref_model (len=709) with Chain A from centered_model:
@>      Failed to match chains (seqid=3%, overlap=6%).
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain F from ref_model (len=21) with Chain A from centered_model:
@> Trying to map atoms based on local sequence alignment:
@>   Comparing Chain F from ref_model (len=21) with Chain A from centered_model:
@>      Failed to match chains (seqid=40%, overlap=2%).
@> Trying to map atoms based on CEalign:
@>   Comparing Chain F from ref_model (len=21) with Chain A from centered_model:
@>      Failed to match chains (seqid=12%, overlap=1%).
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain A from ref_model (len=1132) with Chain B from centered_model:
@> Trying to map atoms based on local sequence alignment:
@>   Comparing Chain A from ref_model (len=1132) with Chain B from centered_model:
@>      Failed to match chains (seqid=34%, overlap=29%).
@> Trying to map atoms based on CEalign:
@>   Comparing Chain A from ref_model (len=1132) with Chain B from centered_model:
@>      Failed to match chains (seqid=11%, overlap=6%).
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain B from ref_model (len=381) with Chain B from centered_model:
@>      Mapped: 346 residues match with 100% sequence identity and 99% overlap.
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain E from ref_model (len=709) with Chain B from centered_model:
@> Trying to map atoms based on local sequence alignment:
@>   Comparing Chain E from ref_model (len=709) with Chain B from centered_model:
@>      Failed to match chains (seqid=29%, overlap=46%).
@> Trying to map atoms based on CEalign:
@>   Comparing Chain E from ref_model (len=709) with Chain B from centered_model:
@>      Failed to match chains (seqid=5%, overlap=15%).
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain F from ref_model (len=21) with Chain B from centered_model:
@> Trying to map atoms based on local sequence alignment:
@>   Comparing Chain F from ref_model (len=21) with Chain B from centered_model:
@>      Failed to match chains (seqid=28%, overlap=5%).
@> Trying to map atoms based on CEalign:
@>   Comparing Chain F from ref_model (len=21) with Chain B from centered_model:
@>      Failed to match chains (seqid=6%, overlap=5%).
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain A from ref_model (len=1132) with Chain E from centered_model:
@> Trying to map atoms based on local sequence alignment:
@>   Comparing Chain A from ref_model (len=1132) with Chain E from centered_model:
@>      Failed to match chains (seqid=34%, overlap=58%).
@> Trying to map atoms based on CEalign:
@>   Comparing Chain A from ref_model (len=1132) with Chain E from centered_model:
@>      Failed to match chains (seqid=5%, overlap=7%).
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain B from ref_model (len=381) with Chain E from centered_model:
@> Trying to map atoms based on local sequence alignment:
@>   Comparing Chain B from ref_model (len=381) with Chain E from centered_model:
@>      Failed to match chains (seqid=32%, overlap=49%).
@> Trying to map atoms based on CEalign:
@>   Comparing Chain B from ref_model (len=381) with Chain E from centered_model:
@>      Failed to match chains (seqid=7%, overlap=14%).
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain E from ref_model (len=709) with Chain E from centered_model:
@>      Mapped: 709 residues match with 100% sequence identity and 100% overlap.
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain F from ref_model (len=21) with Chain E from centered_model:
@> Trying to map atoms based on local sequence alignment:
@>   Comparing Chain F from ref_model (len=21) with Chain E from centered_model:
@>      Failed to match chains (seqid=50%, overlap=2%).
@> Trying to map atoms based on CEalign:
@>   Comparing Chain F from ref_model (len=21) with Chain E from centered_model:
@>      Failed to match chains (seqid=0%, overlap=2%).
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain A from ref_model (len=1132) with Chain F from centered_model:
@> Trying to map atoms based on local sequence alignment:
@>   Comparing Chain A from ref_model (len=1132) with Chain F from centered_model:
@>      Failed to match chains (seqid=37%, overlap=6%).
@> Trying to map atoms based on CEalign:
@>   Comparing Chain A from ref_model (len=1132) with Chain F from centered_model:
@>      Failed to match chains (seqid=7%, overlap=5%).
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain B from ref_model (len=381) with Chain F from centered_model:
@> Trying to map atoms based on local sequence alignment:
@>   Comparing Chain B from ref_model (len=381) with Chain F from centered_model:
@>      Failed to match chains (seqid=46%, overlap=21%).
@> Trying to map atoms based on CEalign:
@>   Comparing Chain B from ref_model (len=381) with Chain F from centered_model:
@>      Failed to match chains (seqid=4%, overlap=13%).
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain E from ref_model (len=709) with Chain F from centered_model:
@> Trying to map atoms based on local sequence alignment:
@>   Comparing Chain E from ref_model (len=709) with Chain F from centered_model:
@>      Failed to match chains (seqid=30%, overlap=11%).
@> Trying to map atoms based on CEalign:
@>   Comparing Chain E from ref_model (len=709) with Chain F from centered_model:
@>      Failed to match chains (seqid=4%, overlap=8%).
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain F from ref_model (len=21) with Chain F from centered_model:
@> Trying to map atoms based on local sequence alignment:
@>   Comparing Chain F from ref_model (len=21) with Chain F from centered_model:
@>      Mapped: 20 residues match with 100% sequence identity and 24% overlap.
@> Finding the atommaps based on their coverages...
@> Identified that there exists 1 atommap(s) potentially.

In [5]: prody_ref_amap
Out[5]: [<AtomMap: (Chain F from ref_model -> Chain F from centered_model) + (Chain E from ref_model -> Chain E from centered_model) + (Chain B from ref_model -> Chain B from centered_model) + (Chain A from ref_model -> Chain A from centered_model) from ref_model (2280 atoms, 2207 mapped, 73 dummy)>]

In [6]: prody_ref_amap_sc = prody.alignChains(prody_ref_model, prody_model, overlap=15, match_func=prody.sameChid)
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain A from ref_model (len=1132) with Chain A from centered_model:
@>      Mapped: 1132 residues match with 100% sequence identity and 99% overlap.
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain B from ref_model (len=381) with Chain B from centered_model:
@>      Mapped: 346 residues match with 100% sequence identity and 99% overlap.
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain E from ref_model (len=709) with Chain E from centered_model:
@>      Mapped: 709 residues match with 100% sequence identity and 100% overlap.
@> Trying to map atoms based on residue numbers and identities:
@>   Comparing Chain F from ref_model (len=21) with Chain F from centered_model:
@> Trying to map atoms based on local sequence alignment:
@>   Comparing Chain F from ref_model (len=21) with Chain F from centered_model:
@>      Mapped: 20 residues match with 100% sequence identity and 24% overlap.
@> Finding the atommaps based on their coverages...
@> Identified that there exists 1 atommap(s) potentially.

In [7]: prody_ref_amap_sc
Out[7]: [<AtomMap: (Chain F from ref_model -> Chain F from centered_model) + (Chain E from ref_model -> Chain E from centered_model) + (Chain B from ref_model -> Chain B from centered_model) + (Chain A from ref_model -> Chain A from centered_model) from ref_model (2280 atoms, 2207 mapped, 73 dummy)>]

Copilot AI and others added 7 commits February 13, 2026 16:38
Co-authored-by: AnthonyBogetti <34397256+AnthonyBogetti@users.noreply.github.com>
Co-authored-by: AnthonyBogetti <34397256+AnthonyBogetti@users.noreply.github.com>
Co-authored-by: AnthonyBogetti <34397256+AnthonyBogetti@users.noreply.github.com>
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.

Biopython > 1.79 sometimes breaks alignChains

2 participants

Comments