Thanks Jason. But still no luck...
So, I changed it to a python script. It was important that the ending of the
file is .py :-)
But, I can see from the list of objects, that PyMOL fetches the next protein
before it has finished propka first.
Does pymol run external script in some kind of asynchron mode as default?
-
import pymol
from pymol import cmd
import os
os.chdir("/homes/linnet/Documents/Speciale/5NT-project/Mutant-construct/predict_reactivity/Comparison/Match")
cmd.cartoon("auto")
cmd.set("cartoon_fancy_helices","1")
cmd.bg_color("white")
cmd.set("fog","0")
cmd.set("cartoon_transparency","0.7")
cmd.set("auto_zoom","off")
import propka
#resis =
[["1bj6","36"],["1bj6","39"],["1bj6","49"],["1ag1","14"],["1gu9","133"],["1gu9","130"],["1omu","56"],["1khg","273"],["2trx","35"],
#["1tde","32"],["1tde","35"],["2ovo","56"],["1m8b","56"],["1hic","39"],["1m8c","56"],["1ppo","25"],["1qlp","232"]]
resis = [["1ppo","25"],["1qlp","232"]]
i = 0
results = []
for p,r in resis:
cmd.fetch(p,async="0")
cmd.refresh()
# When we import a module in python, the namespace is normally:
module.function
# And we see, that propka expect resi to be in "str" format.
# And we don't want the logtime function
pkavalues = propka.propka(molecule=p,resi=r,resn="CYS",logtime=i)
results.append(pkavalues)
cmd.refresh()
i = i + 1
cmd.zoom("all")
print results[0]
print results[1]
2011/8/28 Jason Vertrees
> Hi Troels,
>
> In PyMOL, it you try the following, what happens for you?
>
> # make this a file called chill.py
> import time
> def chill():
>rightThisSecond = time.time()
>i = 0
>while time.time() < rightThisSecond + 3.0:
>i+=1
>print "The farthest I could count in 3 seconds was %d." % i
>
> # make this a file called troels.py
> import pymol
> from pymol import cmd
> import chill
> resis = [ ["1bj6","36"], ["1bj6","39"], ["1bj6","49"],
> ["1ag1","14"],
> ["1gu9","133"], ["1gu9","130"], ]
> for p,r in resis:
># fetch a protein
>cmd.fetch(p,async=0)
>print "-- Fetched %s" % p
># do something slow
>chill.chill()
># some post processing
>print "%s has %d atoms" % (p, cmd.count_atoms(p))
>print "%s/%s has %d atoms" % (p, r, cmd.count_atoms("%s and i. %s" %
> (p,r)))
>cmd.delete(p)
>print "-- Deleted protien"
>
>
> Now load PyMOL and try,
>
> run ~/troels.py
>
> Does PyMOL wait for the chill calls to finish? The idea is, wrap your
> call in a module/file and import it. Then, call through that function.
>
> It's about 3 AM my time and I'm sure there's a better solution--but
> this might work for now.
>
> Cheers,
>
> -- Jason
>
>
>
>
> 2011/8/26 Troels Emtekær Linnet :
> > Well, I cant get it to work.
> > Pymol speeds ahead of calling propka.propka
> >
> > Can you give an example of subprocess?
> > ---
> >
> > import propka
> >
> > python
> > resis = [["1bj6","36"],["1bj6","39"]]
> > #resis =
> >
> [["1bj6","36"],["1bj6","39"],["1bj6","49"],["1ag1","14"],["1gu9","133"],["1gu9","130"],["1omu","56"],["1khg","273"],["2trx","35"],
> >
> #["1tde","32"],["1tde","35"],["2ovo","56"],["1m8b","56"],["1hic","39"],["1m8c","56"]]
> > i = 0
> > for resi in resis:
> > cmd.fetch(resi[0],async="0")
> > cmd.refresh()
> > # When we import a module in python, the namespace is normally:
> > module.function
> > # And we see, that propka expect resi to be in "str" format.
> > # And we don't want the logtime function
> > propka.propka(molecule=resi[0],resi=resi[1],logtime=i)
> > cmd.refresh()
> > i = i + 1
> > python end
> > zoom all
> >
> >
> >> hth
> >> Martin
> >>
> >> On 23.08.11 10:48, Troels Emtekær Linnet wrote:
> >>
> >> Hi.
> >>
> >> If one writes a pymol script, and calls an external function, the pymol
> >> script continues its operation before waiting for the "success" of the
> >> external function.
> >>
> >> Is it possible to give a keyword, so it "waits" for the external
> function
> >> before preceding?
> >>
> >> Kind of the same function with:
> >> fetch 1hp1, async=0
> >>
> >> Best
> >> Troels
> >>
> >>
> >>
> --
> >> Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
> >> user administration capabilities and model configuration. Take
> >> the hassle out of deploying and managing Subversion and the
> >> tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
> >>
> >> ___
> >> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> >> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> >> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
> >>
> >>
> >>
> --
> >> Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
> >> user administration capabilities and model configuratio