Python Programming for Biology: Bioinformatics and Beyond



Download 7,75 Mb.
Pdf ko'rish
bet233/514
Sana30.12.2021
Hajmi7,75 Mb.
#91066
1   ...   229   230   231   232   233   234   235   236   ...   514
Bog'liq
[Tim J. Stevens, Wayne Boucher] Python Programming

Structures in PyMol

To view structures graphically with the PyMol

18

program, assuming that it is installed, it is



a simple matter to import its functionality into a Python script.

19

import pymol



With  PyMol  imported  we  call  a  function  which  causes  the  graphical  environment  to

appear, so that we can see step-by-step what effects our instructions have.

pymol.finish_launching()

Using  the  name  of  a  PDB  file  we  have  previously  downloaded  we  load  the  structure

data  for  a  protein  called  glycophorin

20

 into  PyMol  and  then  issue  several  commands  to



render the structure in a particular graphical form. It is notable that PyMol doesn’t have a

rich data model for this data. Thus, rather than working with objects that represent each of

the structural entities, we make copious use of the pymol.cmd module to perform most of

the operations using special instruction strings, which unfortunately we must learn. Here

we load the structure and give it a name, which can be used to identify the whole data set

in later commands.

fileName = downloadPDB('examples/1AFO')

strucName = 'Glycophorin'

pymol.cmd.load(fileName, strucName)

Two  subsets  of  the  structure  are  defined:  one  called  ‘bb’  to  represent  the  protein

backbone,  where  the  ‘magic’  string  to  select  the  backbone  heavy  atoms  is  ‘name

n+c+o+ca’; and another called ‘tmd’ that corresponds to the transmembrane

21

part of the



structure, from residue number 71 to 100.

pymol.cmd.select('bb','name n+c+o+ca')

pymol.cmd.select('tmd', 'resi 71-100 and name n+c+o+ca ')

Next various commands are issued to change the way that various bits of the structure

are  displayed.  In  order,  the  operations  do  the  following:  colour  the  whole  protein  grey,

colour the backbone selection red, display the backbone path as a ‘cartoon’ ribbon, colour

the transmembrane residues blue and finally hide the lines to the hydrogen atoms.

pymol.cmd.color('gray', strucName)

pymol.cmd.color('red', 'bb')

pymol.cmd.show('cartoon', 'bb')

pymol.cmd.color('blue', 'tmd')

pymol.cmd.hide('lines','hydro')

outFileName = strucName + '.pdb'

pymol.cmd.save(outFileName, strucName, 0, 'pdb')




And the graphical display may be output as a picture file (here in PNG format):

pymol.cmd.png(strucName+'.png')

Finally we can quit the display program, but otherwise leave any Python script running:

pymol.cmd.quit()




Download 7,75 Mb.

Do'stlaringiz bilan baham:
1   ...   229   230   231   232   233   234   235   236   ...   514




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish