Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with parseObjMol in pymol2glmol.py #13

Open
garyo opened this issue Mar 29, 2018 · 0 comments
Open

problem with parseObjMol in pymol2glmol.py #13

garyo opened this issue Mar 29, 2018 · 0 comments

Comments

@garyo
Copy link

garyo commented Mar 29, 2018

Hi; in pymol2glmol.py (https://raw.githubusercontent.com/Pymol-Scripts/Pymol-script-repo/master/pymol2glmol.py), there is this code:

def parseObjMol(obj):
    name = obj[0]
    ids = []
    sphere = []
    trace = []
    ribbon = []
    stick = []
    surface = []
    line = []
    cross = []
    smallSphere = []
    helix = []
    sheet = []
    colors = {}
    for atom in obj[5][7]:
        rep = atom[20] + [0] * 12
        serial = atom[22]
        ss = atom[10]
        bonded = (atom[25] == 1)
        if (rep[5] == 1):
            ribbon.append(serial)
        if (rep[1] == 1):
            sphere.append(serial)
        if (rep[2] == 1):
            surface.append(serial)
        if (rep[7] == 1):
            line.append(serial)
        if (rep[6] == 1):
            trace.append(serial)
        if (rep[4] == 1 and not bonded):
            smallSphere.append(serial)
        if (rep[11] == 1 and not bonded):
            cross.append(serial)
        if (rep[0] == 1 and bonded):
            stick.append(serial)
        if (ss == 'S'):
            sheet.append(serial)
        if (ss == 'H'):
            helix.append(serial)
        ...

There seem to be two problems with this code. The first is that at least with python3 and recent pymol, the line rep = atom[20] + [0] * 12 causes an exception, because atom[20] is an int ("visRep"), and python can't do int + list. I worked around that by doing rep = [atom[20]] + [0] * 12. But now I'm confused because the last part of the code checks for various elements of rep, but rep is never set to anything but all zeros (except the first element). So again it seems to be something wrong with the initialization of rep.
Any hints?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant