#NEWLINE# def read_annotations_file( self , file_name , construction_separator = ' ' , analysis_sep = ',' ) : #NEWLINE# #INDENT# 'Read a annotations file.\n\n        Each line has the format:\n        <compound> <constr1> <constr2>... <constrN>, <constr1>...<constrN>, ...\n\n        Yield tuples (compound, list(analyses)).\n\n        ' #NEWLINE# annotations = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# _logger . info ( ( "Reading annotations from '%s'..." % file_name ) ) #NEWLINE# for line in self . _read_text_file ( file_name ) : #NEWLINE# #INDENT# ( compound , analyses_line ) = line . split ( None , 1 ) #NEWLINE# if ( compound not in annotations ) : #NEWLINE# #INDENT# annotations [ compound ] = [ ] #NEWLINE# #UNINDENT# if ( analysis_sep is not None ) : #NEWLINE# #INDENT# for analysis in analyses_line . split ( analysis_sep ) : #NEWLINE# #INDENT# analysis = analysis . strip ( ) #NEWLINE# annotations [ compound ] . append ( analysis . strip ( ) . split ( construction_separator ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# annotations [ compound ] . append ( analyses_line . split ( construction_separator ) ) #NEWLINE# #UNINDENT# #UNINDENT# _logger . info ( 'Done.' ) #NEWLINE# return annotations