1 """Configuration information about NCBI's databases"""
2
3
4
5 PUBLICATION_TYPE = 0
6 SEQUENCE_TYPE = 1
7
8
10 """stores NCBI's name for the database and its type"""
12 self.db = db
13 self.dbtype = dbtype
14
16 """map from name to DatabaseInfo for that database name
17
18 Entries are also available through attributes like PUBMED,
19 OMIM, and NUCLEOTIDE.
20 """
21 - def gettype(self, db, dbtype = None):
22 """Given a database name and optional type, return the database type"""
23 if dbtype not in (None, SEQUENCE_TYPE, PUBLICATION_TYPE):
24 raise TypeError("Unknown database type: %r" % (dbtype,))
25 if dbtype is None:
26 dbtype = self[db].dbtype
27 return dbtype
28
29 databases = DatabaseDict()
30
34
35
36
37
38
39
40
41
42
43
44
45
46
47 databases.PUBMED = _add_db(DatabaseInfo("pubmed", 0))
48 databases.OMIM = _add_db(DatabaseInfo("omim", 0))
49 databases.JOURNALS = _add_db(DatabaseInfo("journals", 0))
50
51 databases.GENOME = _add_db(DatabaseInfo("genome", 1))
52 databases.NUCLEOTIDE = _add_db(DatabaseInfo("nucleotide", 1))
53 databases.PROTEIN = _add_db(DatabaseInfo("protein", 1))
54 databases.POPSET = _add_db(DatabaseInfo("popset", 1))
55 databases.SEQUENCES = _add_db(DatabaseInfo("sequences", 1))
56 databases.UNIGENE = _add_db(DatabaseInfo("unigene", 1))
57 databases.GENE = _add_db(DatabaseInfo("gene", 1))
58
59
60
61
62
63
64
65
66
67
68
69
70