コード例 #1
0
ファイル: biosql_db_ex.py プロジェクト: manucorreia/biopython
"""Example of registering a BioSQL database using Biopython-specific system.
"""
# register our BioSQL database

from Bio.sources import BioSQL
fred_db = BioSQL(name = "fred",
                 doc = "Test MySQL server on fred",
                 db_host = "192.168.0.192",
                 db_user = "******",
                 db_passwd = "",
                 sql_db = "test_biosql",
                 namespace_db = "embl_rod")

from Bio import register_db
register_db(name = "biosql-embl-fred",
            key = "accession",
            source = fred_db,
            failure = [])

# deal with the database
from Bio import db
biosql_db = db["biosql-embl-fred"]


rec = biosql_db["AB030760"]
print rec
print rec.description
print rec.id
print rec.name
print rec.seq.data[0:20]

コード例 #2
0
"""Example of registering an Indexed file using the Biopython system.
"""
# register our indexed file
from Bio.sources import IndexedFile
index_file = IndexedFile(name = "test",
                         doc = "Test indexed file",
                         dbname = "/home/chapmanb/bioppjx/tmp/test")

from Bio import register_db
register_db(name = "indexfile-test-swissprot",
            key = "id",
            source = index_file,
            failure = [])

# deal with the database
from Bio import db
indexed_db = db["indexfile-test-swissprot"]


rec = indexed_db["N33_HUMAN"]
print rec
print rec.description
print rec.id
print rec.name
print rec.seq.data[0:20]

コード例 #3
0
"""Example of registering a BioCorba database using Biopython-specific system.
"""
# register our BioCorba database
from Bio.sources import BioCorba
fred_corba = BioCorba(name = "fred",
                      doc = "Test CORBA server on fred",
                      ior_ref = "http://fred/CORBA/py_collection.ior")

from Bio import register_db
register_db(name = "biocorba-test-fred",
            key = "accession",
            source = fred_corba,
            failure = [])

# deal with the database
from Bio import db
biocorba_db = db["biocorba-test-fred"]


rec = biocorba_db["X55053"]
print rec
print rec.description
print rec.id
print rec.name
print rec.seq.data[0:20]

コード例 #4
0
"""Example of registering a database with the Biopython-specific system.
"""
from Bio.sources import CGI
local_cgi = CGI(name = "local_cgi",
                delay = 0.0,
                cgi = "http://www.myserver.org/cgi-bin/my_local.cgi",
                url = "http://www.myserver.org/cgi_documentation.html",
                doc = "Query a local databases",
                failure_cases = [])

import Martel
my_failures = [
     (Martel.Str("Sequence not available"), "No sequence found")]

from Bio import register_db
register_db(name = "nucleotide-genbank-local",
            key = "uid",
            source = local_cgi,
            failure = my_failures)

register_db(name = "genbank", behavior = "concurrent")
from Bio import group_db
group_db("genbank", "nucleotide-genbank-local")
group_db("genbank", "nucleotide-genbank-cgi")

from Bio import db
print db.keys()