Skip to content

Chain alignment fixes - #1220

Open
jamesmkrieger wants to merge 6 commits into
prody:mainfrom
jamesmkrieger:dali_dimers
Open

Chain alignment fixes#1220
jamesmkrieger wants to merge 6 commits into
prody:mainfrom
jamesmkrieger:dali_dimers

Conversation

@jamesmkrieger

@jamesmkrieger jamesmkrieger commented Dec 21, 2020

Copy link
Copy Markdown
Contributor

Allows buildPDBEnsemble to pass labels through alignChains to getDictMapping as alternative keys for mapping dict.

Also includes cleaning up of daliFilterMultimer, which has been tested and causes no problems.

@jamesmkrieger
jamesmkrieger marked this pull request as draft December 21, 2020 17:27
@jamesmkrieger
jamesmkrieger marked this pull request as ready for review December 21, 2020 17:32
@jamesmkrieger jamesmkrieger changed the title Dali dimers AlignChain fixes for Dali Dec 23, 2020
@jamesmkrieger jamesmkrieger changed the title AlignChain fixes for Dali AlignChain fixes Dec 23, 2020
@jamesmkrieger
jamesmkrieger marked this pull request as draft December 23, 2020 15:05
@jamesmkrieger

Copy link
Copy Markdown
Contributor Author

This needs testing still.

@jamesmkrieger jamesmkrieger changed the title AlignChain fixes Chain alignment fixes Jun 30, 2021
@jamesmkrieger
jamesmkrieger marked this pull request as ready for review July 28, 2026 14:44

@karolamik13 karolamik13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are below. Should I test something more?

Results:
@> PDB file is found in working directory (5ir5.pdb.gz).
@> 626 atoms and 1 coordinate set(s) were parsed in 0.03s.
@> PDB file is found in working directory (5ir4.pdb.gz).
@> 657 atoms and 1 coordinate set(s) were parsed in 0.03s.
5IR5 atoms: 626
5IR5 residues: 626
5IR4 atoms: 657
5IR4 residues: 657

--- Testing alignChains ---
@> Trying to map atoms based on residue numbers and identities:
@> Comparing Chain A from 5IR4_ca (len=657) with Chain A from 5IR5_ca:
@> Mapped: 624 residues match with 100% sequence identity and 100% overlap.
@> Finding the atommaps based on their coverages...
@> Identified that there exists 1 atommap(s) potentially.
[OK] Number of AtomMaps: 1
[OK] AtomMap atoms: 626
[OK] Mapped atoms: 624

--- Testing buildPDBEnsemble with labels ---
@> Ensemble (2 conformations) were built in 0.09s.
[OK] Number of conformations: 2
[OK] Number of ensemble atoms: 626
[OK] Labels: ['5IR5', '5IR4']
[OK] Mapped atoms in 5IR5: 626
[OK] Mapped atoms in 5IR4: 624
[OK] RMSDs before superposition: [ 0. 37.93748796]
@> Superposition completed in 0.00 seconds.
[OK] RMSDs after superposition: [8.98738513e-15 9.44748579e-01]
[OK] Minimum occupancy: 1.0
[OK] Maximum occupancy: 2.0

--- Final result ---
OVERALL RESULT: PASS

Code:
from prody import *
import numpy as np

structure_5ir5 = parsePDB('5IR5', subset='ca').select('protein and chain A')
structure_5ir4 = parsePDB('5IR4', subset='ca').select('protein and chain A')

print('5IR5 atoms:', structure_5ir5.numAtoms())
print('5IR5 residues:', structure_5ir5.numResidues())
print('5IR4 atoms:', structure_5ir4.numAtoms())
print('5IR4 residues:', structure_5ir4.numResidues())

print('\n--- Testing alignChains ---')

try:
atommaps = alignChains(structure_5ir4, structure_5ir5)
print('[OK] Number of AtomMaps:', len(atommaps))

if len(atommaps):
    print('[OK] AtomMap atoms:', atommaps[0].numAtoms())
    print('[OK] Mapped atoms:', int(np.count_nonzero(atommaps[0].getFlags('mapped'))))

except Exception as error:
print('[ERROR] alignChains:', type(error).name, error)

print('\n--- Testing buildPDBEnsemble with labels ---')

try:
ensemble = buildPDBEnsemble([structure_5ir5, structure_5ir4], labels=['5IR5', '5IR4'], title='LOX', superpose=False)

print('[OK] Number of conformations:', ensemble.numConfs())
print('[OK] Number of ensemble atoms:', ensemble.numAtoms())
print('[OK] Labels:', ensemble.getLabels())

weights = ensemble.getWeights()

for i, label in enumerate(ensemble.getLabels()):
    print('[OK] Mapped atoms in {0}: {1}'.format(label, int(np.count_nonzero(weights[i]))))

print('[OK] RMSDs before superposition:', ensemble.getRMSDs())
ensemble.superpose()
print('[OK] RMSDs after superposition:', ensemble.getRMSDs())

occupancies = calcOccupancies(ensemble)

print('[OK] Minimum occupancy:', occupancies.min())
print('[OK] Maximum occupancy:', occupancies.max())
print('\n--- Final result ---')

if ensemble.numConfs() == 2 and list(ensemble.getLabels()) == ['5IR5', '5IR4']:
    print('OVERALL RESULT: PASS')
else:
    print('OVERALL RESULT: CHECK THE OUTPUT')

except Exception as error:
print('[ERROR] buildPDBEnsemble:', type(error).name, error)
print('\nOVERALL RESULT: FAIL')

@jamesmkrieger

Copy link
Copy Markdown
Contributor Author

I think there was something about labels relating to mappings from a dictionary or dali but I don't remember how to run that. I can check the scipion plugin code and get back to you

@karolamik13

Copy link
Copy Markdown
Contributor

I think there was something about labels relating to mappings from a dictionary or dali but I don't remember how to run that. I can check the scipion plugin code and get back to you

Ok. Thanks.

@jamesmkrieger

Copy link
Copy Markdown
Contributor Author

looks like it's not there in the scipion plugin, so I still don't know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants