This file is indexed.

/usr/share/autodock/Tests/test_autodock4.py is in autodock-test 4.2.5.1-3ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
#! /usr/bin/env python
#
# $Id: test_autodock4.py,v 1.61 2012/12/13 06:44:43 mp Exp $
#

"""
Unit Tests for AutoDock 4.
"""

#______________________________________________________________________________

import sys
import os
import unittest
import getopt
import subprocess
from DlgParser import DlgParser

#______________________________________________________________________________
#
# Global variables

autodock_executable = "../autodock4" # where the AutoDock executable resides
dpf_directory = '.' # where the input DPF files reside
test_output_directory = '.' # where the DLG files will be written

try:
    opts, argv = getopt.getopt(sys.argv[1:], "d:e:o:",
    ["dpf-directory=","executable=","test-output-directory="]) 
except getopt.GetoptError, v:
    usage() 
    sys.exit(2)

for o,a in opts:
    if o in ("-d", "--dpf-directory"):
        dpf_directory = a
    if o in ("-e", "--executable"):
        autodock_executable = a
    if o in ("-o","--test-output-directory"):
        test_output_directory = a


#______________________________________________________________________________

def usage():
    """Print out the usage of this command."""
    print """Usage:  python test_autodock4.py [-d <string>] [-e <string>] [-o <string>]

where:
    -d, --dpf-directory
        specifies the directory containing the DPFs to be tested;
        this flag is optional; default is '.'
    -e, --executable
        specifies the path to the AutoDock executable to be tested;
        this flag is optional; default is '../autodock4'
    -o, --test-output-directory
        specifies the directory where the output DLGs will be written;
        this flag is optional; default is '.'

NOTE:  these may be relative to the directory where this script was invoked.
"""

#______________________________________________________________________________

def run_AutoDock( dpf_filename, dlg_filename ):
    """Launch AutoDock, using the specified AutoDock executable and DPF,
    create the specified DLG, and trap all the outputs from standard output
    and standard error."""
    dpf = dpf_directory + os.sep + dpf_filename
    dlg = test_output_directory + os.sep + dlg_filename
    rm( dlg )
    command =   [autodock_executable, '-p', dpf, '-l', dlg] 
    print '\nRunning ' + autodock_executable + ' using DPF "'+dpf+'", saving results in "'+dlg+'":'
    try:
        rc = subprocess.call( command )
	#print 'autodock returned ', rc  # DEBUG
        return find_success_in_DLG( dlg_filename )
    except OSError,e:
        print "\nUnable to run " + autodock_executable + " :", e
        return False

#______________________________________________________________________________

def parse_energy_from_DLG( dlg_filename, energy_list):
    """Parse the AutoDock DLG, and return the intermolecular and internal
    energies as a tuple."""
    parser = DlgParser()
    dlg = test_output_directory + os.sep + dlg_filename
    parser.parse( dlg )
    docked = parser.clist[0]  #dictionary of results
    result = []
    for energy_type in energy_list:
        newVal = docked.get(energy_type, 'ERROR')
        print energy_type, ' is now ', newVal
        result.append(docked.get(energy_type, 'ERROR'))
    #intermol_energy = docked['intermol_energy']  #-6.17
    #internal_energy = docked['total_internal']  # -1.58
    #print "docked[binding_energy]=", docked['binding_energy']
    #print "docked[electrostatic_energy]=", docked['electrostatic_energy']
    #print "docked[intermol_energy]=", docked['intermol_energy']
    #print "docked[total_internal]=", docked['total_internal']
    #unbound_energy = docked['unbound_energy']
    #print "unbound_energy=", unbound_energy
    #return ( intermol_energy, internal_energy )
    return result

#______________________________________________________________________________

def find_success_in_DLG( dlg_filename ):
    """Open the AutoDock DLG, and look for the string "Successful Completion"
    in the last 10 lines of the file."""
    dlg = test_output_directory + os.sep + dlg_filename
    try:
        fptr = open( dlg )
        lines = fptr.readlines()
        fptr.close()
        success = False
        for l in lines[-10:]:
            if l.find( "Successful Completion" ) > -1:
                success = True
        return success
    except:
        return False

#______________________________________________________________________________

def rm( filename ):
    """Remove single file """
    # no regular expression wildcards, e.g. * or ?, allowed
    if os.access(filename, os.F_OK) :
       try:
          os.remove( filename )
       except OSError,e:
         print 'unable to remove '+filename


#______________________________________________________________________________

class AutoDock_base_test( unittest.TestCase ):
    """Base Class for AutoDock testing."""
    """ do not instantiate this for a test, use simple_test or other subclass instead """
    dpf_stem = "BaseClass"
    computed = False
    def setUp( self ):
        """Set up for autodock4 tests. Locate the autodock binary now during setUp."""
        self.dlg_filename = "test_" + self.dpf_stem + ".dlg"
        self.computed = run_AutoDock( self.dpf_stem + ".dpf", self.dlg_filename )

    #def test_dlg_exists( self ):
    #    """Check that run finished and a new DLG has been computed."""
    #    # Check that run finished and a new DLG has been computed.
    #    if (self.expected_outcome == True ):
    #        print "Testing that DLG exists and AutoDock successfully completed."
    #    else:
    #        print "Testing that DLG exists and AutoDock did not complete."
    #    self.assertEqual( self.computed, self.expected_outcome )


#______________________________________________________________________________

class AutoDock_simple_test( unittest.TestCase ):
    """Base Class for AutoDock testing."""
    dpf_stem = "BaseClass"
    computed = False
    def setUp( self ):
        """Set up for autodock4 tests. Locate the autodock binary now during setUp."""
        self.dlg_filename = "test_" + self.dpf_stem + ".dlg"
        self.computed = run_AutoDock( self.dpf_stem + ".dpf", self.dlg_filename )

    def test_dlg_exists( self ):
        """Check that run finished and a new DLG has been computed."""
        # Check that run finished and a new DLG has been computed.
        if (self.expected_outcome == True ):
            print "Testing that DLG exists and AutoDock successfully completed."
        else:
            print "Testing that DLG exists and AutoDock did not complete."
        self.assertEqual( self.computed, self.expected_outcome )
#______________________________________________________________________________

class AutoDock4_1pgp_no_extension( AutoDock_simple_test ):
    """Test that autodock4 stops early if .dpf extension is missing
    keywords are specified."""
    dpf_stem = "1pgp_no_extension"
    print "in 1pgp_no_extension"
    expected_outcome = False # True means Successful Completion!
    def setUp( self ):
        """Set up for autodock4 tests. Locate the autodock binary now during setUp."""
        self.dlg_filename = "test_" + self.dpf_stem + ".dlg"
        self.computed = run_AutoDock( self.dpf_stem , self.dlg_filename )

#______________________________________________________________________________

class AutoDock4_1pgp_wrong_extension( AutoDock_simple_test ):
    """Test that autodock4 stops early if extension is not '.dpf'
    keywords are specified."""
    dpf_stem = "1pgp.fpd"
    print "in 1pgp_wrong_extension"
    expected_outcome = False # True means Successful Completion!
    def setUp( self ):
        """Set up for autodock4 tests. Locate the autodock binary now during setUp."""
        self.dlg_filename = "test_" + self.dpf_stem + ".dlg"
        self.computed = run_AutoDock( self.dpf_stem , self.dlg_filename )

#______________________________________________________________________________


class AutoDock4_1pgp_two_extensions( AutoDock_simple_test ):
    """Test that autodock4 stops early if dpf name includes two .dpf
    keywords are specified."""
    dpf_stem = "1pgp.dpf"
    print "in 1pgp_two_extensions"
    expected_outcome = False # True means Successful Completion!
    def setUp( self ):
        """Set up for autodock4 tests. Locate the autodock binary now during setUp."""
        self.dlg_filename = "test_" + self.dpf_stem + ".dlg"
        self.computed = run_AutoDock( self.dpf_stem +'.dpf', self.dlg_filename )


#______________________________________________________________________________


class AutoDock4_1pgp_ligand_types_map_mismatch( AutoDock_simple_test ):
    """Test that autodock4 stops early if number of maps do not equal number
    of ligand types"""
    dpf_stem = "1pgp_ligand_types_map_mismatch"
    expected_outcome = False # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_illegal_keyword_test( AutoDock_simple_test ):
    """Test that autodock4 stops early if it finds an illegal keyword 
    in dpf """
    dpf_stem = "1pgp_illegal_keyword"
    expected_outcome = False # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_no_elecmap_test( AutoDock_simple_test ):
    """Test that autodock4 stops early if no "elecmap" keyword is specified."""
    dpf_stem = "1pgp_no_elecmap"
    expected_outcome = False # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_no_desolvmap_test( AutoDock_simple_test ):
    """Test that autodock4 stops early if no "desolvmap" keyword is specified."""
    dpf_stem = "1pgp_no_desolvmap"
    expected_outcome = False # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_no_elec_desolv_maps_test( AutoDock_simple_test ):
    """Test that autodock4 stops early if no elecmap and no desolvmap 
    keywords are specified."""
    dpf_stem = "1pgp_no_elec_desolv_maps"
    expected_outcome = False # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_too_many_torsions( AutoDock_simple_test ):
    """Test that autodock4 stops early if too many torsions 
    are specified. (current limit is 32)"""
    dpf_stem = "1pgp_too_many_torsions"
    expected_outcome = False # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_just_right_number_torsions( AutoDock_simple_test ):
    """Test that autodock4 completes with current limit of number of  torsions 
    are specified. (current limit is 32)"""
    dpf_stem = "1pgp_just_right_number_torsions"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________


class AutoDock4_1pgp_too_many_ligand_types_test( AutoDock_simple_test ):
    """Test that autodock4 stops early if too many ligand types 
    are specified. (current limit is 14)"""
    dpf_stem = "1pgp_too_many_ligand_types"
    expected_outcome = False # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_two_ligands_test( AutoDock_simple_test ):
    """Test that autodock4 can run dpf specifying two ligands."""
    dpf_stem = "1pgp_two_ligands"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_two_mapsets_test( AutoDock_simple_test ):
    """Test that autodock4 can run dpf specifying two sets of maps and one ligand."""
    dpf_stem = "1pgp_two_mapsets"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_unbound_set_illegal_test( AutoDock_simple_test ):
    """Test that autodock 4.1 works when unbound is set to 'foo' in the DPF."""
    dpf_stem = "1pgp_unbound_set_illegal"
    expected_outcome = False # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_unbound_model_illegal_test( AutoDock_simple_test ):
    """Test that autodock4 stops early if it finds an illegal unbound_model 
    in dpf """
    dpf_stem = "1pgp_unbound_model_illegal"
    expected_outcome = False # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_ga_run_maxruns_test( AutoDock_simple_test ):
    """Test that autodock 4 runs with max number of runs"""
    dpf_stem = "1pgp_ga_run_maxruns"
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_ga_run_maxruns_analysis_test( AutoDock_simple_test ):
    """Test that autodock 4 runs with max number of runs followed by cluster analysis"""
    dpf_stem = "1pgp_ga_run_maxruns_analysis"
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_ga_select_tournament_test( AutoDock_simple_test ):
    """Test that autodock 4.2 stops when ga_select_tournament is set in the DPF."""
    dpf_stem = "1pgp_ga_select_tournament"
    expected_outcome = False # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_ga_select_linear_ranking_test( AutoDock_simple_test ):
    """Test that autodock 4.2 works when ga_select_linear_ranking is set in the DPF."""
    dpf_stem = "1pgp_ga_select_linear_ranking"
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

#print "docked[binding_energy]=", docked['binding_energy']
class AutoDock4_1pgp_ligrand_ga_only_test( AutoDock_simple_test ):
    """Test that autodock 4.2 works when ligand is randomized within autodock as set in the DPF."""
    dpf_stem = "1pgp_ligrand_ga_only"
    #print "in new ligrand_ga_only test"
        #expected_binding_energy = +843.59     -5.87
        #expected_intermol_energy = +21.00  -6.17
        #expected_internal_energy = +820.50 -3.23
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_ga_only_test( AutoDock_simple_test ):
    """Test that autodock 4.2 works when ga_only is set in the DPF."""
    dpf_stem = "1pgp_ga_only"
    #print "in new ga_only test"
        #expected_binding_energy = +843.59     -5.87
        #expected_intermol_energy = +21.00  -6.17
        #expected_internal_energy = +820.50 -3.23
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_about_only_test( AutoDock_simple_test ):
    """Test that autodock 4.2 works when about is set in the DPF but tran0,
    dihe0 and quat0 are missing."""
    dpf_stem = "1pgp_about_only"
    #print "in new ga_only test"
        #expected_binding_energy = +843.59     -5.87
        #expected_intermol_energy = +21.00  -6.17
        #expected_internal_energy = +820.50 -3.23
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_multipleabouts_test( AutoDock_simple_test ):
    """Test that autodock 4.2 works when about appears multiple times"""
    dpf_stem = "1pgp_multipleabouts"
    #print "in new ga_only test"
        #expected_binding_energy = +843.59     -5.87
        #expected_intermol_energy = +21.00  -6.17
        #expected_internal_energy = +820.50 -3.23
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________


class AutoDock4_1pgp_simanneal_small( AutoDock_simple_test ):
    """Test that autodock 4.2 simanneal works (at all). """
    dpf_stem = "1pgp_simanneal_small"
        #expected_binding_energy = +843.59     -5.87
        #expected_intermol_energy = +21.00  -6.17
        #expected_internal_energy = +820.50 -3.23
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_simanneal_small_geometric_schedule( AutoDock_simple_test ):
    """Test that autodock 4.2 simanneal alternate cooling schedule """
    dpf_stem = "1pgp_simanneal_small_geometric_schedule"
        #expected_binding_energy = +843.59     -5.87
        #expected_intermol_energy = +21.00  -6.17
        #expected_internal_energy = +820.50 -3.23
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_about_auto_simanneal( AutoDock_simple_test ):
    """Test that autodock 4.2 simanneal works when about, tran0, dihe0, and quat0 are missing."""
    dpf_stem = "1pgp_about_auto_simanneal"
        #expected_binding_energy = +843.59     -5.87
        #expected_intermol_energy = +21.00  -6.17
        #expected_internal_energy = +820.50 -3.23
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_about_auto_ga_only( AutoDock_simple_test ):
    """Test that autodock 4.2 ga_only works when about, tran0, dihe0, and quat0 are missing."""
    dpf_stem = "1pgp_about_auto_ga_only"
        #expected_binding_energy = +843.59     -5.87
        #expected_intermol_energy = +21.00  -6.17
        #expected_internal_energy = +820.50 -3.23
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_about_auto_gals( AutoDock_simple_test ):
    """Test that autodock 4.2 ga_ls works when about, tran0, dihe0, and quat0 are missing."""
    dpf_stem = "1pgp_about_auto_gals"
        #expected_binding_energy = +843.59     -5.87
        #expected_intermol_energy = +21.00  -6.17
        #expected_internal_energy = +820.50 -3.23
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_about_auto_local_only( AutoDock_simple_test ):
    """Test that autodock 4.2 local_only works when about, tran0, dihe0, and quat0 are missing."""
    dpf_stem = "1pgp_about_auto_local_only"
        #expected_binding_energy = +843.59     -5.87
        #expected_intermol_energy = +21.00  -6.17
        #expected_internal_energy = +820.50 -3.23
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_flexres_test( AutoDock_simple_test ):
    """Test that autodock 4.2 works when flexres is set in the DPF."""
    dpf_stem = "1pgp_flexres"
    #print "in new flexres test"
        #expected_binding_energy =  -4.22
        #expected_intermol_energy = -5.93
        #expected_internal_energy = -2.18
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_rmsmode_heavy_atoms_only_noH_test( AutoDock_simple_test ):
    """Test that autodock4 works if noHs when using new keyword rmsmode heavy_atoms_only."""
    dpf_stem = "1pgp_rmsmode_heavy_atoms_only_noH"
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_rmsmode_all_heavy_atom_pairs_only_test( AutoDock_simple_test ):
    """Test that autodock4 works if rms calc uses all pairs of heavy_atoms.
       Set by including these TWO rmsmode cmds in dpf:  
        rmsmode unique_pair       #sets B_unique_pair_flag to TRUE (default is FALSE)
        rmsmode heavy_atoms_only  #sets B_rms_heavy_atoms_only to TRUE (default is FALSE)
        """
    dpf_stem = "1pgp_rmsmode_all_heavy_atom_pairs_only"
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_rmsmode_unique_heavy_atom_pairs_only_test( AutoDock_simple_test ):
    """Test that autodock4 works if rms calc uses only unique pairs of heavy_atoms specified 
          with two rmsmode cmds: unique_pair heavy_atoms_only."""
    dpf_stem = "1pgp_rmsmode_unique_heavy_atom_pairs_only"
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock_test( AutoDock_base_test ):
    """Class for AutoDock testing."""

    def test_dlg_exists_and_test_energy( self ):
        """Check that run finished and a new DLG has been computed.
        Also check the final energy is the expected value."""
        # Check that run finished and a new DLG has been computed.
        if (self.expected_outcome == True ):
            print "Testing that DLG exists and AutoDock successfully completed."
        else:
            print "Testing that DLG exists and AutoDock did not complete."
        self.assertEqual( self.computed, self.expected_outcome )
        # Check the final energy is expected value.
        expected_intermol_energy = -6.44  
        expected_internal_energy = -3.28  # 3.17? MP
        (intermol_energy, internal_energy) = parse_energy_from_DLG( self.dlg_filename, ['intermol_energy','total_internal'] )
        print "Testing that intermolecular energy = %.2f kcal/mol." % (expected_intermol_energy,)
        self.assertEqual( round(intermol_energy,6), round(expected_intermol_energy,6))
        print "Testing that internal energy = %.2f kcal/mol." % (expected_internal_energy,)
        self.assertEqual( round(internal_energy,6), round(expected_internal_energy,6))
#______________________________________________________________________________

class AutoDock4_1pgp_test( AutoDock_test ):
    """Test that autodock4 executes using an extremely short run."""
    dpf_stem = "1pgp"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

# next test not installed yet as I do not have a way I know of to pass
# different expected values to the superclass - M Pique  July 2012
class AutoDock4_1pgp_intelec_off_test( AutoDock_test ):
    """Test autodock4.3 internal energy off option yields 4.2 value."""
    dpf_stem = "1pgp_intelec_off"
    expected_intermol = -7.72
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_timepid_test( AutoDock_simple_test ):
    """Test that autodock4 executes using seed set by time and process-id"""
    dpf_stem = "1pgp_timepid"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_seed01_test( AutoDock_simple_test ):
    """Test that autodock4 executes using seeds  set to 0 1"""
    dpf_stem = "1pgp_seed01"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_seedinttime_test( AutoDock_simple_test ):
    """Test that autodock4 executes using seeds  set to integer and time"""
    dpf_stem = "1pgp_seedinttime"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_epdb_flexres_intelec_test( AutoDock_simple_test ):
    """Test autodock 4.3 epdb output flexres with intelec on."""
    dpf_stem = "1pgp_epdb_flexres_intelec"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_epdb_flexres_nointelec_test( AutoDock_simple_test ):
    """Test autodock 4.3 epdb output flexres with intelec off."""
    dpf_stem = "1pgp_epdb_flexres_nointelec"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_epdb_etables_test( AutoDock_simple_test ):
    """Test autodock 4.3 high outlev detail for epdb and energy tables."""
    dpf_stem = "1pgp_epdb_etables"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_numoutlev_test( AutoDock_simple_test ):
    """Test autodock 4.3 numeric outlev detail settings."""
    dpf_stem = "1pgp_numoutlev"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_no_outlev_test( AutoDock_simple_test ):
    """Test autodock 4.3 default outlev detail setting."""
    dpf_stem = "1pgp_no_outlev"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_illegal_outlev_test( AutoDock_simple_test ):
    """Test autodock 4.3 outlev with no argument setting."""
    dpf_stem = "1pgp_illegal_outlev"
    expected_outcome = False # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_symoutlev_test( AutoDock_simple_test ):
    """Test autodock 4.3 symbolic and numeric outlev detail settings."""
    dpf_stem = "1pgp_symoutlev"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_illegal_symoutlev_test( AutoDock_simple_test ):
    """Test autodock 4.3 symbolic outlev incorrect setting."""
    dpf_stem = "1pgp_illegal_symoutlev"
    expected_outcome = False # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_gals_set_sw1_test( AutoDock_simple_test ):
    """Test that autodock4 gals_run succeeds with older sw1 rather than psw1."""
    dpf_stem = "1pgp_gals_set_sw1"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_smaller_test( AutoDock_simple_test ):
    expected_intermol_energy = -6.17  
    expected_internal_energy = -3.23
    """Test that autodock4 executes using fewer parameters and an extremely short run."""
    dpf_stem = "1pgp_smaller"
    #expected_intermol_energy = -6.17  
    #expected_internal_energy = -3.23
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_gals_use_defaults_test( AutoDock_test ):
    """Test that autodock4 executes using default gals parameters."""
    dpf_stem = "1pgp_gals_use_defaults"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_gals_no_set_ga_test( AutoDock_simple_test ):
    """Test that autodock4 ga_run fails when set_ga command is omitted."""
    dpf_stem = "1pgp_no_set_ga"
    expected_outcome = False # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_gals_no_set_psw1_test( AutoDock_simple_test ):
    """Test that autodock4 gals_run fails when set_psw1 command is omitted."""
    dpf_stem = "1pgp_no_set_psw1"
    expected_outcome = False # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_no_parameter_file_test( AutoDock_test ):
    """Test that autodock4 works using default parameter library."""
    dpf_stem = "1pgp_no_parameter_file"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_output_pop_file_test( AutoDock_simple_test ):
    """Test that autodock4 executes while writing out popfile"""
    dpf_stem = "1pgp_outpopfil"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_rmsmode_heavy_atoms_only_test( AutoDock_test ):
    """Test that autodock4 works using new keyword rmsmode heavy_atoms_only."""
    dpf_stem = "1pgp_rmsmode_heavy_atoms_only"
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________
class AutoDock4_energy_test( AutoDock_base_test ):
    """Class for AutoDock testing free energy."""
    expected_binding_energy = None

    def test_dlg_exists_and_test_energy( self):
        """Check that run finished and a new DLG has been computed.
        Also check the final energy is the expected value."""
        # Check that run finished and a new DLG has been computed.
        if (self.expected_outcome == True ):
            print "Testing that DLG exists and AutoDock successfully completed."
        else:
            print "Testing that DLG exists and AutoDock did not complete."
        self.assertEqual( self.computed, self.expected_outcome )
        # Check the final energy is expected value.
        #expected_unbound_energy = -3.23
        #expected_binding_energy = +843.59     -5.87
        (binding_energy) = parse_energy_from_DLG( self.dlg_filename, ['binding_energy'])[0]
        print "Testing that binding energy = %.2f kcal/mol." % (self.expected_binding_energy,)
        print "binding_energy=", binding_energy
        self.assertEqual( round(binding_energy,6), round(self.expected_binding_energy,6))
#______________________________________________________________________________


class AutoDock4_unbound_test( AutoDock_base_test ):
    """Class for AutoDock testing unbound energy."""
    expected_unbound_energy = None

    def test_dlg_exists_and_test_energy( self):
        """Check that run finished and a new DLG has been computed.
        Also check the final energy is the expected value."""
        # Check that run finished and a new DLG has been computed.
        if (self.expected_outcome == True ):
            print "Testing that DLG exists and AutoDock successfully completed."
        else:
            print "Testing that DLG exists and AutoDock did not complete."
        self.assertEqual( self.computed, self.expected_outcome )
        # Check the final energy is expected value.
        #expected_unbound_energy = -3.23
        (unbound_energy) = parse_energy_from_DLG( self.dlg_filename, ['unbound_energy'])[0]
        print "Testing that unbound energy = %.2f kcal/mol." % (self.expected_unbound_energy,)
        print "unbound_energy=", unbound_energy
        self.assertEqual( round(unbound_energy,6), round(self.expected_unbound_energy,6))
#______________________________________________________________________________

class AutoDock4_1pgp_unbound_default_test( AutoDock4_unbound_test ):
    """Test that autodock 4.1 works when unbound is NOT set in the DPF."""
    dpf_stem = "1pgp_unbound_default"
    expected_unbound_energy = -3.23
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_unbound_model_extended( AutoDock4_unbound_test ):
    """Test that autodock 4.1 works when unbound_model is set to extended."""
    dpf_stem = "1pgp_unbound_model_extended"
    expected_unbound_energy = -0.75
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_unbound_compute_unbound_extended( AutoDock4_unbound_test ):
    """Test that autodock 4.1 works when unbound_model is set to extended."""
    dpf_stem = "1pgp_unbound_compute_unbound_extended"
    expected_unbound_energy = -0.75
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_unbound_model_value( AutoDock4_unbound_test ):
    """Test that autodock 4.1 works when unbound_model is set to a value in the DPF."""
    dpf_stem = "1pgp_unbound_model_value"
    expected_unbound_energy = -3.12 
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_unbound_model_compact( AutoDock4_unbound_test ):
    """Test that autodock 4.1 works when unbound_model is set to compact."""
    dpf_stem = "1pgp_unbound_model_compact"
    expected_unbound_energy =  0.00 #@FixMe 3/2009 do not know how to calc this
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_unbound_model_bound( AutoDock4_unbound_test ):
    """Test that autodock 4.1 works when unbound_model is set to bound."""
    dpf_stem = "1pgp_unbound_model_bound"
    expected_unbound_energy = -3.23
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_unbound_set0_test( AutoDock4_unbound_test ):
    """Test that autodock 4.1 works when unbound is set to 0 in the DPF."""
    dpf_stem = "1pgp_unbound_set0"
    expected_unbound_energy = 0.
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_unbound_set10_test( AutoDock4_unbound_test ):
    """Test that autodock 4.1 works when unbound is set to 10 in the DPF."""
    dpf_stem = "1pgp_unbound_set10"
    expected_unbound_energy = 10.
    expected_outcome = True # True means Successful Completion!
#______________________________________________________________________________

class AutoDock4_1pgp_1_4_50_test( AutoDock4_energy_test ):
    """Test that autodock 4.2 works include_1_4 set to 50 in the DPF."""
    dpf_stem = "1pgp_1_4_50"
    #print "in new ga_only test"
        #expected_binding_energy = +843.59     -5.87
        #expected_intermol_energy = +21.00  -6.17
        #expected_internal_energy = +820.50 -3.23
    expected_binding_energy = -4.08
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________


class AutoDock4_1pgp_1_4_100_test( AutoDock4_energy_test ):
    """Test that autodock 4.2 works include_1_4 set to 100 in the DPF."""
    dpf_stem = "1pgp_1_4_100"
    #print "in new ga_only test"
        #expected_binding_energy = +843.59     -5.87
        #expected_intermol_energy = +21.00  -6.17
        #expected_internal_energy = +820.50 -3.23
    #expected_binding_energy = -4.08
    expected_binding_energy = -3.49
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

#print "docked[binding_energy]=", docked['binding_energy']
class AutoDock4_1pgp_ligrand_ga_only_energy_test( AutoDock4_energy_test ):
    """Test that autodock 4.2 works when ligand is randomized within autodock as set in the DPF.
                 and that expected energy is found"""
    dpf_stem = "1pgp_ligrand_ga_only"
    expected_binding_energy = 1.39
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________


class AutoDock4_1pgp_ga_only_energy_test( AutoDock4_energy_test ):
    """Test that autodock 4.2 works when ga_only is set in the DPF."""
    dpf_stem = "1pgp_ga_only"
    #print "in new ga_only test"
        #expected_binding_energy = +843.59     -5.87
        #expected_intermol_energy = +21.00  -6.17
        #expected_internal_energy = +820.50 -3.23
    expected_binding_energy = -4.08
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________


class AutoDock4_1pgp_flexres_energy_test( AutoDock4_energy_test ):
    """Test that autodock 4.2 works when flexres is set in the DPF."""
    dpf_stem = "1pgp_flexres"
    #print "in new flexres test"
        #expected_binding_energy =  -4.22
        #expected_intermol_energy = -5.93
        #expected_internal_energy = -2.18
    expected_binding_energy = -4.33
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_flexres_energy_1_4_50_test( AutoDock4_energy_test ):
    """Test that autodock 4.2 works when flexres is set in the DPF."""
    dpf_stem = "1pgp_flexres_1_4_50"
    #print "in new flexres test"
        #expected_binding_energy =  -4.22
        #expected_intermol_energy = -5.93
        #expected_internal_energy = -2.18
    #expected_binding_energy = -4.72
    expected_binding_energy = -4.33
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________

class AutoDock4_1pgp_flexres_energy_1_4_100_test( AutoDock4_energy_test ):
    """Test that autodock 4.2 works when flexres is set in the DPF."""
    dpf_stem = "1pgp_flexres_1_4_100"
    #print "in new flexres test"
        #expected_binding_energy =  -4.22
        #expected_intermol_energy = -5.93
        #expected_internal_energy = -2.18
    expected_binding_energy = -4.33
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________


class AutoDock4_1pgp_ga_smooth0_energy_test( AutoDock4_energy_test ):
    """Test that autodock 4.2 gives expected internal energy when smooth is set to 0 in the DPF."""
    dpf_stem = "1pgp_smooth0"
    #restores former values (less negative)
    expected_binding_energy =  -5.87
    expected_intermol_energy = -6.17
    expected_internal_energy = -1.78
    expected_outcome = True # True means Successful Completion!

#______________________________________________________________________________




if __name__ == '__main__':
    #  This syntax lets us run all the tests,
    #  or conveniently comment out tests we're not interested in.
    #  NOTE:  Remember to add new TestCase class names to the list "test_cases"
    test_cases = [
        # tests for .dpf extension:
        'AutoDock4_1pgp_no_extension',
        'AutoDock4_1pgp_wrong_extension',
        'AutoDock4_1pgp_two_extensions',
        # simple tests:
        'AutoDock4_1pgp_timepid_test',
	'AutoDock4_1pgp_seed01_test',
	'AutoDock4_1pgp_seedinttime_test',
        'AutoDock4_1pgp_epdb_flexres_intelec_test',
        'AutoDock4_1pgp_epdb_flexres_nointelec_test',
        'AutoDock4_1pgp_epdb_etables_test',
        'AutoDock4_1pgp_numoutlev_test',
        'AutoDock4_1pgp_symoutlev_test',
	'AutoDock4_1pgp_no_outlev_test',
	'AutoDock4_1pgp_illegal_outlev_test',
        'AutoDock4_1pgp_illegal_symoutlev_test',
        'AutoDock4_1pgp_ligand_types_map_mismatch',
        'AutoDock4_1pgp_illegal_keyword_test',
        'AutoDock4_1pgp_no_elecmap_test',
        'AutoDock4_1pgp_no_desolvmap_test',
        'AutoDock4_1pgp_no_elec_desolv_maps_test',
        'AutoDock4_1pgp_too_many_ligand_types_test',
        'AutoDock4_1pgp_too_many_torsions',
        'AutoDock4_1pgp_just_right_number_torsions',
        'AutoDock4_1pgp_two_ligands_test',
        'AutoDock4_1pgp_two_mapsets_test',
        'AutoDock4_1pgp_unbound_set_illegal_test',
        'AutoDock4_1pgp_unbound_model_illegal_test', #1
	'AutoDock4_1pgp_ga_run_maxruns_test',
	'AutoDock4_1pgp_ga_run_maxruns_analysis_test',
        'AutoDock4_1pgp_ga_select_tournament_test',
        'AutoDock4_1pgp_ga_select_linear_ranking_test',
        #'AutoDock4_1pgp_rmsmode_heavy_atoms_only_test',
        'AutoDock4_1pgp_rmsmode_heavy_atoms_only_noH_test',
        'AutoDock4_1pgp_rmsmode_all_heavy_atom_pairs_only_test',
        'AutoDock4_1pgp_rmsmode_unique_heavy_atom_pairs_only_test',
        'AutoDock4_1pgp_simanneal_small', 
        'AutoDock4_1pgp_simanneal_small_geometric_schedule', 
        #next dpf sets tran0,quaternion0,dihe0 to random
        'AutoDock4_1pgp_ligrand_ga_only_test', 
        'AutoDock4_1pgp_ga_only_test',
	'AutoDock4_1pgp_output_pop_file_test',
        # tests using flexible residues 
        'AutoDock4_1pgp_flexres_test',
        ## tests which check for specific value
        'AutoDock4_1pgp_test',
        'AutoDock4_1pgp_smaller_test',
## next test not installed yet as I do not have a way I know of to pass
## different expected values to the superclass - M Pique  July 2012
	# 'AutoDock4_1pgp_intelec_off_test',
        'AutoDock4_1pgp_no_parameter_file_test',
	'AutoDock4_1pgp_gals_set_sw1_test',
	'AutoDock4_1pgp_gals_no_set_psw1_test',
	'AutoDock4_1pgp_gals_no_set_ga_test',
	'AutoDock4_1pgp_gals_use_defaults_test',
        #'AutoDock4_1pgp_ga_only_value_test',
        ## tests for unbound values 
        'AutoDock4_1pgp_unbound_default_test',
        'AutoDock4_1pgp_unbound_set0_test',
        'AutoDock4_1pgp_unbound_set10_test',
        # tests for unbound_model choices
        'AutoDock4_1pgp_unbound_model_compact',
        'AutoDock4_1pgp_unbound_model_bound',
        'AutoDock4_1pgp_unbound_model_extended',
        'AutoDock4_1pgp_unbound_compute_unbound_extended',
        'AutoDock4_1pgp_unbound_model_value',
        # tests for ga_only and energy
        'AutoDock4_1pgp_ligrand_ga_only_energy_test',
        'AutoDock4_1pgp_ga_only_energy_test',
        'AutoDock4_1pgp_ga_smooth0_energy_test',
        # tests for energy with flexible residues 
        'AutoDock4_1pgp_flexres_energy_test',
        'AutoDock4_1pgp_flexres_energy_1_4_50_test',
        'AutoDock4_1pgp_flexres_energy_1_4_100_test',
        # tests for energy with 1_4_interactions
        'AutoDock4_1pgp_1_4_50_test',
        'AutoDock4_1pgp_1_4_100_test',
        # tests for setting tran0 from about
        'AutoDock4_1pgp_about_only_test', 
        'AutoDock4_1pgp_multipleabouts_test', 
        # tests for setting 'about' automatically
        'AutoDock4_1pgp_about_auto_simanneal', 
        'AutoDock4_1pgp_about_auto_ga_only', 
        'AutoDock4_1pgp_about_auto_local_only', 
        'AutoDock4_1pgp_about_auto_gals', 
    ]
    unittest.main( argv=( [__name__ ,] + test_cases ) )
    #  The call "unittest.main()" automatically runs all the TestCase classes in
    #  alphabetical order; calling with argv=([]), lets us specify the order.
    #  NOTE: "unittest.main()" saves us having to remember to add new tests to the 
    #  list of test cases.
    #unittest.main()
    #  For verbose output, use this:
    #unittest.main( argv=( [__name__, '-v'] + test_cases ) )