def parse_model_file(path):
    """Parse a file as a list of model reactions

    The file format is detected and the file is parsed accordinly. The file is
    specified as a file path that will be opened for reading. Path can be given
    as a string or a context.
    """

    context = FilePathContext(path)

    format = resolve_format(None, context.filepath)
    if format == 'tsv':
        logger.debug('Parsing model file {} as TSV'.format(context.filepath))
        with context.open('r') as f:
            for reaction_id in parse_model_table_file(context, f):
                yield reaction_id
    elif format == 'yaml':
        logger.debug('Parsing model file {} as YAML'.format(context.filepath))
        with context.open('r') as f:
            for reaction_id in parse_model_yaml_file(context, f):
                yield reaction_id
def parse_model_file ( path ) : context = FilePathContext ( path ) format = resolve_format ( None , context . filepath ) if format == 'tsv' : logger . debug ( 'Parsing model file {} as TSV' . format ( context . filepath ) ) with context . open ( 'r' ) as f : for reaction_id in parse_model_table_file ( context , f ) : yield reaction_id elif format == 'yaml' : logger . debug ( 'Parsing model file {} as YAML' . format ( context . filepath ) ) with context . open ( 'r' ) as f : for reaction_id in parse_model_yaml_file ( context , f ) : yield reaction_id
Parse a file as a list of model reactions

    The file format is detected and the file is parsed accordinly. The file is
    specified as a file path that will be opened for reading. Path can be given
    as a string or a context.