File: adt3

package info (click to toggle)
autodocktools 1.5.7~rc1+cvs.20140424-1
  • links: PTS, VCS
  • area: non-free
  • in suites: jessie-kfreebsd
  • size: 62,336 kB
  • ctags: 5,962
  • sloc: python: 65,627; xml: 843; sh: 511; makefile: 19
file content (136 lines) | stat: -rwxr-xr-x 5,000 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/usr/bin/python
#
import sys, getopt

optlist, args = getopt.getopt(sys.argv[1:], 'hai', [
            'help', 'again', 'overwriteLog', 'uniqueLog', 'noLog', 'die',
	    'customizer=', 'interactive'] )

help_msg = """usage: %s <options>
        -h or --help       : print this message
        -a or --again      : play back lastlog file
        --overwriteLog     : overwrite log file
        --uniqueLog        : create a log file with a unique name
        --noLog            : turn off logging
        --die              : do not start GUI event loop
        --customizer file  : run the user specified file
        --lib packageName  : add a libraries of commands""" % sys.argv[0]
customizer = None
logmode = 'overwrite'
libraries = []
again = 0
interactive = 0
die=0

for opt in optlist:
    if opt[ 0] in ('-h', '--help'):
        print help_msg
        sys.exit()
    elif opt[ 0] in ('-a', '--again'):
        again = 1
	import os
        os.system("mv mvAll.log.py .tmp.py")
    elif opt[ 0] =='--overwriteLog': logmode = 'overwrite'
    elif opt[ 0] =='--uniqueLog': logmode = 'unique'
    elif opt[ 0] =='--noLog': logmode = 'no'
    elif opt[ 0] =='--die': die = 1
    elif opt[ 0] == '--customizer':
        customFile = opt[1]
    elif opt[ 0] == '--lib':
        libraries.append(opt[1])
    elif opt[ 0] in ('-i', '--interactive'):
	interactive = 1
    else:
        print "unknown option %s %s"%tuple(opt)
        print help_msg
        sys.exit( 1)

sys.path.insert(0, '.')
try:
    import AutoDockTools
    print 'Run AutoDockTools from', AutoDockTools.__path__[0]

    from Pmv.moleculeViewer import MoleculeViewer
    mv = MoleculeViewer( title='AutoDockTools3',
                         logMode=logmode, customizer=customizer,
                         withShell= not interactive)
#                        libraries=libraries)
    atorsList = [ 'ADtors_readLigand', 'ADtors_chooseLigand', 
    'ADtors_setRoot', 'ADtors_autoRoot', 'ADtors_markRoot',
    'ADtors_defineRotBonds', 'ADtors_setBondRotatableFlag', 
    'ADtors_limitTorsionsGC', 'ADtors_limitTorsions', 
    'ADtors_changePlanarCarbonsToA', 'ADtors_changeAromaticCarbonsToC', 
    'ADtors_setCarbonNames', 'ADtors_changePlanarityCriteria',
    'ADtors_rigidLigand', 'ADtors_writeFormattedPDBQ',
    'ADtors_showRootSphere', 'ADtors_automaticLigandFormatting'] 
    mv.browseCommands('autotorsCommands', commands=atorsList, package='AutoDockTools')
    gpfList = [ 'ADgpf_initMacro','ADgpf_initMacro', 
    'ADgpf_readMacromolecule', 
    'ADgpf_chooseMacromolecule', 
    'ADgpf_addSolvationParameters',
    'ADgpf_checkMacroTypes',
    'ADgpf_initLigand', 'ADgpf_setMapTypes', 
    'ADgpf_readFormattedLigand', 'ADgpf_chooseFormattedLigand', 
    'ADgpf_selectCenter', 'ADgpf_setGrid', 'ADgpf_setGpo',
    'ADgpf_writeGPF',  'ADgpf_editGPF']
    #'ADgpf_setOtherOptions',  'ADgpf_setUpCovalentMap',
    mv.browseCommands('autogpfCommands', commands=gpfList, package='AutoDockTools')
    dpfList = ['ADdpf_read', 'ADdpf_readMacromolecule', 
        'ADdpf_readFormattedLigand', 'ADdpf_chooseFormattedLigand', 
        'ADdpf_initLigand', 'ADdpf_setDpo', 
        'ADdpf_setSAparameters',
        'ADdpf_setGAparameters', 'ADdpf_setLSparameters', 
        'ADdpf_setDockingParameters', 'ADdpf_writeSA',
        'ADdpf_writeGA', 'ADdpf_writeLS', 'ADdpf_writeGALS', 
        'ADdpf_edit' ]
    mv.browseCommands('autodpfCommands', commands=dpfList, package='AutoDockTools')
    mv.browseCommands('autostartCommands', package='AutoDockTools')
    mv.browseCommands('autoanalyzeCommands', package='AutoDockTools')
    # Here just the time to fix the loadCommands
    mv.browseCommands('selectionCommands', package='Pmv')
    #mv.customize('_adtrc')

    self=mv
    for a in args:
        print a
	if a[0]=='-':# skip all command line options
	    continue

        elif a[-7:]=='_net.py':  # Vision networks
            mv.browseCommands('visionCommands', commands=('vision',) )
            if mv.vision.ed is None:
                mv.vision()
            mv.vision.ed.loadNetwork(a)

        elif a[-3:]=='.py':     # command script
            print 'sourcing', a
            mv.source(a)

        elif a[-4:] in ['.pdb', '.pqr', 'pdbq', 'mol2'] or a[-5:]=='pdbqs':
            mv.readMolecule(a)

        else:
            print 'WARNING: unable to process %s command line argument'%a
    if again:
        mv.source(".tmp.py")

    ##################################################################
    # Set the Python Shell
    ##################################################################
    if interactive:
        sys.stdin = sys.__stdin__
        sys.stdout = sys.__stdout__
        sys.stderr = sys.__stderr__
        import code
        code.interact( 'AutoDockTools Interactive Shell', local=globals() )
    elif not die:
        mv.GUI.ROOT.mainloop()

except:
    import traceback
    traceback.print_exc()
    raw_input("hit enter to continue")
    import sys
    sys.exit( 1)
import sys, getopt