Convert MuTect results (read into dataframe) to BedTool object

    Parameters
    ----------
    df : pandas.DataFrame
        Pandas DataFrame with MuTect results.

    Returns
    -------
    bt : pybedtools.BedTool
        BedTool with variants.

def mutect_to_bed(df):
    """Convert MuTect results (read into dataframe) to BedTool object

    Parameters
    ----------
    df : pandas.DataFrame
        Pandas DataFrame with MuTect results.

    Returns
    -------
    bt : pybedtools.BedTool
        BedTool with variants.

    """
    s = (df.contig.astype(str) + '\t' + 
         (df.position - 1).astype(int).astype(str) + '\t' + 
         df.position.astype(int).astype(str) + '\t' + 
         df.tumor_name)
    s = '\n'.join(s.values) + '\n'
    bt = pbt.BedTool(s, from_string=True)
    return bt