<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p>Hello ChimeraX community,</p>
<p><br>
</p>
<p>I have been trying to use the Chimerax tool to sequentially check one query pdb against multiple (later up to 10000) pdb files. For this I have been working with the python scripting functionality. With the following code I was able to get the resulting
data (number of matched atoms and resulting RMSD) saved as a html log file:</p>
<p><br>
</p>
<p></p>
<div>import os<br>
from chimerax.core.commands import run as rc<br>
<br>
# change to folder with data files<br>
os.chdir("/home/ubuntu/Desktop/Chimerax_search/N_crassa_pdb")<br>
<br>
# gather the names of .pdb files in the folder<br>
file_names = [fn for fn in os.listdir(".") if fn.endswith(".pdb")]<br>
<br>
# give path to query file to be searched against pdb library<br>
query = "/home/ubuntu/Desktop/Chimerax_search/query/BDFB_007497.pdb"<br>
<br>
# open the query file as #1 in ChimeraX <br>
rc(session, "open /home/ubuntu/Desktop/Chimerax_search/query/BDFB_007497.pdb")<br>
<br>
# loop through the files<br>
for fn in file_names:<br>
# open first target pdb as #2 <br>
rc(session, "open " + fn)<br>
# match both structures<br>
rc(session, "match #1 to #2")<br>
# save log with ID matching input filename, close #2 and clear log<br>
rc(session, "log save " + fn.split(".")[0] + ".log")<br>
rc(session, "close #2")<br>
rc(session, "log clear")</div>
<p></p>
<p><br>
</p>
<p>Instead of trying to gather the relevant data from thousands of rather large html output files I instead would prefer to only get then resulting values from matchmaker. I learned that the command actually has all the values I wanted as return values, so
I tried to write a modified script, that saves these values in a variable and collects the values for every target pdb file in a dict:</p>
<p><br>
</p>
<p></p>
<div>import os<br>
from chimerax.core.commands import run as rc<br>
<br>
# change to folder with data files<br>
os.chdir("/home/ubuntu/Desktop/Chimerax_search/N_crassa_pdb")<br>
<br>
# gather the names of .pdb files in the folder<br>
file_names = [fn for fn in os.listdir(".") if fn.endswith(".pdb")]<br>
<br>
# give path to query file to be searched against pdb library<br>
query = "/home/ubuntu/Desktop/Chimerax_search/query/BDFB_007497.pdb"<br>
<br>
# open the query file as #1 in ChimeraX <br>
rc(session, "open /home/ubuntu/Desktop/Chimerax_search/query/BDFB_007497.pdb")<br>
<br>
# create empty dict to collect matchmaker output<br>
output = {}<br>
<br>
# loop through the files, opening, processing, and closing each in turn<br>
for fn in file_names:<br>
id = fn.split("/")[-1].split(".")[0]<br>
rc(session, "open " + fn)<br>
match = rc(session, "match #1 to #2")<br>
output.update({id : match})<br>
rc(session, "log save " + fn.split(".")[0] + ".log")<br>
rc(session, "close #2")<br>
rc(session, "log clear")<br>
<br>
# display dict<br>
print(output)</div>
<p></p>
<p><br>
</p>
<p>For now I just used 4 target pdbs with my query and only tried printing the result to quickly check if it fits. However the result is a bit baffling to me. I do get the RMSD values, but not the other data:</p>
<p><br>
</p>
<p><span style="color: rgb(0, 0, 0); font-family: "DejaVu Serif"; font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">{'NCU01382':
[{'full match atoms': <chimerax.atomic.molarray.Atoms object at 0x7f1944492130>, 'full ref atoms': <chimerax.atomic.molarray.Atoms object at 0x7f194448f610>, 'final match atoms': <chimerax.atomic.molarray.Atoms object at 0x7f1946694430>, 'final ref atoms':
<chimerax.atomic.molarray.Atoms object at 0x7f1946694550>, 'full RMSD': 63.065617285514556, 'final RMSD': 1.365365439813019, 'transformation matrix': <chimerax.geometry.place.Place object at 0x7f194669c130>, 'aligned ref seq': <chimerax.atomic.molobject.Sequence
object at 0x7f19f7b8f8b0>, 'aligned match seq': <chimerax.atomic.molobject.StructureSeq object at 0x7f19f7b8f610>}</span></p>
<p><br>
</p>
<p>here is one of the resulting hits, for my first target pdb (NCU01382). As you can see, the RMSD scores are correctly given, but for other values the internal object names and no resulting value are displayed. Any help with figuring this out would be greatly
appreciated.<br>
</p>
<p><br>
</p>
<p>Best Wishes<br>
Milan Borchert<br>
</p>
<p><br>
</p>
<p><br>
</p>
</div>
</body>
</html>