bjornwallner / DockQ

DockQ is a single continuous quality measure for Protein, Nucleic Acids and Small Molecule Docking Models
MIT License
212 stars 49 forks source link

DockQ error #28

Closed andregiuseppecavalli closed 3 months ago

andregiuseppecavalli commented 5 months ago

Hi, I'm using DockQ on several protein-peptide complexes obtained from a redocking procedure. On some complexes it works fine, while on others it gives me the following error:

            UserWarning: WARNING: It looks like cython is not working,
                     falling back on native python. This will make DockQ slower
              warnings.warn(
            Traceback (most recent call last):
            File "C:\mypath\Python\Python312\Lib\site-packages\Bio\File.py", line 72, in as_handle
              with open(handleish, mode, **kwargs) as fp:
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          TypeError: expected str, bytes or os.PathLike object, not TextIOWrapper

          During handling of the above exception, another exception occurred:

          Traceback (most recent call last):
            File "C:\mypath\DockQ\DockQ.py", line 585, in load_PDB
              structure = pdb_parser.get_structure(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\mypath\DockQ\parsers.py", line 251, in get_structure
              self._parse(lines, chains)
            File "C:\mypath\DockQ\parsers.py", line 264, in _parse
              self.trailer = self._parse_coordinates(coords_trailer, chains)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\mypath\DockQ\parsers.py", line 401, in _parse_coordinates
              except PDBConstructionException as message:
                     ^^^^^^^^^^^^^^^^^^^^^^^^
          NameError: name 'PDBConstructionException' is not defined. Did you mean: 'PDBConstructionWarning'?

          During handling of the above exception, another exception occurred:

          Traceback (most recent call last):
            File "C:\mypath\DockQ\DockQ.py", line 936, in <module>
              main()
            File "C:\mypath\DockQ\DockQ.py", line 762, in main
              model_structure = load_PDB(args.model, chains=model_chains)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\mypath\DockQ\DockQ.py", line 593, in load_PDB
              structure = pdb_parser.get_structure(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^
            File "C:\mypath\DockQ\parsers.py", line 25, in get_structure
              self._build_structure(structure_id, chains)
            File "C:\mypath\DockQ\parsers.py", line 38, in _build_structure
              atom_serial_list = mmcif_dict["_atom_site.id"]
                                 ~~~~~~~~~~^^^^^^^^^^^^^^^^^
          KeyError: '_atom_site.id'

I think it is a problem in the pdb file, but i don't find it, since it is generated in the same way as other files that do not raise this error. Do you have any idea or suggestions?

The command that I gave in windows prompt is: python DockQ.py --capri_peptide model.pdb reference.pdb

Many thanks.

Andrea

andregiuseppecavalli commented 5 months ago

I solve the above problem, the OXT atom of the c-term of the protein was not present and it seems like it need to be there. Anyway, I found a new error:

    C:\mypath\DockQ\DockQ.py:24: UserWarning: WARNING: It looks like cython is not working,
             falling back on native python. This will make DockQ slower
      warnings.warn(
    C:\mypath\DockQ\DockQ.py:24: UserWarning: WARNING: It looks like cython is not working,
             falling back on native python. This will make DockQ slower
      warnings.warn(
    DONE:   0%|                                                                                      | 0/2 [00:00<?, ?it/s]C:\mypath\DockQ\DockQ.py:24: UserWarning: WARNING: It looks like cython is not working,
             falling back on native python. This will make DockQ slower
      warnings.warn(
    C:\mypath\DockQ\DockQ.py:24: UserWarning: WARNING: It looks like cython is not working,
             falling back on native python. This will make DockQ slower
      warnings.warn(
    DONE:  50%|███████████████████████████████████████                                       | 1/2 [00:00<00:00,  1.42it/s]
    multiprocessing.pool.RemoteTraceback:
    """
    Traceback (most recent call last):
      File "C:\mypath\Python\Python312\Lib\multiprocessing\pool.py", line 125, in worker
        result = (True, func(*args, **kwds))
                        ^^^^^^^^^^^^^^^^^^^
      File "C:\mypath\Python\Python312\Lib\multiprocessing\pool.py", line 48, in mapstar
        return list(map(*args))
               ^^^^^^^^^^^^^^^^
      File "C:\mypath\Python\Python312\Lib\site-packages\parallelbar\parallelbar.py", line 78, in _func_wrapped
        result = func(task)
                 ^^^^^^^^^^
      File "C:\mypath\DockQ\DockQ.py", line 559, in run_on_all_native_interfaces
        info = run_on_chains(
               ^^^^^^^^^^^^^^
      File "C:\mypath\DockQ\DockQ.py", line 524, in run_on_chains
        info = calc_DockQ(
               ^^^^^^^^^^^
      File "C:\mypath\DockQ\DockQ.py", line 241, in calc_DockQ
        sample_interface_atoms, ref_interface_atoms = get_interface_atoms(
                                                      ^^^^^^^^^^^^^^^^^^^^
      File "C:\mypath\DockQ\DockQ.py", line 487, in get_interface_atoms
        ref_atoms = [atom for atom in ref_residues_group2[j].get_atoms()]
                                      ~~~~~~~~~~~~~~~~~~~^^^
    IndexError: list index out of range
    """

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "C:\mypath\DockQ\DockQ.py", line 936, in <module>
        main()
      File "C:\mypath\DockQ\DockQ.py", line 824, in main
        result_this_mappings = progress_map(
                               ^^^^^^^^^^^^^
      File "C:\mypath\Python\Python312\Lib\site-packages\parallelbar\parallelbar.py", line 247, in progress_map
        result = _do_parallel(func, 'map', tasks, initializer, initargs, n_cpu, chunk_size, context, total, disable,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\mypaths\Python\Python312\Lib\site-packages\parallelbar\parallelbar.py", line 157, in _do_parallel
        raise raised_exception
      File "C:\mypath\Python\Python312\Lib\site-packages\parallelbar\parallelbar.py", line 136, in _do_parallel
        result = p.map(func, tasks, chunksize=chunk_size)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\mypath\Python\Python312\Lib\multiprocessing\pool.py", line 367, in map
        return self._map_async(func, iterable, mapstar, chunksize).get()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\mypath\Python\Python312\Lib\multiprocessing\pool.py", line 774, in get
        raise self._value
    IndexError: list index out of range
clami66 commented 5 months ago

Hi,

Can you attach the input files so that we can reproduce the issue?

clami66 commented 3 months ago

@andregiuseppecavalli I am closing this issue for now since you haven't responded. Feel free to reopen if needed