mgkit.plots.unused module

New in version 0.1.14.

Code deprecated or untested

mgkit.plots.unused.barchart_categories(data, colours=None, title='', tickfont='small', xlabel_dict=None, barlabel_dict=None, width=0.9, rotation='vertical', file_name=None, fig_size=None, fig_aspect=None)
Parameters:
  • data – DataFrame where the number of rows indicates how many bars will plotted per column
  • colours – must be equal the number of data rows if supplied or it will be blue by default
  • title – chart title
  • tickfont – font size for ticks (only for column axis)
  • xlabel_dict – a mapping to the acual labels to use for the columns. Defaults to columns’ names
  • barlabel_dict – a mapping to the acual labels to use for the row. Defaults to rows’ names
  • width – bar width
Returns:

axis instance

mgkit.plots.unused.get_taxon_colors_new(taxa, taxonomy, default_colour='#ffff33')

Returns a dictionary of taxa and their assigned colours based on TAXON_COLOURS and the taxonomy provided. Uses the taxon.UniprotTaxonomy.get_taxon_root() to determine the root of a taxon.

Parameters:
  • taxa (iterable) – iterable of taxon ids
  • taxonomy (UniprotTaxonomy) – taxonomy instance
  • default_colour – colour used in case there’s no known root for the taxon
Return dict:

dictionary mapping taxon_id to colour

mgkit.plots.unused.lineplot_values_on_second_axis(*args, **kwargs)

Deprecated since version 0.1.13.

Adds a lineplot on a second axis using twinx

mgkit.plots.unused.map_taxon_to_colours(taxa, taxonomy, default_colour='#ffff33')

Returns a dictionary of taxa and their assigned colours based on TAXON_COLOURS and the taxonomy provided. Uses the taxon.UniprotTaxonomy.get_taxon_root() to determine the root of a taxon.

Parameters:
  • taxa (iterable) – iterable of taxon ids
  • taxonomy (UniprotTaxonomy) – taxonomy instance
  • default_colour – colour used in case there’s no known root for the taxon
Return dict:

dictionary mapping taxon_id to colour

mgkit.plots.unused.plot_contig_assignment_bar(series, taxon_colours=None, log_scale=False, index=None, file_name=None, fig_aspect=None, xlabels_size=8)

Plots barchart for contig assignment

Parameters:
  • seriespandas.Series instance with the data
  • taxon_colours (dict) – colour of the bars for each taxon
  • log_scale (bool) – if True the y axis is log scaled
  • fig_aspect (tuple) – tuple with figure size
  • xlabels_size (int) – size of the taxon labels
  • index – optional pandas.Index used to reindex the series
  • file_name (str) – name of the file to write the graph to
mgkit.plots.unused.plot_scatter_2d(data, labels, colours=None, pointsize=10.0, title='', xlabel='', ylabel='', centers=None, marker='*', marker_colour=None, markersize=None, hull_points=True, linewidth=0.2, legend=True, anno_center=True)

Scatter plot in 2d. Used for cluster results

Parameters:
  • data (array) – numpy.array with shape n, 2
  • labels (array) – labels to categorise samples
  • colours (dict) – dictionary whose keys are the labels and the values are valid matplotlib colours
  • pointsize (int) – point size
  • title (str) – plot title
  • xlabel (str) – label for x axis
  • ylabel (str) – label for y axis
Returns:

axis instance

mgkit.plots.unused.plot_scatter_3d(data, labels, colours=None, pointsize=10.0, title='', xlabel='', ylabel='', zlabel='')

Scatter plot in 3d. Used for cluster results

Parameters:
  • data (array) – numpy.array with shape n, 3
  • labels (array) – labels to categorise samples
  • colours (dict) – dictionary whose keys are the labels and the values are valid matplotlib colours
  • pointsize (int) – point size
  • title (str) – plot title
  • xlabel (str) – label for x axis
  • ylabel (str) – label for y axis
  • zlabel (str) – label for z axis
Returns:

axis instance

mgkit.plots.unused.scatter_gene_values(gene_dict, xlabel='Profile pN/pS', ylabel='Rumen pN/pS', title='', colours=None, file_name=None, plot_order=None, line_colour='r', max_limit=None, axes=None)

Plots gene-taxon pN/pS from profiles against their observed values.

Parameters:
  • gene_dict (dict) – dictionary that contains the data
  • xlabel (str) – label for x axis
  • ylabel (str) – label for y axis
  • title (str) – graph title
  • colours – colours used in for the different datasets; defaults to TAXON_COLOURS
  • file_name (str) – path to which the graph is to be saved (by default) it doesn’t write to disk
  • plot_order (iterable) – the order used in plotting the data points; default to the order of the gene_dict dictionary keys
  • coloUr – valid colour for the lines in the plot
  • max_limit (float) – used to put a limit on the plot
  • axes – optional axes used to draw the scatter plot
Returns:

the axis object used for the plot