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

writePDB truncates 4 letters residues to 3 letters #2023

Open
Cventura18 opened this issue Jan 6, 2025 · 2 comments
Open

writePDB truncates 4 letters residues to 3 letters #2023

Cventura18 opened this issue Jan 6, 2025 · 2 comments

Comments

@Cventura18
Copy link

Hi,

I am having an issue writePDB with saving 4 letter residues for the probes in druggability simulations. I am using the long_resname feature in parsePDB to select the probes which all have four letter residue name. When I am trying to save the a probe "ACET" for example the corresponding pdb file truncates the residue to ACE in the pdb file.

Best,
Carlos

from prody import *
test = parsePDB('newcgenff.pdb', long_resname = True)
probes = ['IPAM', 'PRO2', 'ACET', 'IBUT', 'ACEM', 'IMIA', 'BENZ']
probe_selstr = 'noh and resname'
prefix = 'dg'
for p in probes:
    sel = test.select('noh and resname ' + p)
    print(p)
    if sel is None:
        continue
                #raise ValueError('probe ' + p + ' is not found in the system')
    hv = sel.getHierView()
    n = hv.numResidues()
    res = next(hv.iterResidues())
    writePDB(prefix + '_' + p + '.pdb', res, warned_long_resname = True)
    plog(str(n) + ' copies of ' + p + ' is found.')
    probe_selstr += ' ' + p
    print(probe_selstr)
REMARK ACET 674
ATOM      1  C1  ACE X 674     -51.279 -38.133  -8.576  0.00  0.00      PROB C
ATOM      2  C2  ACE X 674     -51.282 -36.660  -8.181  0.00  0.00      PROB C
ATOM      3  O1  ACE X 674     -50.157 -36.309  -7.208  0.00  0.00      PROB O
ATOM      4  O2  ACE X 674     -51.105 -35.890  -9.354  0.00  0.00      PROB O
END
@Cventura18
Copy link
Author

I believe the code responsible for this is:

if len(resnames[i]) > 3:
                resname = resname[:3]
                if not warned_long_resname:
                    LOGGER.warn('Resname {0} too long, cutting resname to 3 characters as {1}'.format(
                        resnames[i], resname
                    ))
                    warned_long_resname = True

If I change resname[:3] to resname[:4] the corresponding pdb file is now has the residue name ACET instead of ACE.

REMARK ACET 674
ATOM      1  C1  ACET X 674     -51.279 -38.133  -8.576  0.00  0.00      PROB C
ATOM      2  C2  ACET X 674     -51.282 -36.660  -8.181  0.00  0.00      PROB C
ATOM      3  O1  ACET X 674     -50.157 -36.309  -7.208  0.00  0.00      PROB O
ATOM      4  O2  ACET X 674     -51.105 -35.890  -9.354  0.00  0.00      PROB O
END

@jamesmkrieger
Copy link
Contributor

That does break PDB format though, so I think it was decided not to do that on purpose.

What we could do is indeed to limit to 4 characters and remove the space too. We’ll have a look. Thanks

There could be an option to trim it or not

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

2 participants