1
2 """This module is DEPRECATED.
3
4 DBXref was used in building SeqRecords from Martel descriptions (see
5 Bio.builders.SeqRecord.sequence for more details).
6
7 Andrew Dalke is no longer maintaining Martel or Bio.Mindy, and these modules
8 and associate ones like Bio.DBXRef are now deprecated. They are no longer
9 used in any of the current Biopython parsers, and are likely to be removed
10 in a future release.
11 """
12
13 import warnings
14 warnings.warn("Martel and those parts of Biopython closely linked to it" \
15 +" (such as Bio.DBXRef which is not used elsewhere) are now" \
16 +" deprecated, and will be removed in a future release of"\
17 +" Biopython. If you want to continue to use this code,"\
18 +" please get in contact with the Biopython developers via"\
19 +" the mailing lists to avoid its permanent removal from"\
20 +" Biopython.", \
21 DeprecationWarning)
22
24 - def __init__(self, dbname, dbid, reftype = None, negate = 0):
25 self.dbname = dbname
26 self.dbid = dbid
27 self.reftype = reftype
28 self.negate = negate
29
31 if self.reftype is None:
32 reftype = ""
33 else:
34 reftype = self.reftype + "="
35 s = "%s/%s%s" % (self.dbname, reftype, self.dbid)
36 if self.negate:
37 s = "not(%s)" % s
38 return s
39 __repr__ = __str__
40
46 return "x-unknown-" + name.lower()
47
48 dbname_conversions = {
49 "bioformat": BioformatDBName(),
50 "unknown": UnknownDBName(),
51 "sp": {"AARHUS/GHENT-2DPAGE": "x-aarhus-ghent-2dpage",
52 "CARBBANK": "x-carbbank",
53 "DICTYDB": "x-dictydb",
54 "ECO2DBASE": "x-eco2dbase",
55 "ECOGENE": "x-ecogene",
56 "EMBL": "embl",
57 "FLYBASE": "fb",
58 "GCRDB": "x-gcrdb",
59 "HIV": "x-hiv",
60 "HSC-2DPAGE": "x-hsc",
61 "HSSP": "x-hssp",
62 "MAIZE-2DPAGE": "x-maize",
63 "MAIZEDB": "x-maizedb",
64 "MENDEL": "x-mendel",
65 "MGD": "mgd",
66 "MIM": "x-mim",
67 "PDB": "x-pdb",
68 "PFAM": "x-pfam",
69 "PIR": "pir",
70 "PROSITE": "x-prosite",
71 "REBASE": "x-rebase",
72 "SGD": "sgd",
73 "STYGENE": "x-stygene",
74 "SUBTILIST": "x-subtilist",
75 "SWISS-2DPAGE": "x-swiss",
76 "TIGR": "tigr",
77 "TRANSFAC": "x-transfac",
78 "WORMPEP": "x-wormpep",
79 "YEPD": "x-yepd",
80 "ZFIN": "x-zfin",
81 },
82 "go": {"CGEN": "cgen",
83 "DDB": "ddb",
84 "DDBJ": "ddbj",
85 "EC": "ec",
86 "EMBL": "embl",
87 "ENSEMBL": "ensembl",
88 "ENZYME": "enzyme",
89 "FB": "fb",
90 "GB": "gb",
91 "GO": "go",
92 "GXD": "gxd",
93 "IPR": "ipr",
94 "ISBN": "isbn",
95 "IUBMB": "iubmb",
96
97 "IUPAC": "iupac",
98
99 "MEDLINE": "medline",
100 "MGD": "mgd",
101 "MGI": "mgi",
102 "NC-IUBMB": "NC-IUBMB",
103
104
105 "PIR": "pir",
106 "PMID": "pmid",
107 "Pombase": "pombase",
108 "Pompep": "pompep",
109
110 "RESID": "resid",
111 "SGD": "sgd",
112 "SP": "sp",
113 "SWALL": "swall",
114 "TAIR": "tair",
115 "taxonID": "taxonid",
116 "TC": "tc",
117 "TIGR": "tigr",
118 "TR": "tr",
119 "WB": "wb",
120 },
121
122 "genbank": {
123 "ATCC": "x-atcc",
124
125 "ATCC(in host)": "x-atcc-host",
126 "ATCC(dna)": "x-atcc-dna",
127
128 "BDGP_EST": "x-bdgp-est",
129
130
131
132 "BDGP_INS": "x-bdgp-ins",
133
134
135
136
137 "dbEST": "x-dbest",
138
139
140 "dbSNP": "x-dbsnp",
141
142
143 "dbSTS": "x-dbsts",
144
145
146 "ENSEMBL": "ensembl",
147
148
149
150 "ESTLIB": "x-estlib",
151
152
153 "FANTOM_DB": "x-fantom-db",
154
155
156 "FLYBASE": "fb",
157
158
159 "GDB": "x-gdb",
160
161
162 "GI": "x-gi",
163
164
165
166 "GO": "go",
167
168
169 "IMGT/LIGM": "x-imgt-ligm",
170
171
172
173 "IMGT/HLA": "x-imgt-hla",
174
175
176
177 "LocusID": "x-locus-id",
178
179
180 "MaizeDB": "x-maizedb",
181
182
183 "MGD": "mgd",
184
185
186 "MGI": "mgi",
187
188
189 "MIM": "x-mim",
190
191
192 "niaEST": "x-niaEST",
193
194
195 "PIR": "pir",
196
197
198 "PSEUDO": "x-pseudo-embl",
199
200
201 "RATMAP": "x-ratmap",
202
203
204 "RiceGenes": "x-ricegenes",
205
206
207 "REMTREMBL": "x-remtrembl",
208
209
210
211
212
213
214
215
216
217 "RZPD": "x-rzpd",
218
219
220 "SGD": "sgd",
221
222
223 "SoyBase": "x-soybase",
224
225
226 "SPTREMBL": "x-sptrembl",
227
228
229
230
231
232
233
234 "SWISS-PROT": "sp",
235
236
237 "taxon": "taxonid",
238
239 },
240 }
241
242 -def from_parser(dbname_style, dbname, idtype, dbid, negate):
243 try:
244 dbname = dbname_conversions[dbname_style][dbname]
245 except KeyError:
246 dbname = "x-unknown2-%s--%s" % (dbname_style, dbname)
247 return DBXRef(dbname, dbid, idtype, negate)
248