channotation / chap

CHAP is a tool for the functional annotation of ion channel structures:
http://www.channotation.org
Other
18 stars 10 forks source link

Make wobj.py Python3 Compatible #12

Closed Inniag closed 2 years ago

Inniag commented 5 years ago

The PyMol script for loading OBJ files is currently not compatible with the Python3 standard. This might cause errors such as this:

PyMOL>run visualise_pathway.py,main
Traceback (most recent call last):
  File "/home/jeffxd/Program/pymol-2.3.2_79/lib/python3.7/site-packages/pymol/parsing.py", line 487, in run
    run_(path, ns_main, ns_main)
  File "/home/jeffxd/Program/pymol-2.3.2_79/lib/python3.7/site-packages/pymol/parsing.py", line 532, in run_file
    execfile(file,global_ns,local_ns)
  File "/home/jeffxd/Program/pymol-2.3.2_79/lib/python3.7/site-packages/pymol/parsing.py", line 527, in execfile
    exec(co, global_ns, local_ns)
  File "visualise_pathway.py", line 89, in <module>
    obj = wobj.import_wobj(args.surface)
  File "/home/jeffxd/Program/chap-version_0_9_1/examples/example-01/test/wobj.py", line 396, in import_wobj
    return obj_importer.read(filename)
  File "/home/jeffxd/Program/chap-version_0_9_1/examples/example-01/test/wobj.py", line 182, in read
    cgo[key] = self.__create_cgo_object(key)
  File "/home/jeffxd/Program/chap-version_0_9_1/examples/example-01/test/wobj.py", line 348, in __create_cgo_object
    vertex_a = self.__vertices[face["vert_idx"][0] - 1]
TypeError: 'map' object is not subscriptable

A fix has already been suggested in issue #11.

Jeffatcunyc commented 5 years ago

Hi Inniag,

I could not find the answer to the loading OBJ file issue with PyMol running on Python3. Could you please give me more details about how to fix it up? Thanks.

Jeff

Jeffatcunyc commented 5 years ago

Hi Inniag,

I just worked it out. My solution was using an old version of PyMol running on Python2. What I used is PyMol 1.8.4.0.

Best, Jeff

calvadia commented 4 years ago

I have the same error message. Any fix available yet?

Thank you, Carolina

DSeiferth commented 2 years ago

In Python 3, " map" returns an iterable object of type map, and not a subscriptible list. If you replace every map() with list(map()) in wobj.py, the script is python3 compatible. For example replace self.__materials[self.__crnt_material]["Ka"] = map(float, split_line[1:4]) with self.__materials[self.__crnt_material]["Ka"] = list(map(float, split_line[1:4]))

DSeiferth commented 2 years ago

I did not see the pull request made by irudayaf on 28 Aug 2019 in which he basically did the same...

channotation commented 2 years ago

Closed pull request #13 from @irudayaf as well now.