yasara.SavePDB(1, "%s%s.pdb" % (path, pdb1))
yasara.SavePDB(2, "%s%s.pdb" % (path, pdb2))
os.system("%ssheba -x %s%s.pdb %s%s.pdb" % (path, path, pdb1, path, pdb2))
os.system("%ssheba -t %s%s.pdb %s%s.trf" % (path, path, pdb2, plg, pdb2))
os.system("rm %s*.trf" % plg)
Here, SSM functions in offline mode.
In this mode, it cannot compare more than two structurs, neither to extract under units from a compound as it is the case on the web site. SSM offline offers less functions than web site, but it is enough for us for superposition.
For the SSM needs, a file input.xml is created which will be used for the comparison of the structurs.
file = open("%s" % inp, "w")
file.write("""
SSM doesn't use a pdb file, but a .ent file which one can't be read by YASARA.
It is not boring, because the .ent files are only used to give the molecules name in the input file.
Then, we launch SSM in offline mode. SSM provides normally only one output file called sortie.xml.
os.system("%sssmserver -offline %s %s %s" % (ssmserver, inp, out, ssmconf))
This output files is read, the script extract a part of the coordinates molecules, to apply a transformation matrix to these molecules.
file = open("%s%s%s.xml" % (sortie, mol1, mol2), "r")
while 1:
line = file.readline()
line = string.lstrip(line)
if line[:10] == "<RTMatrix>":
xx = float(string.lstrip(file.readline())[5:-7])
xy = float(string.lstrip(file.readline())[5:-7])
xz = float(string.lstrip(file.readline())[5:-7])
tx = float(string.lstrip(file.readline())[4:-6])
yx = float(string.lstrip(file.readline())[5:-7])
yy = float(string.lstrip(file.readline())[5:-7])
yz = float(string.lstrip(file.readline())[5:-7])
ty = float(string.lstrip(file.readline())[4:-6])
zx = float(string.lstrip(file.readline())[5:-7])
zy = float(string.lstrip(file.readline())[5:-7])
zz = float(string.lstrip(file.readline())[5:-7])
tz = float(string.lstrip(file.readline())[4:-6])
break
The final result is another pdb file named: name_pdb2.pdb.pdb instead of an xml file as in SSM. The diffuclty lied in the creation of the matrix transformation.
FLEXPROT creates file with the extension .res too.
os.system("%sflexprot %s%s.pdb %s%s.pdb" % (path, path, pdb1, path, pdb2))
os.system("mv %s*.res %s" % (plg, path))
The characteristic of this script lies in the fact that the file chosen to lead to the final pdb, is the file ?trans.res where ? indicates the highest number, that is to say the last file created. To find this file, I use the fonction len(glob.glob()) to find the number of file in the same directory. This value is then integrated into the execution command. The choice of the file was made beacuse of the number of hinges.
a = len(glob.glob("%s*trans.res" % path))
solution = path+"result_transf.pl"
file = path+ str(a-1) + "trans.res"
command = solution+ " " + file+" "+ "%d" % (a-1)
This character string allows a lightening of the synthaxe, and to choose the good file according to the number of result.
After several tests, the results are better with this files (to modify the loaded files see use).
NB: the loaded file is transSecond.pdb, it is also possible to change it by join.pdb
The useless files *.res are deleted.
It is the only one to superpose severals structurs. Script was made in order to superpose an "infinite" number of structures. We had to find a method of recurrence to save n files and to launch the command with these n files. At first, there is creation of a list of the elements selected in order to save those selected.
Note: the results can differ if we choose another file with a different hinge for Flexprot and Multiprot.
liste = []
x = 0
while x < pdb:
liste.append(yasara.selection[0].object[x].name[:4])
x = x+1
yasara.Finish()
mypdb = []
for i in range(len(liste)):
yasara.SavePDB(i+1, path+liste[i]+".pdb")
mypdb.append(path+liste[i]+".pdb")
yasara.Finish()
dico = {"SHEBA" : plgsheba, "FLEXPROT" : plgflexprot, "SSM" : plgssm, "MULTIPROT" : plgmultiprot}
select = []
x = 0
while x < selecteditems :
select.append(yasara.selection[1].listentry[x])
x = x+1
for i in select:
dico[i]()
This last command launch the software selected.