PLUG-IN


The programmation language used is python. The choice was made because of Yasara, the plugin can only be made in python or yanaconda (see documentation).


The logic of each part of the plugin is the same one.
Indeed, the script saves each pdb files on hard disk, then they are read in YASARA, and it is only then, that the superposition itself is carried out. YASARA posts only the files. SSM, FLEXPROT and SHEBA make it possible only in this state to superpose two structurs. Only MULTIPROT can superpose more than two structurs.

The commands in order to launch the softwares are integreted with function : def plgnomdulogiciel().

SHEBA


SHEBA allows the superposition of two structures.
The first command is used to save the pdbfiles on hard disk.


yasara.SavePDB(1, "%s%s.pdb" % (path, pdb1))
yasara.SavePDB(2, "%s%s.pdb" % (path, pdb2))


Those are used by SHEBA to create the file *.trf which corresponds to the matrix of transformation of one of the two pdb files. The last command removes the files *.trf created not to occupy the disk space.

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)


SSM

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

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.

MULTIPROT

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.

As in FLEXPROT, the intermediate files chosen are those giving the greatest number of hinges point.

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()

The elements of this list are gathered in another list so these elements are used as source files to MULTIPROT. We have the superposition of all selected elements. The created files useless are removed. It is also possible to change the loaded file, and to replace it by join.pdb or joinPart.pdb (see use)

As we said, this various software was defined to be integrated in the plugin, but the call of this various software is done by a list creation.

CALLING A SOFTWARE:

I have created a line allowing to make correspond the software selected to the good part of script in order to launch the selected software. I use the dictionaries to solve this problem of correspondence.

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.

Back to top