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

Fails to make a universe from 2Y2N.pdb #936

Closed
kaceyaurum opened this issue Aug 15, 2016 · 7 comments
Closed

Fails to make a universe from 2Y2N.pdb #936

kaceyaurum opened this issue Aug 15, 2016 · 7 comments

Comments

@kaceyaurum
Copy link
Contributor

When a universe should be created, a KeyError is raised.


KeyError Traceback (most recent call last)
in ()
----> 1 mda.Universe(path + '2Y2N.pdb')

/usr/local/lib/python2.7/dist-packages/MDAnalysis/core/AtomGroup.pyc in init(self, _args, *_kwargs)
4337 try:
4338 with parser(self.filename, universe=self) as p:
-> 4339 self._topology = p.parse()
4340 except IOError as err:
4341 raise IOError("Failed to load from the topology file {0}"

/usr/local/lib/python2.7/dist-packages/MDAnalysis/topology/PDBParser.pyc in parse(self)
88 structure['atoms'] = atoms
89
---> 90 bonds = self._parsebonds(atoms)
91 structure['bonds'] = bonds
92

/usr/local/lib/python2.7/dist-packages/MDAnalysis/topology/PDBParser.pyc in _parsebonds(self, atoms)
181 atom, atoms = _parse_conect(line.strip())
182 for a in atoms:
--> 183 bond = tuple([mapping[atom], mapping[a]])
184 bonds.add(bond)
185

KeyError: 3635

import MDAnalysis as mda

u = mda.Universe('2Y2N.pdb')
@jdetle
Copy link
Contributor

jdetle commented Aug 15, 2016

Hi @kaceyreidy, I'd be happy to try help. Are you able to share the 2Y2N.pdbfile such that I can try to reproduce the error? Also, if you could please run python -c "import MDAnalysis as mda; print(mda.__version__)" and share that info and let us know what OS you are running that can't hurt either.

@dotsdl
Copy link
Member

dotsdl commented Aug 15, 2016

@jdetle this is a file for a structure on the PDB, namely 2Y2N. You can download it from here.

@kaceyaurum
Copy link
Contributor Author

Ubuntu 14.04.

On Monday, August 15, 2016, David Dotson [email protected] wrote:

@jdetle https://github.com/jdetle this is a file for a structure on the
PDB, namely 2Y2N. You can download it from here
http://files.rcsb.org/download/2Y2N.pdb.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#936 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/APP-KlTRkYzfX07FzfO-AYeMn3GBjszjks5qgN0rgaJpZM4JkyhT
.

@orbeckst
Copy link
Member

@jdetle , see #810 (comment) :

import urllib 
downloader = urllib.URLopener()

def fetch_pdb(pdb_id, download_url="http://files.rcsb.org/download"):
    filename = "{0}.pdb".format(pdb_id.lower())
    downloader.retrieve("/".join([download_url, filename]), filename)
    return filename

# get file
pdb = fetch_pdb("2y2n")

# load pdb
u = mda.Universe(pdb)

@jdetle
Copy link
Contributor

jdetle commented Aug 15, 2016

@dotsdl, @orbeckst, the issue seems to be caused by the TER statement on line 8045. The comments in the _parse_bonds function alludes to problems with multiframe PDBs and the CONECT statements being given at the end of the file. It looks like this is a case where the error isn't caught. Any help?

@richardjgowers
Copy link
Member

So looking into this, there's a CONECT record between atoms and the TER record. As the TER record doesn't represent a real Atom, would a good fix for this be to ignore bonds to the TER location?

@orbeckst
Copy link
Member

I think so, yes. I don't really know why one would have these pseudo bonds but it won't matter for MDAnalysis if they are there. It might be an issue when writing PDB files but I am willing to wait for someone to raise an issue for the PDBWriter about this…

On 20 Aug, 2016, at 05:46, Richard Gowers [email protected] wrote:

So looking into this, there's a CONECT record between atoms and the TER record. As the TER record doesn't represent a real Atom, would a good fix for this be to ignore bonds to the TER location?

Oliver Beckstein * [email protected]
skype: orbeckst * [email protected]

richardjgowers added a commit that referenced this issue Aug 21, 2016
CONECT records to unknown entries (hopefully TER) are now ignored
jbarnoud added a commit that referenced this issue Aug 24, 2016
abiedermann pushed a commit to abiedermann/mdanalysis that referenced this issue Jan 5, 2017
CONECT records to unknown entries (hopefully TER) are now ignored
abiedermann pushed a commit to abiedermann/mdanalysis that referenced this issue Jan 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants