def get_sifts_xml_contents(self, pdb_id): self.log_lookup('SIFTS xml {0}'.format(pdb_id)) pdb_id = pdb_id.upper() if not self.sifts_xml_contents.get(pdb_id): if self.sifts_objects.get(pdb_id): self.add_sifts_xml_contents(pdb_id, self.sifts_objects[pdb_id].xml_contents) elif self.cache_dir: self.add_sifts_xml_contents(pdb_id, download_sifts_xml(pdb_id, self.cache_dir, silent = True)) else: self.add_sifts_xml_contents(pdb_id, retrieve_sifts_xml(pdb_id, silent = True)) return self.sifts_xml_contents[pdb_id]
def get_sifts_object(self, pdb_id, acceptable_sequence_percentage_match = 90.0, restrict_match_percentage_errors_to_these_uniparc_ids = None): # todo: we need to store all/important parameters for object creation and key on those as well e.g. "give me the SIFTS object with , restrict_match_percentage_errors_to_these_uniparc_ids = <some_set>" # otherwise, unexpected behavior may occur self.log_lookup('SIFTS object {0}'.format(pdb_id)) pdb_id = pdb_id.upper() if not self.sifts_objects.get(pdb_id): if not self.sifts_xml_contents.get(pdb_id): if self.cache_dir: self.add_sifts_xml_contents(pdb_id, download_sifts_xml(pdb_id, self.cache_dir, silent = True)) else: self.add_sifts_xml_contents(pdb_id, retrieve_sifts_xml(pdb_id, silent = True)) self.add_sifts_object(pdb_id, SIFTS.retrieve(pdb_id, cache_dir = self.cache_dir, acceptable_sequence_percentage_match = acceptable_sequence_percentage_match, bio_cache = self, restrict_match_percentage_errors_to_these_uniparc_ids = restrict_match_percentage_errors_to_these_uniparc_ids)) return self.sifts_objects[pdb_id]