ADL: Python] Index Error: List index out of range

Sargis Dallakyan sargis at scripps.edu
Wed Jan 9 10:09:04 PST 2008


> Since the error flag list index out of range means that the script tries
> to access an element which is  out in the list, I have checked the input
> ligand file '00001.nci.mol2' and it seems sensible with gasteiger charges
> and in Tripos mol2 format.
> 
> I also checked the python script prepare_ligand4.py and the line 152 with
> 'mol=mols[0] is causing mismatch or perhaps incompatibilities with the
> script prepmol2.
> 
> Below is the error flag:
> 
> -----------
> /HOME01/BII/biiamor/2007/AD/i86Linux2/autogrid4: Successful Completion.
> ls: No match.
> Trying file 00001.nci.mol2
> Processing No 1 ligand 00001
> invalid number: incomprehensible list input
> apparent state: internal I/O
> lately reading sequential formatted internal IO
>  Prepmol2: file 00001.nci.mol2 opened OK
>  Prepmol2: file 00001.nci.mol2.new opened OK
> Abort
> preparing pdbgt file from new.00001.nci.mol2
> Traceback (most recent call last):
>   File
> "/HOME01/BII/biiamor/MGLTools-1.4.6/MGLToolsPckgs/AutoDockTools/Utilities24/prepare_ligand4.py",
> line 152, in ?
>     mol = mols[0]
>   File
> "/HOME01/BII/biiamor/MGLTools-1.4.6/share/lib/python2.4/UserList.py",
> line 28, in __getitem__
>     def __getitem__(self, i): return self.data[i]
> IndexError: list index out of range

prepare_ligand4.py checks if the input file exists, but if its empty or has no 
molecule in it, then mols is an empty list ([]) which can lead to this error.

You wrote that you checked 00001.nci.mol2, but it seems that new.00001.nci.mol2 
is passed to prepare_ligand4.py. Add -v option to prepare_ligand4.py to get 
verbose output.


More information about the autodock mailing list