Skip to content

Commit

Permalink
Fixed comments processing for NMR-STAR version 2 format.
Browse files Browse the repository at this point in the history
  • Loading branch information
smelandr committed Jan 11, 2017
1 parent 669f0ca commit 58ed6a3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions nmrstarlib/nmrstarlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ def _build_starfile(self, nmrstar_str):
elif token[0:5] == u"data_":
self.bmrbid = token[5:]
self[u"data"] = self.bmrbid

elif token.lstrip().startswith(u"#"):
odict[u"comment_{}".format(comment_count)] = token
comment_count += 1

else:
print("Error: Invalid token {}".format(token), file=sys.stderr)
print("In _build_starfile try block", file=sys.stderr)
Expand Down Expand Up @@ -212,6 +214,9 @@ def _build_saveframe(self, lexer):
odict[u"loop_{}".format(loop_count)] = self._build_loop(lexer)
loop_count += 1

elif token.lstrip().startswith(u"#"):
continue

else:
print("Error: Invalid token {}".format(token), file=sys.stderr)
print("In _build_saveframe try block", file=sys.stderr)
Expand Down Expand Up @@ -438,9 +443,7 @@ def chem_shifts_by_residue(self, aminoacids=None, atoms=None, nmrstarversion="3"

chains = []
for saveframe in self:
if saveframe == u"data":
continue
elif saveframe.startswith(u"comment"):
if saveframe == u"data" or saveframe.startswith(u"comment"):
continue
else:
for ind in self[saveframe].keys():
Expand Down

0 comments on commit 58ed6a3

Please sign in to comment.