def read_gtf(<EOL>filepath_or_buffer,<EOL>expand_attribute_column=True,<EOL>infer_biotype_column=False,<EOL>column_converters={},<EOL>usecols=None,<EOL>features=None,<EOL>chunksize=<NUM_LIT> * <NUM_LIT>):
if isinstance(filepath_or_buffer, string_types) and not exists(filepath_or_buffer):<EOL><INDENT>raise ValueError("<STR_LIT>" % filepath_or_buffer)<EOL><DEDENT>if expand_attribute_column:<EOL><INDENT>result_df = parse_gtf_and_expand_attributes(<EOL>filepath_or_buffer,<EOL>chunksize=chunksize,<EOL>restrict_attribute_columns=usecols)<EOL><DEDENT>else:<EOL><INDENT>result_df = parse_gtf(result_df, features=features)<EOL><DEDENT>for column_name, column_type in list(column_converters.items()):<EOL><INDENT>result_df[column_name] = [<EOL>column_type(string_value) if len(string_value) > <NUM_LIT:0> else None<EOL>for string_value<EOL>in result_df[column_name]<EOL>]<EOL><DEDENT>if infer_biotype_column:<EOL><INDENT>unique_source_values = set(result_df["<STR_LIT:source>"])<EOL>if "<STR_LIT>" in unique_source_values:<EOL><INDENT>column_names = set(result_df.columns)<EOL>if "<STR_LIT>" not in column_names:<EOL><INDENT>logging.info("<STR_LIT>")<EOL>result_df["<STR_LIT>"] = result_df["<STR_LIT:source>"]<EOL><DEDENT>if "<STR_LIT>" not in column_names:<EOL><INDENT>logging.info("<STR_LIT>")<EOL>result_df["<STR_LIT>"] = result_df["<STR_LIT:source>"]<EOL><DEDENT><DEDENT><DEDENT>if usecols is not None:<EOL><INDENT>column_names = set(result_df.columns)<EOL>valid_columns = [c for c in usecols if c in column_names]<EOL>result_df = result_df[valid_columns]<EOL><DEDENT>return result_df<EOL>
Parse a GTF into a dictionary mapping column names to sequences of values.

Parameters
----------
filepath_or_buffer : str or buffer object
    Path to GTF file (may be gzip compressed) or buffer object
    such as StringIO

expand_attribute_column : bool
    Replace strings of semi-colon separated key-value values in the
    'attribute' column with one column per distinct key, with a list of
    values for each row (using None for rows where key didn't occur).

infer_biotype_column : bool
    Due to the annoying ambiguity of the second GTF column across multiple
    Ensembl releases, figure out if an older GTF's source column is actually
    the gene_biotype or transcript_biotype.

column_converters : dict, optional
    Dictionary mapping column names to conversion functions. Will replace
    empty strings with None and otherwise passes them to given conversion
    function.

usecols : list of str or None
    Restrict which columns are loaded to the give set. If None, then
    load all columns.

features : set of str or None
    Drop rows which aren't one of the features in the supplied set

chunksize : int