Read STAR Log.final.out file.

    Parameters
    ----------
    fn : string
        Path to Log.final.out file.

    define_sample_name : function that takes string as input
        Function mapping filename to sample name. For instance, you may have the
        sample name in the path and use a regex to extract it.  The sample name
        will be used as the column name. If not provided, the column name will
        be the filename.

    Returns
    -------
    df : pandas.DataFrame
        DataFrame with info from log file.

def _read_log(fn, define_sample_name=None):
    """Read STAR Log.final.out file.

    Parameters
    ----------
    fn : string
        Path to Log.final.out file.

    define_sample_name : function that takes string as input
        Function mapping filename to sample name. For instance, you may have the
        sample name in the path and use a regex to extract it.  The sample name
        will be used as the column name. If not provided, the column name will
        be the filename.

    Returns
    -------
    df : pandas.DataFrame
        DataFrame with info from log file.

    """
    if define_sample_name == None:
        define_sample_name = lambda x: x
    df = pd.read_table(fn, '|', header=None).dropna()
    df.index = df.ix[:,0].apply(lambda x: x.strip())
    df = pd.DataFrame(df.ix[:,1].apply(lambda x: x.strip()))
    if define_sample_name:
        df.columns = [define_sample_name(fn)]
    else:
        df.columns = [fn]
    return df