def setUpClass(cls):
        """
        Create an empty temporary database, load and write a template.
        """
        cls.file_root = Path(tempfile.mkdtemp("-templatedb", "phyreengine-"))
        cls.database = cls.file_root / "test.db"
        TemplateDatabase.create(str(cls.database))

        (cls.file_root / "2a" / "12as").mkdir(parents=True)
        mmcif_buf = io.StringIO(minimal.MINIMAL_MMCIF)
        mmcif_struc = Bio.PDB.MMCIFParser().get_structure("", mmcif_buf)
        cls.sample_template = Template.build("12as", "A", mmcif_struc[0]["A"])
        with (cls.file_root / "2a" / "12as" / "12as_A.pdb").open("w") as tout:
            cls.sample_template.write(tout)
Beispiel #2
0
    def setUp(self):
        """Create a temporary pipeline state in `self.state`."""

        # Save dummy template to library.
        self.pdb_lib_dir = pathlib.Path(tempfile.mkdtemp())
        template_file = (self.pdb_lib_dir / "xy" / "1xyz" / "1xyz_A.pdb")
        template_file.parent.mkdir(parents=True)
        template = self.template()
        with template_file.open("w") as template_out:
            template.write(template_out)

        # Create a temporary template database and add dummy template
        _, db_file = tempfile.mkstemp("-foldlib", "phyreengine-")
        self.template_db = pathlib.Path(db_file)
        TemplateDatabase.create(str(self.template_db))
        template_db = TemplateDatabase(
            str(self.template_db),
            str(self.pdb_lib_dir))
        template_db.add_pdb("1xyz", {
            "deposition_date": datetime.date(2000, 1, 1),
            "release_date": datetime.date(2000, 1, 1),
            "last_update_date": datetime.date(2000, 1, 1),
            "method": "X-RAY CRYSTALLOGRAPHY",
        })
        template_db.add_template(template)
        template_db.commit()

        # Create empty directory for storing models and chdir there.
        self.model_dir = pathlib.Path(tempfile.mkdtemp())
        self.orig_dir = os.getcwd()
        os.chdir(str(self.model_dir))

        # Create pipeline state that can be modified without consequence.
        self.state = {
            "query_sequence": copy.deepcopy(self._QUERY_SEQ),
            "PDB": "1xyz",
            "chain": "A",
            "alignment": copy.deepcopy(self._ALIGNMENT),
            "rank": 1
        }

        self.modeller = HomologyModeller(
            str(self.template_db),
            str(self.pdb_lib_dir))
        self.results = self.modeller.run(self.state)
Beispiel #3
0
 def run(self, data, config=None, pipeline=None):
     """Create an empty fold library database."""
     TemplateDatabase.create(self.template_db)
     return data