The Molecular Graphics Laboratory Forum

AutoDock, AutoLigand, MGLTools, Vina, PyRx and more.
It is currently Sun May 26, 2013 6:42 am

All times are UTC




Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Tue Feb 09, 2010 10:57 am 
Offline
Micromolar User
Micromolar User
User avatar

Joined: Tue Jan 26, 2010 7:41 am
Posts: 45
I am trying to run the script prepare_flexreceptor4.py in the following way:

prepare_flexreceptor4.py -r protein.pdbqt -s GLU345 -v

However I get a Python error:

set verbose to True
read protein.pdbqt
names_by_chain= ['GLU345']
processing res_names_by_chain= GLU345
Traceback (most recent call last):
File "/usr/people/douglas/programs/mgltools_i86Linux2_1.5.4/MGLToolsPckgs/AutoDockTools/Utilities24/prepare_flexreceptor4.py", line 128, in <module>
res_names.split('_')
NameError: name 'res_names' is not defined

Is this a possible bug? I have MGL tools 1.5.4.


Last edited by Douglas Houston on Fri Feb 12, 2010 1:32 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Feb 10, 2010 7:38 pm 
Offline
Nanomolar user
Nanomolar user
User avatar

Joined: Sun Jun 21, 2009 11:37 pm
Posts: 99
This is a bug in prepare_flexreceptor4.py which was corrected 10/2009.

You can obtain the corrected version by updating MGLToolsPckgs.
To do so, from the ADT GUI click on Help->Update.

Best wishes,
Ruth


Top
 Profile  
 
PostPosted: Fri Feb 12, 2010 1:28 pm 
Offline
Micromolar User
Micromolar User
User avatar

Joined: Tue Jan 26, 2010 7:41 am
Posts: 45
Hi Ruth,

I did as you suggested and the update seemed to work (updated 1.5.4 rev28 to 1.5.4 rev30) but I still got the error. I did "ls -l prepare_flexreceptor4.py" and the timestamp had not been changed.

I tried downloading MGLTools manually and copying the prepare_flexreceptor4.py from the download to the correct location (/MGLToolsPckgs/AutoDockTools/Utilities24/) but still got the error.

This is the header from the file I just downloaded today:
$Header: /opt/cvs/python/packages/share1.5/AutoDockTools/Utilities24/prepare_flexreceptor4.py,v 1.5.2.1 2009/07/17 16:55:53 rhuey Exp $

I should point out that I never had any trouble setting up flexible recopter docking using the GUI, only when using the prepare_flexreceptor4.py script from the command line.


Top
 Profile  
 
PostPosted: Fri Feb 12, 2010 1:36 pm 
Offline
Micromolar User
Micromolar User
User avatar

Joined: Tue Jan 26, 2010 7:41 am
Posts: 45
Looking in the script this section seems to be the culprit (although I can't be sure because I don't know Python):

Code:
    for res_names_by_chain in names_by_chain:
        #check for ':'
        if verbose: print "processing res_names_by_chain=", res_names_by_chain
        if res_names_by_chain.find(':')==-1:
            # no ':' so treat simple case
            # ARG8_ILE84
----------->res_names.split('_')
            for n in res_names:
                res = r.chains.residues.get(lambda x: x.name==n)
                all_res += res
                if verbose: print "case no ':' get: adding ", res.name, " to ", all_res


This instance of res_names is the first place it appears in the script - it doesn't appear to get assigned any values anywhere.


Top
 Profile  
 
PostPosted: Fri Feb 12, 2010 4:30 pm 
Offline
Nanomolar user
Nanomolar user
User avatar

Joined: Sun Jun 21, 2009 11:37 pm
Posts: 99
What OS are you using?
Apparently the update mechanism failed and we need to repair it!

Nonetheless, I can send you the file as an attachment to an email
OR
it should be possible for you to make a minor cautious** text edit to prepare_flexreceptor4.py to get it working.
[**Since python is white-space delimited]

Note these lines (which are lines 129 + 130 in my version) in particular:
if res_names_by_chain.find(':')==-1:
res_names = res_names_by_chain.split('_')

Here is the content of prepare_flexreceptor4.py after the update on my linux computer:
#!/usr/bin/env python
#
#
#
# $Header: /opt/cvs/python/packages/share1.5/AutoDockTools/Utilities24/prepare_flexreceptor4.py,v 1.5.2.2 2009/10/09 18:17:08 rhuey Exp $
#
import os

from MolKit import Read
from MolKit.protein import ProteinSet, ResidueSet
from MolKit.molecule import BondSet
from MolKit.stringSelector import CompoundStringSelector

from AutoDockTools.MoleculePreparation import AD4FlexibleReceptorPreparation



if __name__ == '__main__':
import sys
import getopt


def usage():
"Print helpful, accurate usage statement to stdout."
print "Usage: prepare_flexreceptor4.py -r receptor_filename -s list_of_names_of_residues_to_move"
print " Description of command..."
print " -r receptor_filename (.pdbqt)"
print " -s specification for flex residues"
print " Use underscores to separate residue names:"
print " ARG8_ILE84 "
print " Use commas to separate 'full names' which uniquely identify residues:"
print " hsg1:A:ARG8_ILE84,hsg1:B:THR4 "
print " [syntax is molname:chainid:resname]"
print " Optional parameters:"
print " [-v] verbose output"
print " [-N] type(s) of bonds to disallow: "
print " [-P] pairs of atom names bonds between which to disallow: "
print " [-g pdbqt_filename] (rigid output filename)"
print " [-x pdbqt_filename] (flexible output filename)"

# process command arguments
try:
opt_list, args = getopt.getopt(sys.argv[1:], 'r:vs:N:P:g:x:h')
except getopt.GetoptError, msg:
print 'prepare_flexreceptor4.py: %s' %msg
usage()
sys.exit(2)

# initialize required parameters
#-r: ligand
receptor_filename = None
#-s: residues_to_move
residues_to_move = None
# optional parameters
verbose = None
#-N: type of bonds to disallow
disallow = ""
#-P: pairs of atom names bonds between which to disallow
disallowed_pairs = ""
#-g : rigid output filename
rigid_filename = None
#-x : flexible output filename
flexres_filename = None

#'r:vs:N:g:x:h'
for o, a in opt_list:
#print "o=", o, " a=", a
if o in ('-r', '--r'):
receptor_filename = a
if verbose: print 'set receptor_filename to ', a
if o in ('-v', '--v'):
verbose = True
if verbose: print 'set verbose to', True
if o in ('-s', '--s'):
residues_to_move = a
if verbose: print 'set residues_to_move to ', a
if o in ('-N', '--N'):
disallow = a
if verbose: print 'set disallow to ', a
if o in ('-P', '--P'):
disallowed_pairs = a
if verbose: print 'set disallowed_pairs to ', a
if o in ('-g', '--g'):
rigid_filename = a
if verbose: print 'set rigid_filename to ', a
if o in ('-x', '--'):
flexres_filename = a
if verbose: print 'set flexres_filename to ', a
if o in ('-h', '--'):
usage()
sys.exit()


if not receptor_filename:
print 'prepare_flexreceptor4: receptor filename must be specified!\n'
usage()
sys.exit()

if not residues_to_move:
print 'prepare_flexreceptor4: residues to move must be specified!\n'
usage()
sys.exit()

extension = os.path.splitext(receptor_filename)[1]
if extension!=".pdbqt":
print 'prepare_flexreceptor4: receptor file must be in .pdbqt format\n'
usage()
sys.exit()

r = Read(receptor_filename)[0]
r.buildBondsByDistance()
if verbose: print 'read ', receptor_filename

all_res = ResidueSet()
# hsg1:A:ARG8_ILE82;hsg1:B:THR4
# ARG8_ILE84
names_by_chain = residues_to_move.split(',')
if verbose:
print "Specified flexres selection strings are:"
for strN in names_by_chain:
print " %s" %strN
#1. ['hsg1:A:ARG8_ILE82','hsg1:B:THR4']
# OR
#2. ARG8_ILE84
for res_names_by_chain in names_by_chain:
#check for ':'
if verbose: print "selecting ", res_names_by_chain
if res_names_by_chain.find(':')==-1:
# no ':' in selection string = simple case eg: ARG8_ILE84
res_names = res_names_by_chain.split('_')
if verbose: print "res_names=", res_names
for n in res_names:
if verbose: print "looking for ",n
res = r.chains.residues.get(lambda x: x.name==n)
if len(res):
all_res += res
if verbose: print " added ", res.name, " to ", all_res
else:
print "WARNING: no residue named " + n
else:
# 'hsg1:A:ARG8_ILE82'
# '1JFF_protein:A:THR179_GLU183,1JFF_protein:B:TRP21_ARG64_LEU275'
chainStart = res_names_by_chain.index(':')+1
molName = res_names_by_chain[:chainStart-1]
#if verbose: print "molName = ", molName, " chainStart=", chainStart
n = res_names_by_chain[chainStart:].replace("_", ",")
#if verbose: print "after comma replaced _ n is ", n, '\n'
selStr = molName + ":" + n
#if verbose: print "now selStr", selStr
# 'hsg1:A:ARG8,ILE82'
#res, msg = CompoundStringSelector().select(ProteinSet([r]), n)
res, msg = CompoundStringSelector().select(ProteinSet([r]), selStr)
#if verbose: print selStr, " selection =", res, " msg=", msg, '\n'
if len(res):
all_res += res
else:
print "no residue found using string ", selStr
#if verbose: print "built all_res=", all_res.full_name()
#check for duplicates
d = {}
for res in all_res: d[res] = 1
all_res = d.keys()
all_res = ResidueSet(all_res).uniq()
all_res.sort()
if verbose:
print "located ", len(all_res), " residues to format:"
for z in all_res: print " %s" %z.full_name()

#inactivate specified bonds
#disallowed_Pairs "CA_CB:CB_CG:C_CA"
all_bnds = BondSet()
#inactivate specified bonds
#disallowed_pairs "CA_CB:CB_CG:C_CA"
if len(disallowed_pairs):
bnd_pairs = disallowed_pairs.split(':')
for pair in bnd_pairs:
names = pair.split('_')
bnds = all_res.atoms.bonds[0].get(lambda x: x.atom1.name in names and x.atom2.name in names)
if len(bnds):
all_bnds += bnds

if verbose: print "beginning formatting ..."
fdp = AD4FlexibleReceptorPreparation(r, residues=all_res, rigid_filename=rigid_filename,
flexres_filename=flexres_filename,
non_rotatable_bonds=all_bnds)

if verbose: print "finished!"

# To execute this command type:
# prepare_flexreceptor4.py -l filename -r receptor_filename -s list_of_names_of_residues_to_move"







Would you please provide the information at the very top of your local copy of prepare_felxreceptor4.py which includes a revision number and a date?


Top
 Profile  
 
PostPosted: Fri Feb 12, 2010 11:23 pm 
Offline
Micromolar User
Micromolar User
User avatar

Joined: Tue Jan 26, 2010 7:41 am
Posts: 45
Thanks a lot for your help,

I am using Fedora 8 to run the programs.

Please could you try downloading the package "mgltools_i86Linux2_1.5.4.tar.gz" from this page?:

http://mgltools.scripps.edu/downloads

When I extract the prepare_flexreceptor4.py file from it (on my Windows machine at home) this is the header:

#!/usr/bin/env python
#
#
#
# $Header: /opt/cvs/python/packages/share1.5/AutoDockTools/Utilities24/prepare_flexreceptor4.py,v 1.5.2.1 2009/07/17 16:55:53 rhuey Exp $
#

So although the automatic update did indeed fail there appears to be other problems.


Top
 Profile  
 
PostPosted: Wed Feb 24, 2010 6:55 pm 
Offline
Site Admin
Site Admin
User avatar

Joined: Fri Oct 17, 2008 10:39 pm
Posts: 399
Thanks for the message Douglas. Could you please run the following command to get the latest updates:
Code:
cd /usr/people/douglas/programs/mgltools_i86Linux2_1.5.4/MGLToolsPckgs/AutoDockTools
cvs update

I've checked the file in downloads page and it indeed doesn't include the latest changes Ruth made. The GUI update (Help->Update) is supposed to download and install the latest changes from: http://mgltools.scripps.edu/downloads/t ... est-tested. The version number for prepare_flexreceptor4.py is 1.5.2.2 currently. Using cvs update command from above should do the job.

_________________
Sarkis Dallakian - Google Profile - PyRx - Nutrition Facts | Food Prints - Clinical Trials Finder | ClisMap


Top
 Profile  
 
PostPosted: Thu Mar 11, 2010 8:09 am 
Offline
Micromolar User
Micromolar User
User avatar

Joined: Tue Jan 26, 2010 7:41 am
Posts: 45
sargis wrote:
Thanks for the message Douglas. Could you please run the following command to get the latest updates:


Thanks Sargis. The cvs command seemed to successfully update the Python scripts.

However, now when I try to run prepare_receptor4.py, I get the following error:

Code:
/usr/people/douglas/programs/mgltools_i86Linux2_1.5.4/MGLToolsPckgs/AutoDockTools/Utilities24/prepare_receptor4.py -r 1MVH_H.pdb
Traceback (most recent call last):
  File "/usr/people/douglas/programs/mgltools_i86Linux2_1.5.4/MGLToolsPckgs/AutoDockTools/Utilities24/prepare_receptor4.py", line 179, in <module>
    dict=dictionary)
TypeError: __init__() got an unexpected keyword argument 'dict'


This error is the same on all receptor pdbs I have tried prepare_receptor4.py on, all of which worked fine before I did the update.


Top
 Profile  
 
PostPosted: Mon Mar 22, 2010 5:46 pm 
Offline
Micromolar User
Micromolar User
User avatar

Joined: Tue Jan 26, 2010 7:41 am
Posts: 45
If I revert to an older version of the script the problem goes away and everything runs as normal:

Code:
#!/usr/bin/env python
#
#
#
# $Header: /opt/cvs/python/packages/share1.5/AutoDockTools/Utilities24/prepare_receptor4.py,v 1.11 2007/11/28 22:40:22 rhuey Exp $


Top
 Profile  
 
PostPosted: Tue Apr 13, 2010 9:13 am 
Offline
Micromolar User
Micromolar User
User avatar

Joined: Tue Jan 26, 2010 7:41 am
Posts: 45
Hi Ruth/Sargis,

would you be able to check this error? Although reverting to the old version of prepare_receptr4.py works, I'd like to be using the newsest version.

So using this version of prepare_receptor4.py:
Code:
-> head  prepare_receptor4.py
#!/usr/bin/env python
#
#
#
# $Header: /opt/cvs/python/packages/share1.5/AutoDockTools/Utilities24/prepare_receptor4.py,v 1.11.4.2 2010/01/25 23:34:58 rhuey Exp $
#
import os


Using the following command:
Code:
-> /usr/people/douglas/programs/mgltools_i86Linux2_1.5.4/MGLToolsPckgs/AutoDockTools/Utilities24/prepare_receptor4.py -r 3CVR.pdb


I get the following error:
Code:
Traceback (most recent call last):
  File "/usr/people/douglas/programs/mgltools_i86Linux2_1.5.4/MGLToolsPckgs/AutoDockTools/Utilities24/prepare_receptor4.py", line 179, in <module>
    dict=dictionary)   
TypeError: __init__() got an unexpected keyword argument 'dict'


Could I please get some help with this?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: Heritrix [Crawler] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
POWERED_BY
Translated by Maël Soucaze © 2009 phpBB.fr