Package Bio :: Package expressions :: Package swissprot :: Module speclist
[hide private]
[frames] | no frames]

Source Code for Module Bio.expressions.swissprot.speclist

 1  """Parser for the SPECLIST.TXT file in SWISS-PROT. 
 2   
 3  You probably want to use the variables 'record' (for a single record) 
 4  and 'format' (for a set of records). 
 5   
 6  """ 
 7   
 8  import warnings 
 9  warnings.warn("Bio.expressions was deprecated, as it does not work with recent versions of mxTextTools. If you want to continue to use this module, please get in contact with the Biopython developers at biopython-dev@biopython.org to avoid permanent removal of this module from Biopython", DeprecationWarning) 
10   
11   
12  from Martel import * 
13   
14   
15 -def SkipLinesToNoEOL(expr):
16 return Rep(AssertNot(expr) + ToEol()) + expr
17 18 19 20 DESCRIPTION = Str("Description:") + Spaces() + UntilEol("description") + AnyEol() 21 NAME = Str("Name:") + Spaces() + UntilEol("name") + AnyEol() 22 RELEASE = Str("Release:") + Spaces() + UntilEol("release") + AnyEol() 23 24 TOTAL_CODES = Str("Total number of organism identification codes currently defined:") + Spaces() + Integer("num_organism_codes") + Str(".") + AnyEol() 25 26 TABLE_HEADER = Group("table_header", 27 Str("Code") + Spaces() + Str("Taxon") + Spaces() + 28 Str("N=Official name") + ToEol() + 29 Spaces() + Str("Node") + Spaces() + 30 Str("C=Common name") + ToEol() + 31 Spaces() + Str("S=Synonym") + ToEol() + 32 Rep1(Any(" _")) + AnyEol() 33 ) 34 35 _dash_line = Rep1(Str("-")) + AnyEol() 36 COPYRIGHT = Group("copyright", 37 _dash_line + 38 Str("SWISS-PROT is copyright.") + ToEol() + 39 SkipLinesToNoEOL(_dash_line) + 40 Rep(AnyEol()) 41 ) 42 43 _code_line = Group("code", Re(r"[A-Z0-9]{1,5}")) + \ 44 Spaces() + \ 45 Group("kingdom", Any("ABEV")) + \ 46 Spaces() + \ 47 Group("taxon_node", Digits()) + Str(":") + \ 48 Spaces() + \ 49 Str("N=") + Group("official_name", UntilEol()) + \ 50 AnyEol() 51 _common_line = Spaces() + \ 52 Str("C=") + Group("common_name", UntilEol()) + \ 53 AnyEol() 54 _synonym_line = Spaces() + \ 55 Str("S=") + Group("synonym", UntilEol()) + \ 56 AnyEol() 57 record = Group("record", 58 _code_line + Rep(_common_line) + Rep(_synonym_line) 59 ) 60 61 format = Group("format", 62 SkipLinesToNoEOL(DESCRIPTION) + 63 NAME + 64 RELEASE + 65 SkipLinesToNoEOL(TOTAL_CODES) + 66 SkipLinesToNoEOL(TABLE_HEADER) + 67 Rep1(record) + 68 AnyEol() + 69 COPYRIGHT 70 ) 71