From d91ba932fab5018e910f931a4bcedb3a44edba07 Mon Sep 17 00:00:00 2001 From: Sam Ireland Date: Mon, 18 Mar 2019 15:17:36 +0000 Subject: [PATCH] Missing residues property --- atomium/data.py | 9 +++++++++ tests/integration/test_file_reading.py | 14 ++++++++++++++ tests/unit/test_files.py | 9 +++++++++ 3 files changed, 32 insertions(+) diff --git a/atomium/data.py b/atomium/data.py index c80b849f..449ba4b0 100644 --- a/atomium/data.py +++ b/atomium/data.py @@ -108,6 +108,15 @@ def expression_system(self): return self._expression_system + @property + def missing_residues(self): + """The residues that should be in the model but aren't. + + :rtype: ``list``""" + + return self._missing_residues + + @property def resolution(self): """The structure's resolution. diff --git a/tests/integration/test_file_reading.py b/tests/integration/test_file_reading.py index 3758f756..3e6d43bd 100644 --- a/tests/integration/test_file_reading.py +++ b/tests/integration/test_file_reading.py @@ -363,9 +363,22 @@ def test_1lol(self): self.assertEqual(f.keywords, [] if e == "mmtf" else ["TIM BARREL", "LYASE"] if e == "pdb" else ["TIM barrel", "LYASE"]) self.assertEqual(f.authors, [] if e == "mmtf" else ["N.WU", "E.F.PAI"] if e == "pdb" else ["Wu, N.", "Pai, E.F."]) self.assertEqual(f.technique, "X-RAY DIFFRACTION") + missing_residues = [{"id": id, "name": name} for id, name in zip([ + "A.1", "A.2", "A.3", "A.4", "A.5", "A.6", "A.7", "A.8", "A.9", "A.10", + "A.182", "A.183", "A.184", "A.185", "A.186", "A.187", "A.188", "A.189", + "A.223", "A.224", "A.225", "A.226", "A.227", "A.228", "A.229", "B.1001", + "B.1002", "B.1003", "B.1004", "B.1005", "B.1006", "B.1007", "B.1008", + "B.1009", "B.1010", "B.1182", "B.1183", "B.1184", "B.1185", "B.1186" + ], [ + "LEU", "ARG", "SER", "ARG", "ARG", "VAL", "ASP", "VAL", "MET", "ASP", + "VAL", "GLY", "ALA", "GLN", "GLY", "GLY", "ASP", "PRO", "LYS", "ASP", + "LEU", "LEU", "ILE", "PRO", "GLU", "LEU", "ARG", "SER", "ARG", "ARG", + "VAL", "ASP", "VAL", "MET", "ASP", "VAL", "GLY", "ALA", "GLN", "GLY" + ])] if e == "pdb": self.assertEqual(f.source_organism, "METHANOTHERMOBACTER THERMAUTOTROPHICUS STR. DELTA H") self.assertEqual(f.expression_system, "ESCHERICHIA COLI") + self.assertEqual(f.missing_residues, missing_residues) else: self.assertEqual( f.source_organism, @@ -374,6 +387,7 @@ def test_1lol(self): self.assertEqual( f.expression_system, None if e == "mmtf" else "Escherichia coli" ) + self.assertEqual(f.missing_residues, [] if e == "mmtf" else missing_residues) self.assertEqual(f.resolution, 1.9) self.assertEqual(f.rvalue, 0.193) self.assertEqual(f.rfree, 0.229) diff --git a/tests/unit/test_files.py b/tests/unit/test_files.py index 18c51c7b..196a05ca 100644 --- a/tests/unit/test_files.py +++ b/tests/unit/test_files.py @@ -112,6 +112,15 @@ def test_expression_system(self): +class MissingResiduesPropertyTests(TestCase): + + def test_missing_residues(self): + f = File("abc") + f._missing_residues = "XXX" + self.assertIs(f.missing_residues, f._missing_residues) + + + class ResolutionPropertyTests(TestCase): def test_resolution(self):