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]
#!/usr/bin/python # encoding: utf-8 """ sifts.py test code. Created by Shane O'Connor 2016 """ import sys import os import time import pprint sys.path.insert(0, os.path.join('..', '..')) from klab import colortext from klab.bio.sifts import SIFTS #for pdb_id in ['1AQT', '1lmb', '1utx', '2gzu', '2pnr', '1y8p', '2q8i', '1y8n', '1y8o', '1oax', '3dvn', '1mnu', '1mcl', '2p4a', '1s78', '1i8k']: for pdb_id in ['2pnr']: print('\n') colortext.message(pdb_id) s = SIFTS.retrieve(pdb_id, cache_dir = '/kortemmelab/data/oconchus/SIFTS', acceptable_sequence_percentage_match = 70.0) colortext.warning(pprint.pformat(s.region_mapping)) colortext.warning(pprint.pformat(s.region_map_coordinate_systems)) colortext.warning(pprint.pformat(s.pfam_scop_mapping)) colortext.warning(pprint.pformat(s.scop_pfam_mapping)) print('\n') print('\n\n')