Ejemplo n.º 1
0
def bigwig_to_bedgraph(bigwig_path, bedgraph_path):
    """
    Converts a bedgraph file to a bigwig file.

    :param bigwig_path: The path to the bedbig file to read.
    :type  bigwig_path: string
    :param bedgraph_path: The path to the bedgraph file to create.
    :type  bedgraph_path: string
    :returns: None
    """
    # Check the binary tool exists #
    check_executable('bigWigToBedGraph')
    # Run the tool #
    run_tool('bigWigToBedGraph', [bigwig_path, bedgraph_path])
Ejemplo n.º 2
0
def bedgraph_to_bigwig(bedgraph_path, chrmeta, bigwig_path):
    """
    Converts a bedgraph file to a bigwig file.

    :param bedgraph_path: The path to the bedgraph file to read.
    :type  bedgraph_path: string
    :param chrmeta: The chromosome metadata.
    :type  chrmeta: dict
    :param bigwig_path: The path to the bedbig file to create.
    :type  bigwig_path: string
    :returns: None
    """
    # Check the binary tool exists #
    check_executable('bedGraphToBigWig')
    # Make the chr file #
    chrfile_path = temporary_path('.chr')
    serialize_chr_file(chrmeta, chrfile_path)
    # Run the tool #
    run_tool('bedGraphToBigWig', [bedgraph_path, chrfile_path, bigwig_path])
    # Remove the chr file #
    os.remove(chrfile_path)