{"action":"created","issue":{"url":"https://api.github.com/repos/biojava/biojava/issues/330","labels_url":"https://api.github.com/repos/biojava/biojava/issues/330/labels{/name}","comments_url":"https://api.github.com/repos/biojava/biojava/issues/330/comments","events_url":"https://api.github.com/repos/biojava/biojava/issues/330/events","html_url":"https://github.com/biojava/biojava/issues/330","id":107572621,"number":330,"title":"DBREF records in PDB files written from StructureImpl cause IndexOutOfRange exception when reading back in","user":{"login":"sroughley","id":8321832,"avatar_url":"https://avatars.githubusercontent.com/u/8321832?v=3","gravatar_id":"","url":"https://api.github.com/users/sroughley","html_url":"https://github.com/sroughley","followers_url":"https://api.github.com/users/sroughley/followers","following_url":"https://api.github.com/users/sroughley/following{/other_user}","gists_url":"https://api.github.com/users/sroughley/gists{/gist_id}","starred_url":"https://api.github.com/users/sroughley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sroughley/subscriptions","organizations_url":"https://api.github.com/users/sroughley/orgs","repos_url":"https://api.github.com/users/sroughley/repos","events_url":"https://api.github.com/users/sroughley/events{/privacy}","received_events_url":"https://api.github.com/users/sroughley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-09-21T18:39:11Z","updated_at":"2015-09-22T18:59:11Z","closed_at":null,"body":"DBREF records do not all contain 80 characters when written out using StructureImpl#toPdb(), and so re-reading a PDB file written out this way causes an exception to be thrown as the DBREF parser in PDBFileParser at the following line:\r\n\r\nString dbinsEnd = line.substring(67,68);  (line 2198)\r\n\r\nThere are a number of other StructureImpl Member classes which also do not write full length lines (e.g. HEADER is truncated after ~67 chars).  In most cases, these do not affect the biojava parser but may effect other tools which expect the full 80 char lines.  However, e.g. TITLE wraps the title over multiple lines each of 67 chars instead of using the full width.\r\n\r\nI suggest:\r\n1) Add an option to FileParsingParameters for allowShortLines, which simply adds ' ' chars to each line shorter than 80 characters during the reading process when it is 'true'\r\n2) (Optional) Ensure all parsing methods which parse lines with optional parameters at the end are \"short line safe\"\r\n3) Fix the toPDB() methods of all classes to ensure they write full 80-char lines\r\n\r\nIf agreed, I can start to work through these (starting with the first option)"},"comment":{"url":"https://api.github.com/repos/biojava/biojava/issues/comments/142385916","html_url":"https://github.com/biojava/biojava/issues/330#issuecomment-142385916","issue_url":"https://api.github.com/repos/biojava/biojava/issues/330","id":142385916,"user":{"login":"sroughley","id":8321832,"avatar_url":"https://avatars.githubusercontent.com/u/8321832?v=3","gravatar_id":"","url":"https://api.github.com/users/sroughley","html_url":"https://github.com/sroughley","followers_url":"https://api.github.com/users/sroughley/followers","following_url":"https://api.github.com/users/sroughley/following{/other_user}","gists_url":"https://api.github.com/users/sroughley/gists{/gist_id}","starred_url":"https://api.github.com/users/sroughley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sroughley/subscriptions","organizations_url":"https://api.github.com/users/sroughley/orgs","repos_url":"https://api.github.com/users/sroughley/repos","events_url":"https://api.github.com/users/sroughley/events{/privacy}","received_events_url":"https://api.github.com/users/sroughley/received_events","type":"User","site_admin":false},"created_at":"2015-09-22T18:59:11Z","updated_at":"2015-09-22T18:59:11Z","body":"If you like, I will see how much work it would be to add StructureException - it would seem to be more consistent that way, and then IOException is retained for real IOException situations e.g. dropped file connections, stream closing issues and the like?"}}