-
Notifications
You must be signed in to change notification settings - Fork 670
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
parse charmm psf file with residue insertion codes failed #2053
Comments
Hi @qiyifei1 , thanks for the bug report. Looks like PSF files can have insertion codes... |
@qiyifei1 how did you generate this PSF file? I have never heard of insertion codes in PSF files. Can you read this file in VMD? |
It was created using CHARMM-GUI which uses CHARMM to generate psf files. VMD is OK (display and selection). |
@qiyifei1 thanks for the example. If CHARMM-GUI produced the file then we should be able to parse it – but apparently we cannot, so this is a bug. |
So has this bug been fixed? The psf topology file still cannot be loaded. The mdanalysis version of 2.6.1 is used. File ~/software/miniconda3/envs/mdanalysis/lib/python3.10/site-packages/MDAnalysis/topology/PSFParser.py:149, in PSFParser.parse(self, **kwargs) File ~/software/miniconda3/envs/mdanalysis/lib/python3.10/site-packages/MDAnalysis/topology/PSFParser.py:178, in PSFParser._parse_sec(self, psffile, section_info) ValueError: Expected section NTHETA but found 12 During handling of the above exception, another exception occurred: ValueError: Failed to construct topology from file ../cg.psf with parser <class 'MDAnalysis.topology.PSFParser.PSFParser'>. There are some custom residues in this psf file.However,I can load this psf file by using VMD.Is there any other solution? |
@ldx022 does your PSF file contain insertion codes, as in the original report, i.e. residue numbers with directly a character following? |
Thank you for your reply. For the psf file type, I only know that it is one of the topological formats.I'm not sure what insert code is, if I follow my own understanding, I have checked and there is no similar situation to the above 185A GLU.This psf file was generated using a coarse-grained program we developed. As a result, it has some custom residue types and atom types.Using vmd to load this file without any problem, I now attach the psf file(Because github upload has format restrictions, so I replaced the psf suffix with txt suffix) |
I recently ran into the same issue where I was unable to parse PSF files generated by psfgen in VMD. After checking the PSF format, surprise surprise resid is a string! see the format below In VMD, resid is read as a string and then converted to an integer using the atoi function. I believe the optimal approach would be to maintain |
Can someone dig out the PSF specs from the CHARMM website or the source? If it’s clear that insertion codes are defined then we can parse them separately and have an attribute “icode” do residues, IIRC we have that for PDB. I’d rather parse the correct semantics than having a residstr attribute. |
From the latest
LRESID -> A8 / A4 I believe CHARMM formats the resid to be left-justified and adds the insertion code at the end if present. However, in the file generated by psfgen, the resid changes to hex (when it exceeds 99999?). It makes it difficult to differentiate the resid from the insertion code under these circumstances. We can certainly be courteous and consider all conditions (if possible), or simply remove all non-numeric characters from the resid and parse the remainder (and adding 'residstr' as an attribute or not). |
The 0.18.0 MDAnalysis failed to parse charmm psf file when the residue id is not pure digit.
Error message:
Here are a few lines from the psf file. It is quite common to have a letter in the residue id in pdb files.
The text was updated successfully, but these errors were encountered: