[Chimera-users] Way to extract path to file from model ID

Oliver Clarke olibclarke at gmail.com
Thu Sep 24 13:39:54 PDT 2015


Hi all, I’m wondering, is there any way (presumably via a python function) to get the path to the original file from the model ID?

I’ve written a little python jiffy (below) so I can lowpass filter maps to a specified resolution on the fly inside chimera using EMAN, but is quite slow because I need to first write a copy of the map out (so I know where it is) and then modify it. If anyone knows of an easier way to do such things I would be most grateful.

Cheers,
Oli.

Script:

def cmd_lowpass(lowpass,args):
  from Midas.midas_text import doExtensionFunc
  def lowpass(model,resol):
    import os
    from chimera import runCommand
    import subprocess
    import sys
    #You may need to change the below to .bash_profile if on mac.
    #You must have EMAN2 in your bash path for this to work correctly.
    #If running multiple times, you need to close the first instance of lowpass.mrc before creating a second.
    bashrc_path=os.path.expanduser("~/.bashrc")
    freq=1.0/resol
    command="cd ~; system mkdir chimera_tmp; cd chimera_tmp; volume "+model+" save ./tmp1.mrc"
    runCommand(command)
    pathvar=os.path.expanduser("~/chimera_tmp")
    os.chdir(pathvar)
    e2string="--process=filter.lowpass.gauss:cutoff_freq="+str(freq)
    print(e2string)
    mrc_in=pathvar+"/tmp1.mrc"
    mrc_out=pathvar+"/lowpass.mrc"
    e2command="source "+bashrc_path+"; bash -c \"e2proc3d.py"+" "+mrc_in+" "+mrc_out+" "+e2string+"\""
    print(e2command)
    proc=subprocess.Popen(e2command,stdout=subprocess.PIPE, stderr=subprocess.PIPE,shell=True)
    out, err = proc.communicate()
    print 'stdout:', out
    print 'stderr:', err
    runCommand("open lowpass.mrc")
  doExtensionFunc(lowpass,args)
from Midas.midas_text import addCommand
addCommand("lowpass", cmd_lowpass, help=False)



More information about the Chimera-users mailing list