As Titus requested, here is a series of examples showing the standard
usages of the metabase public interfaces.
# basic: connect to list of metabases specified by env
mdb = MetabaseList() # use default PYGRDATAPATH
# or specify your own path
mdb = MetabaseList('~,.,mysql:somedb.sometable')
# or instead connect to a *single* metabase
mdb = Metabase('mysql:somedb.sometable', resourceCache=ResourceCache())
# get a "directory listing"
print mdb.dir('Bio.MSA') # show all alignment resources
# get a resource
msa = mdb.Data.Bio.MSA.UCSC.hg17_multiz17way()
# could also get resource like this
msa = mdb('Bio.MSA.UCSC.hg17_multiz17way')
# save a resource
mdb.Data.Bio.Seq.Swissprot.sp42 = sp
mdb.commit() # only actually saved when you commit!
# could also save like this
mdb.add_resource('Bio.Seq.Swissprot.sp42', sp)
# save with schema, here declared using metabase.ManyToManyRelation
mdb.Schema.Bio.Test.map = ManyToManyRelation(sourceDB, targetDB,
bindAttrs=('exons',))
# could also save schema like this
mdb.add_schema('Bio.Test.map', ManyToManyRelation(sourceDB, targetDB,
bindAttrs=('exons',)))
# rollback uncommitted changes
mdb.rollback()
# clear resource cache; any future requests will force reloading
mdb.clear_cache()
# deleting a resource takes effect immediately; make this transactional?
mdb.delete_resource('Bio.Seq.Swissprot.sp42')
# create an XMLRPC server to serve all resources currently loaded in mdb
server = ResourceServer(mdb, 'myname', withIndex=True)
# start the server and never exit
server.serve_forever()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pygr-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pygr-dev?hl=en
-~----------~----~----~----~------~----~------~--~---