Skip to content

Commit

Permalink
Makes grade import more error save
Browse files Browse the repository at this point in the history
  • Loading branch information
dkratzert committed Jun 18, 2023
1 parent 4ca7ddd commit 5771dd1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/dsr_shelx/dbfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,9 +982,12 @@ def get_name_from_pdbfile(self) -> str:
return full_name

def get_name_from_cif_file(self) -> str:
name = ''
cif_str = self.gradefiles.cif_file.splitlines(keepends=False)
cif = read_cif(cif_str)
name = cif.get('_chem_comp.name')[0]
cif_value = cif.get('_chem_comp.name')
if cif_value and isinstance(cif_value, (list, tuple)):
name = cif_value[0]
return name

def get_resi_from_pdbfile(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_grade.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def testrun_get_comments(self):
# line = str(line, encoding='ascii')
ob.append(line.split())
comments = self.ig.get_comments()
name = u'REM Name: ' + u'AlOCCF334'
name = 'REM Name: ' + 'AlOCCF334'
ob.insert(0, name.split()) # Name is always at first place
self.assertEqual(comments, ob)

Expand Down

0 comments on commit 5771dd1

Please sign in to comment.