Jamesk/fix alignchains biopython error#2225
Conversation
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>
karolamik13
left a comment
There was a problem hiding this comment.
I have tested the code (recommended PDB files and some other PDB files). Works fine.
Python 3.10.15 | packaged by conda-forge | (main, Sep 20 2024, 16:37:05) [GCC 13.3.0]
IPython 8.37.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from prody import *
In [2]: prody_model = prody.parsePDB("centered_model.pdb")
@> 2280 atoms and 1 coordinate set(s) were parsed in 0.06s.
In [3]: prody_ref_model = prody.parsePDB("ref_model.pdb")
@> 2243 atoms and 1 coordinate set(s) were parsed in 0.07s.
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:
@> 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=38%, 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=33%, overlap=30%).
@> 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=28%, overlap=47%).
@> 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=24%, overlap=6%).
@> 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=33%, overlap=59%).
@> 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=50%).
@> 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=33%, overlap=3%).
@> 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=32%, overlap=7%).
@> 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=45%, 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: 21 residues match with 95% sequence identity and 26% overlap.
@> Finding the atommaps based on their coverages...
@> Identified that there exists 1 atommap(s) potentially.
In [5]: 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: 21 residues match with 95% sequence identity and 26% overlap.
@> Finding the atommaps based on their coverages...
@> Identified that there exists 1 atommap(s) potentially.
In [6]: prody_ref_amap_sc
Out[6]: [<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, 2208 mapped, 72 dummy)>]
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