human
I am working on the file "CGATPipelines/pipeline_docs/pipeline_peakcalling/notebooks/template_peakcalling_filtering_Report_reads_per_chr.ipynb".
The first task is:
Contigs that have been filtered should clearly show up with 0 reads across the row
Can you write Python program for it?

What is a the Python program you requested?
assistant
#Here is the Python program you requested.

 def makeReadsPerChrPlot(df,path):
    '''takes table from database of chromosome lengths and makes individual plot for 
    each sample of how many reads map to each chromosome'''
    to_keep = []
    for item in df.columns:
        if 'chr' in item:
            to_keep.append(item)
    
    df = df[to_keep]
    df = df.divide(1000000)
    
    #where plot will be sent to
    file_path = "/".join([path,'mapped_reads_per_chromosome_plot.pdf'])
    print ('figure_saved_to %s' % file_path)
    
    ax = df.T.plot(figsize=(11,5),
                   xticks = range(len(to_keep)),
                  title = 'Million reads mapped to each chromosome',
                  ylim=(0,10))
    
    #set labels for plots
    ax.set_xlabel("Contig")
    ax.set_ylabel("million reads")
    fig = matplotlib.figure.Figure()
    ax.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
    matplotlib.pyplot.savefig(file_path, bbox_inches='tight')
    matplotlib.pyplot.show()
    
makeReadsPerChrPlot(reads_per_chr_df.T,output_path)

def makePercentReadsPerChrPlot(df,path):
    '''takes the idxstats_reads_per_chromosome table from database and calculates percentage
    of reads mapping to each chromosome and plots this for each chromosome and returns 
    percentage table'''
    c = df.copy()
    for item in c.columns:
        if 'chr' not in item and item != 'total_reads':
            c = c.drop(item,1)
            
    y = c.div(c.total_reads, axis ='index')*100
    y = y.drop('total_reads',1)
    file_path = "/".join([path,'percentage_mapped_reads_per_chromosome_plot.pdf'])
    
    print ('figure_saved_to %s' % file_path)
    ax = y.T.plot(figsize=(10,5),
                 xticks = range(len(y.columns)),
                 title = 'Percentage of total input reads that map to each contig',
                 ylim=(0,100))

    ax.set_xlabel("Contig")
    ax.set_ylabel("percentage_reads")
    ax.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
    fig = matplotlib.figure.Figure()
    matplotlib.pyplot.savefig(file_path,...