parameters: (ax, d)
docstring: Plot the gc distribution vs k-mer coverage
          for a SINGLE SAMPLE, unlike the plot_<whatever> functions
          :params d: is single sample preqc data, and element of the data list
docstring_summary: Plot the gc distribution vs k-mer coverage
          for a SINGLE SAMPLE, unlike the plot_<whatever> functions
          :params d: is single sample preqc data, and element of the data list
docstring_tokens: Plot the gc distribution vs k - mer coverage for a SINGLE SAMPLE unlike the plot_<whatever > functions : params d : is single sample preqc data and element of the data list
function: def plotsample_gc_distribution(ax, d):
      """Plot the gc distribution vs k-mer coverage
          for a SINGLE SAMPLE, unlike the plot_<whatever> functions
          :params d: is single sample preqc data, and element of the data list
      """
      # @TCC make check for missing data
      # Plot the 2D histogram of coverage vs gc
      if GC_DISTRIBUTION_NAME in d:
          x = [ i * 100 for i in d[GC_DISTRIBUTION_NAME]['gc_samples'] ]
          y = d[GC_DISTRIBUTION_NAME]['cov_samples']
          # Use the median to determine the range to show and round
          # to nearest 100 to avoid aliasing artefacts
          m = np.median(y)
          y_limit = np.ceil( 2*m / 100.) * 100.
          hist,xedges,yedges = np.histogram2d(x,y, bins=[20, 50], range=[ [0, 100.0], [0, y_limit] ])
          # draw the plot
          extent = [xedges[0], xedges[-1], yedges[0], yedges[-1] ]
          im = ax.imshow(hist.T,extent=extent,interpolation='nearest',origin='lower', aspect='auto')
          # colormap, colorbar, labels, ect.
          im.set_cmap('gist_heat_r')
          divider = make_axes_locatable(ax)
          cax = divider.append_axes("right", "5%", pad="3%")
          ax.figure.colorbar(im, cax=cax)
          ax.set_title(d['name'] + ' GC Bias')
          ax.set_xlabel("GC %")
          ax.set_ylabel("k-mer coverage")
          return True
      else:
          # no data, draw an empty plot
          return _finish_plot(ax, [], 0, 'No GC data for %s' % d['name'])
function_tokens: def plotsample_gc_distribution ( ax , d ) : # @TCC make check for missing data # Plot the 2D histogram of coverage vs gc if GC_DISTRIBUTION_NAME in d : x = [ i * 100 for i in d [ GC_DISTRIBUTION_NAME ] [ 'gc_samples' ] ] y = d [ GC_DISTRIBUTION_NAME ] [ 'cov_samples' ] # Use the median to determine the range to show and round # to nearest 100 to avoid aliasing artefacts m = np . median ( y ) y_limit = np . ceil ( 2 * m / 100. ) * 100. hist , xedges , yedges = np . histogram2d ( x , y , bins = [ 20 , 50 ] , range = [ [ 0 , 100.0 ] , [ 0 , y_limit ] ] ) # draw the plot extent = [ xedges [ 0 ] , xedges [ - 1 ] , yedges [ 0 ] , yedges [ - 1 ] ] im = ax . imshow ( hist . T , extent = extent , interpolation = 'nearest' , origin = 'lower' , aspect = 'auto' ) # colormap, colorbar, labels, ect. im . set_cmap ( 'gist_heat_r' ) divider = make_axes_locatable ( ax ) cax = divider . append_axes ( "right" , "5%" , pad = "3%" ) ax . figure . colorbar ( im , cax = cax ) ax . set_title ( d [ 'name' ] + ' GC Bias' ) ax . set_xlabel ( "GC %" ) ax . set_ylabel ( "k-mer coverage" ) return True else : # no data, draw an empty plot return _finish_plot ( ax , [ ] , 0 , 'No GC data for %s' % d [ 'name' ] )