Logo Search packages:      
Sourcecode: python-biopython version File versions

def Bio::config::DBRegistry::BioSQLDB::_get (   self,
) [private]

S._get(key) -> data

Reimplemented from Bio::config::DBRegistry::DBObject.

Definition at line 409 of file DBRegistry.py.

00409                        :
        # do the import here to prevent circular import problems
        from BioSQL import BioSeqDatabase

        # for params, we expect to get something like
        # [('accession', 'AB030760')]. We don't worry about what the id
        # is called right now, and just try to find it in the database
        # any way we can
        find_id = key

        db_driver = self._get_db_module(self.db_type)
        open_args = {"user" : self.db_user,
                     "passwd" : self.db_passwd,
                     "host" : self.db_host,
                     "db" : self.sql_db,
                     "driver" : db_driver}
        if self.db_port:
            open_args["port"] = self.db_port
        server = BioSeqDatabase.open_database( *(), **open_args)
        db = server[self.namespace_db]
        # try our different id choices to test the query
        item = None
        for possible_id_type in ["accession", "display_id"]:
                item = db.lookup( *(), **{possible_id_type : find_id})
            except IndexError:
        if item is None:
            raise KeyError("Could not get item with id: %s" % find_id)
        return item
    def _convert_to(self, data, to_io):

Generated by  Doxygen 1.6.0   Back to index