code: def macs_filtered_reads_plot(self):
          
          data = dict()
          req_cats = ['control_fragments_total', 'control_fragments_after_filtering', 'treatment_fragments_total', 'treatment_fragments_after_filtering']
          for s_name, d in self.macs_data.items():
              if all([c in d for c in req_cats]):
                  data['{}: Control'.format(s_name)] = dict()
                  data['{}: Treatment'.format(s_name)] = dict()
                  data['{}: Control'.format(s_name)]['fragments_filtered'] = d['control_fragments_total'] - d['control_fragments_after_filtering']
                  data['{}: Control'.format(s_name)]['fragments_not_filtered'] = d['control_fragments_after_filtering']
                  data['{}: Treatment'.format(s_name)]['fragments_filtered'] = d['treatment_fragments_total'] - d['treatment_fragments_after_filtering']
                  data['{}: Treatment'.format(s_name)]['fragments_not_filtered'] = d['treatment_fragments_after_filtering']
  
          # Check that we have something to plot
          if len(data) == 0:
              return
  
          # Specify the order of the different possible categories
          keys = OrderedDict()
          keys['fragments_not_filtered'] = { 'color': '#437BB1', 'name': 'Remaining fragments' }
          keys['fragments_filtered'] =     { 'color': '#B1084C', 'name': 'Filtered fragments' }
  
          # Config for the plot
          pconfig = {
              'id': 'macs2_filtered',
              'title': 'MACS2: Filtered Fragments',
              'ylab': '# Fragments',
              'cpswitch_counts_label': 'Number of Fragments',
              'hide_zero_cats': False
          }
  
          self.add_section(
              plot = bargraph.plot(data, keys, pconfig)
          )
docs: Plot of filtered reads for control and treatment samples