Пример #1
0
def func_detailed_viz(infile_rank_tree,
                      infile_average,
                      infile_filtered,
                      detailed_pdf,
                      tempdir,
                      docker_image=None):
    infile_filtered = os.path.abspath(infile_filtered)
    infile_average = os.path.abspath(infile_average)
    infile_rank_tree = os.path.abspath(infile_rank_tree)

    cmd = (
        'xvfb-run',
        'corrupt-viz-growth',
        '--experimentConfigs.saveStandardStreams',
        'false',
        '--experimentConfigs.recordGitInfo',
        'false',
        '--experimentConfigs.managedExecutionFolder',
        'false',
        '--phylogenies',
        infile_rank_tree,
        '--matrices',
        infile_average,
        infile_filtered,
        '--size',
        'width',
        '300',
    )

    run_in_dir(cmd, [], [], tempdir, docker_image=docker_image)

    pdffiles = glob.glob('{}/*.pdf'.format(tempdir))

    pdfutils.merge_pdfs(pdffiles, detailed_pdf)
Пример #2
0
def plot_kernel_density(infile, output, tempdir, sep, colname, plot_title,
                        multipliers):

    helpers.makedirs(tempdir)

    multiplier_pdfs = []

    for multiplier in multipliers:

        multiplier_output = os.path.join(tempdir, "{}.pdf".format(multiplier))

        multiplier_pdfs.append(multiplier_output)

        mult_plot_title = '{}({})'.format(plot_title, multiplier)

        tablename = '/hmmcopy/metrics/{}'.format(multiplier)

        plot = PlotKernelDensity(infile,
                                 multiplier_output,
                                 sep,
                                 colname,
                                 mult_plot_title,
                                 tablename=tablename)
        plot.main()

    pdfutils.merge_pdfs(multiplier_pdfs, output)
Пример #3
0
def plot_pcolor(infile,
                metrics,
                output,
                tempdir,
                multipliers,
                plot_title=None,
                column_name=None,
                plot_by_col=None,
                chromosomes=None,
                max_cn=None,
                scale_by_cells=None,
                color_by_col=None,
                cell_filters=None,
                mappability_threshold=None):

    helpers.makedirs(tempdir)

    multiplier_pdfs = []

    for multiplier in multipliers:

        cells = get_good_cells(metrics, cell_filters, '/hmmcopy/metrics/0')

        multiplier_output = os.path.join(tempdir, "{}.pdf".format(multiplier))

        multiplier_pdfs.append(multiplier_output)

        mult_plot_title = '{}({})'.format(plot_title, multiplier)

        reads_tablename = '/hmmcopy/reads/{}'.format(multiplier)
        metrics_tablename = '/hmmcopy/metrics/{}'.format(multiplier)

        plot = PlotPcolor(infile,
                          metrics,
                          multiplier_output,
                          plot_title=mult_plot_title,
                          column_name=column_name,
                          plot_by_col=plot_by_col,
                          chromosomes=chromosomes,
                          max_cn=max_cn,
                          multiplier=multiplier,
                          scale_by_cells=scale_by_cells,
                          segs_tablename=reads_tablename,
                          metrics_tablename=metrics_tablename,
                          color_by_col=color_by_col,
                          cells=cells,
                          mappability_threshold=mappability_threshold)
        plot.main()

    pdfutils.merge_pdfs(multiplier_pdfs, output)
Пример #4
0
def plot_metrics(metrics, output, tempdir, plot_title, multipliers):

    helpers.makedirs(tempdir)

    multiplier_pdfs = []

    for multiplier in multipliers:

        multiplier_output = os.path.join(tempdir, "{}.pdf".format(multiplier))

        multiplier_pdfs.append(multiplier_output)

        mult_plot_title = '{}({})'.format(plot_title, multiplier)

        tablename = '/hmmcopy/metrics/{}'.format(multiplier)

        plot = PlotMetrics(metrics,
                           multiplier_output,
                           mult_plot_title,
                           tablename=tablename)
        plot.plot_hmmcopy_metrics()

    pdfutils.merge_pdfs(multiplier_pdfs, output)
Пример #5
0
def merge_pdf(in_filenames, out_filename):
    for in_files, out_file in zip(in_filenames, out_filename):
        pdfutils.merge_pdfs(in_files, out_file)