How to use the biolib.plots.abstract_plot.AbstractPlot function in biolib

To help you get started, we’ve selected a few biolib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dparks1134 / RefineM / refinem / plots / combined_plots.py View on Github external
def save_html(self, output_html):
        """Save figure as HTML.

        Parameters
        ----------
        output_html : str
            Name of output file.
        """

        html_script = Tooltip.script_global
        html_body = Tooltip.html_body

        AbstractPlot.save_html(self, output_html, html_script, html_body)
github dparks1134 / RefineM / refinem / plots / distribution_plots.py View on Github external
#    along with this program. If not, see .     #
#                                                                             #
###############################################################################

from refinem.plots.gc_plots import GcPlots
from refinem.plots.td_plots import TdPlots
from refinem.plots.cov_perc_plots import CovPercPlots
from refinem.plots.mpld3_plugins import LinkedBrush, Tooltip

import matplotlib
import mpld3

from biolib.plots.abstract_plot import AbstractPlot


class DistributionPlots(AbstractPlot):
    def __init__(self, options):
        """Initialize plot."""
        AbstractPlot.__init__(self, options)

    def plot(self, genome_scaffold_stats,
             highlight_scaffold_ids, link_scaffold_ids,
             genome_stats,
             gc_dist, td_dist,
             gc_perc, td_perc, cov_perc):
        """Create figure with the GC, tetranucleotide signature, and coverage distributions.

        Parameters
        ----------
        genome_scaffold_stats : d[scaffold_id] -> namedtuple of scaffold stats
          Statistics for scaffolds in genome.
        highlight_scaffold_ids : d[scaffold_id] -> color
github dparks1134 / CompareM / comparem / plots / heatmap.py View on Github external
zeros as np_zeros)

import scipy.cluster.hierarchy as cluster
import scipy.spatial.distance as dist

import matplotlib.pyplot as pylab
from matplotlib.colors import ListedColormap

from biolib.plots.abstract_plot import AbstractPlot
from biolib.common import alphanumeric_sort

# import mpld3
# from comparem.plots.mpld3_plugins import Tooltip


class Heatmap(AbstractPlot):
    def __init__(self, infile, outfile):
        AbstractPlot.__init__(self, None)
        
        self.outfile = outfile
        self.genomes = None
        self._parse_data(infile)
        
        self.colormap = pylab.cm.bwr

        self.discreteColourMap = ListedColormap([(141/255.0, 211/255.0, 199/255.0),(255/255.0, 255/255.0, 179/255.0),
                                                    (190/255.0, 186/255.0, 218/255.0),(251/255.0, 128/255.0, 114/255.0),
                                                    (128/255.0, 177/255.0, 211/255.0),(253/255.0, 180/255.0, 98/255.0),
                                                    (179/255.0, 222/255.0, 105/255.0),(252/255.0, 205/255.0, 229/255.0),
                                                    (217/255.0, 217/255.0, 217/255.0), (188/255.0, 128/255.0, 189/255.0),
                                                    (204/255.0, 235/255.0, 197/255.0),(255/255.0, 237/255.0, 111/255.0)])
github dparks1134 / RefineM / refinem / plots / base_plot.py View on Github external
#                                                                             #
###############################################################################

import matplotlib
import mpld3

from matplotlib.collections import LineCollection

from biolib.plots.abstract_plot import AbstractPlot

from refinem.plots.mpld3_plugins import Tooltip

from numpy import (mean as np_mean)


class BasePlot(AbstractPlot):
    """Base plotting function used by many plots."""

    def __init__(self, options):
        """Initialize."""
        AbstractPlot.__init__(self, options)

    def point_properties(self, scaffold_stats, highlight_scaffold_ids, link_scaffold_ids):
        """Get visual properties for each point to be plotted.

        This includes organizing points such that those to be
        highlighted or linked are rendered last. This helps ensure
        this points will be visible.

        Parameters
        ----------
        scaffold_stats : d[scaffold_id] = [x, y]
github dparks1134 / RefineM / refinem / plots / combined_plots.py View on Github external
import mpld3

from biolib.plots.abstract_plot import AbstractPlot

from refinem.plots.scatter import Scatter
from refinem.plots.gc_plots import GcPlots
from refinem.plots.td_plots import TdPlots
from refinem.plots.cov_perc_plots import CovPercPlots
from refinem.plots.gc_cov_plot import GcCovPlot
from refinem.plots.tetra_pca_plot import TetraPcaPlot
from refinem.plots.mpld3_plugins import LinkedBrush, Tooltip

from numpy import (mean as np_mean, abs as np_abs)


class CombinedPlots(AbstractPlot):
    def __init__(self, options):
        """Initialize."""
        AbstractPlot.__init__(self, options)

    def plot(self, genome_scaffold_stats,
             highlight_scaffold_ids, link_scaffold_ids,
             genome_stats,
             gc_dist, td_dist,
             gc_perc, td_perc, cov_perc):
        """Create figure containing distribution plots, tetranucleotide PCA plots, and GC vs. coverage plot.

        Parameters
        ----------
        genome_scaffold_stats : d[scaffold_id] -> namedtuple of scaffold stats
          Statistics for scaffolds in genome.
        highlight_scaffold_ids : d[scaffold_id] -> color