Opened 7 years ago

Closed 6 years ago

#1341 closed enhancement (fixed)

Friendlier alignment API

Reported by: Tristan Croll Owned by: Eric Pettersen
Priority: moderate Milestone:
Component: Structure Comparison Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

I found my way to what I needed by digging through the source of match_maker.match, but unless I've missed it there's no existing simple API call to get (residues1, residues2) where residues1 and residues2 are equal length residues1[i] corresponds to residues2[i] after alignment (by sequence and/or structure). Would be really useful to have for all sorts of residue-by-residue structure comparisons.

Change History (9)

comment:1 by Eric Pettersen, 7 years ago

Status: assignedaccepted

I should clearly expose match_maker.match.match as just match_maker.match, but aside from that, do you just want a better doc string? That 'match' function already returns two Atoms objects corresponding to the final atoms being paired by the match, along with paired RMSD, overall RMSD and transformation matrix.

in reply to:  2 ; comment:2 by tic20@…, 7 years ago

“That 'match' function already returns two Atoms objects corresponding to the final atoms being paired by the match, ...”

Hmm. Well, that’s embarrassing. That particular fact completely eluded me.

 
 
Tristan Croll
Research Fellow
Cambridge Institute for Medical Research
University of Cambridge CB2 0XY
 

 


comment:3 by Eric Pettersen, 7 years ago

It certainly requires detective work to figure out the return values, so I should really improve the doc string. To be more exact, it really returns a list of those tuples, since multiple chains may be matched in a single match() call.

--Eric

comment:4 by Tristan Croll, 7 years ago

Would it be possible to make the try... except align.IterationError clause in match.match() optional? As an example, for the task I'm working on (assessing CASP structure predictions) I have the problem that I get the predictions as individual domains, but the list of templates used for the *entire protein* - so I need an automated way to weed out the irrelevant templates for each domain.

I can of course hack my own solution together for the time being, but I can see others needing the same option in future.

comment:5 by Tristan Croll, 7 years ago

That is, it would be good if match.match() could optionally raise an error rather than just log if it fails at *any* step of the alignment process.

comment:6 by Eric Pettersen, 7 years ago

Good idea. I'll try to get to it today, but there's a bunch of stuff ahead of it...

--Eric

comment:7 by Eric Pettersen, 7 years ago

Okay, greatly expanded the doc string, made the match() function directly importable from the module instead of from the .match submodule, and added an always_raise_errors boolean so you can make the IterationError actually raise an error instead of just log.

--Eric

comment:8 by Tristan Croll, 6 years ago

When always_raise_errors is True, would it be possible to have match() also raise an IterationError at line 532?

        if len(match_atoms) < 3:
            logger.error("Fewer than 3 residues aligned; cannot match %s with %s"
                % (s1.name, s2.name))
            continue

What I'm trying to use it for at the moment is a mechanism for assigning reference model distance restraints: align template to model with a cutoff; assign restraints based on aligned portion; align residual atoms; assign restraints; and repeat until there's no usable alignment left. At the moment, if it hits this it (a) returns an empty list that I have to check for and handle (OK, no big deal), and (b) throws an error message to the log and a pop-up window (more serious problem).

comment:9 by Eric Pettersen, 6 years ago

Resolution: fixed
Status: acceptedclosed

Seems like that would be consistent behavior. I have made the change.

--Eric

Note: See TracTickets for help on using tickets.