TMalign¶
Some users may wish to write Lemon workflows that involve the alignment of a potential protein to a reference protein. Potential applications include the creation of a benchmarking set of all proteins with a given fold or motif. To address this, we’ve included the TMalign algorithm within Lemon.
Note: You will need to include the additional file: <lemon/tmalign.hpp> to have access to these features.
The TMscore function for alignment¶
-
struct
TMResult
¶ Structure representing the TMScore
-
TMResult
tmalign::lemon
::
TMscore
(const chemfiles::Frame &search, const chemfiles::Frame &native)¶ TMalign is an algorithm used to align protein chains in 3D space.
Ported from https://zhanglab.ccmb.med.umich.edu/TM-score/TMscore_subroutine.f Original reference: Yang Zhang, Jeffrey Skolnick, Proteins 2004 57:702-10.
Original License: Permission to use, copy, modify, and distribute this program for any purpose, with or without fee, is hereby granted, provided that the notices on the head, the reference information, and this copyright notice appear in all copies or substantial portions of the Software. It is provided “as is” without express or implied warranty.
- Return
A strucure with the TMScore, and number of aligned residues
- Parameters
[in] search
: The frame that is being aligned to native.[in] native
: The ‘native’ chain that the search chain is aligned to.
Example¶
C++¶
lemon::Options o;
auto reference = std::string("reference.pdb");
o.add_option("--reference,-r", reference, "Protein or DNA to align to.")->
check(CLI::ExistingFile);
o.parse_command_line(argc, argv);
chemfiles::Trajectory traj(reference);
chemfiles::Frame native = traj.read();
auto worker = [&native](const chemfiles::Frame& entry,
const std::string& pdbid) -> std::string {
auto tm = lemon::tmalign::TMscore(entry, native);
return pdbid + "\t" +
std::to_string(tm.score) + "\t" +
std::to_string(tm.rmsd) + "\t" +
std::to_string(tm.aligned) + "\n";
};
auto collector = lemon::print_combine(std::cout);
return lemon::launch(o, worker, collector);
Python¶
import lemon
class MyWorkflow(lemon.Workflow):
def __init__(self):
import lemon
lemon.Workflow.__init__(self)
self.native = lemon.open_file("../../../test/files/1AAQ.mmtf")
def worker(self, entry, pdbid):
import lemon
tm = lemon.TMscore(entry, self.native)
return pdbid + "\t" + \
str(tm.score) + "\t" + \
str(tm.aligned) + "\t" + \
str(tm.affine) + "\n"