Skip to content

switch biopython alignment to global#2223

Open
jamesmkrieger wants to merge 1 commit intoprody:mainfrom
jamesmkrieger:jmk_global_alignment
Open

switch biopython alignment to global#2223
jamesmkrieger wants to merge 1 commit intoprody:mainfrom
jamesmkrieger:jmk_global_alignment

Conversation

@jamesmkrieger
Copy link
Contributor

This seems to fix #2205

In [1]: import prody
/Users/kriegej/scipion3/software/em/prody-github/ProDy/prody/drugui/gui.py:1867: SyntaxWarning: invalid escape sequence '\$'
  """
/Users/kriegej/scipion3/software/em/prody-github/ProDy/prody/drugui/no_gui.py:1160: SyntaxWarning: invalid escape sequence '\$'
  """

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

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

In [4]: target = list(prody_model.getHierView())[3]

In [5]: chain = list(prody_ref_model.getHierView())[3]

In [6]: from prody.utilities import MATCH_SCORE, MISMATCH_SCORE, GAP_PENALTY, GAP_EXT_PENALTY, ALIGNMENT_METHOD, alignBioPairwise

In [7]:             alignments = alignBioPairwise(target.getSequence(),
   ...:                                           chain.getSequence()[3:],
   ...:                                           "local",
   ...:                                           MATCH_SCORE, MISMATCH_SCORE,
   ...:                                           GAP_PENALTY,  GAP_EXT_PENALTY,
   ...:                                           max_alignments=1)

In [8]: alignments
Out[8]: [('FEVKKWNAVALWAWDIV', 'FEVKKWNAVALWAWDIV', 17.0, '3', '20')]

In [9]:             alignments = alignBioPairwise(target.getSequence(),
   ...:                                           chain.getSequence()[3:],
   ...:                                           "global",
   ...:                                           MATCH_SCORE, MISMATCH_SCORE,
   ...:                                           GAP_PENALTY,  GAP_EXT_PENALTY,
   ...:                                           max_alignments=1)

In [10]: alignments
Out[10]: 
[('KKRFEVKKWNAVALWAWDIVNCAICRNHIMDLCIECQANQASATSEECTVAWGVCNHAFHFHCISRWLKTRQVCPLDNREWE',
  'F---EVKKWNAVALWAWDIV-------------------------------------------------------------V',
  7.800000000000022,
  '0',
  '82')]

@AnthonyBogetti and @anupam-banerjee please check if this breaks anything else you're working with

@jamesmkrieger
Copy link
Contributor Author

That said, we may be able to use the last two fields from the output that are the begin and end of the alignment

@jamesmkrieger
Copy link
Contributor Author

Maybe it's better not to change global settings like this in case someone needs something and I think I almost have a solution

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

1 participant

Comments