Skip to content
Snippets Groups Projects
hicstuff_fragments.py 1.56 KiB
#!/usr/bin/env python

import hicstuff_digest as hcd
import argparse

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("-e", "--enzyme")
    parser.add_argument("-i", "--index")
    parser.add_argument("-m", "--min_size")
    parser.add_argument("-c", "--circular")
    parser.add_argument("-o", "--output_contigs")
    parser.add_argument("-f", "--output_frags")
    parser.add_argument("-p", "--plot")
    parser.add_argument("-g", "--fig_path")
    args = parser.parse_args()

    enzyme = args.enzyme
    index = args.index
    min_size = args.min_size
    circular = args.circular
    if circular.lower() == "false":
        circular = False
    elif circular.lower() == "true":
        circular = True
    output_contigs = args.output_contigs
    output_frags = args.output_frags
    plot = args.plot
    if plot.lower() == "false":
        plot = False
    elif plot.lower() == "true":
        plot = True
    fig_path = args.fig_path


    #hicstuff case sensitive enzymes adaptation
    if enzyme == "hindiii":
        enzyme = "HindIII"
    elif enzyme == "dpnii":
        enzyme = "DpnII"
    elif enzyme == "bglii":
        enzyme = "BglII"
    elif enzyme == "mboi":
        enzyme = "MboI"
    elif enzyme == "arima":
        enzyme = "Arima"


    # Generate info_contigs and fragments_list output files
    hcd.write_frag_info(
        index,
        enzyme,
        min_size,
        circular,
        output_contigs,
        output_frags
    )

    # Log fragment size distribution
    hcd.frag_len(output_frags, plot=plot, fig_path=fig_path)