Package Bio :: Package Mindy
[hide private]
[frames] | no frames]

Source Code for Package Bio.Mindy

 1  """Bio.Mindy provides functionality building on the Martel parser (DEPRECATED). 
 2   
 3  Andrew Dalke is no longer maintaining Martel or Bio.Mindy, and these modules 
 4  are now deprecated.  They are no longer used in any of the current Biopython 
 5  parsers, and are likely to be removed in a future release. 
 6  """ 
 7   
 8  import warnings 
 9  warnings.warn("Martel and those parts of Biopython depending on it" \ 
10                +" directly (such as Bio.Mindy) are now deprecated, and will" \ 
11                +" be removed in a future release of Biopython.  If you want"\ 
12                +" to continue to use this code, please get in contact with"\ 
13                +" the Biopython developers via the mailing lists to avoid"\ 
14                +" its permanent removal from Biopython.", \ 
15                DeprecationWarning) 
16   
17  import os, sys 
18  _open = open  # rename for internal use -- gets redefined below 
19   
20 -def open(dbname, mode = "r"):
21 text = _open(os.path.join(dbname, "config.dat"), "rb").read() 22 line = text.split("\n")[0] 23 if line == "index\tBerkeleyDB/1": 24 import BerkeleyDB 25 return BerkeleyDB.open(dbname, mode) 26 elif line == "index\tflat/1": 27 import FlatDB 28 return FlatDB.open(dbname, mode) 29 30 raise TypeError("Unknown index type: %r" % (line,))
31 32
33 -def main():
34 from Bio import Std 35 import XPath 36 import FlatDB 37 XPath.xpath_index( 38 #dbname = "sprot_flat", 39 dbname = "sprot_small", 40 filenames = ["/home/dalke/ftps/swissprot/smaller_sprot38.dat", 41 #filenames = ["/home/dalke/ftps/swissprot/sprot38.dat", 42 ], 43 primary_namespace = "entry", 44 extract_info = [ 45 ("entry", "//entry_name"), 46 ("accession", "//%s[@type='accession']" % (Std.dbid.tag,)), 47 ], 48 #creator_factory = FlatDB.CreateFlatDB, 49 )
50 51 52 if __name__ == "__main__": 53 main() 54