Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see . #
# #
###############################################################################
import mpld3
from scipy.stats import pearsonr
import numpy as np
from refinem.plots.base_plot import BasePlot
from refinem.plots.mpld3_plugins import Tooltip
class CovCorrPlots(BasePlot):
"""Histogram and scatterplot showing coverage profile correlation of scaffolds."""
def __init__(self, options):
"""Initialize."""
BasePlot.__init__(self, options)
def _correlation(self, genome_scaffold_stats, mean_coverage):
"""Calculate percent deviant of coverage profiles for each scaffold."""
correlations = []
for stats in genome_scaffold_stats.values():
corr_r = 1.0
if len(mean_coverage) >= 1:
corr_r, _corr_p = pearsonr(mean_coverage, stats.coverage)
if np.isnan(corr_r):
# both coverage profiles contain identical values,
# along with this program. If not, see . #
# #
###############################################################################
import matplotlib
import mpld3
import numpy as np
from refinem.plots.base_plot import BasePlot
from refinem.plots.mpld3_plugins import LinkedBrush, Tooltip
from biolib.pca import PCA
class TetraPcaPlot(BasePlot):
"""Create a scatterplot of the first 2 tetranucleotide principal components."""
def __init__(self, options):
"""Initialize."""
BasePlot.__init__(self, options)
self.pca_computed = False
self.pc = None
self.variance = None
def data_pts(self, genome_scaffold_stats, pc_xaxis, pc_yaxis):
"""Get data points to plot.
Parameters
----------
genome_scaffold_stats : d[scaffold_id] -> namedtuple of scaffold stats
# along with this program. If not, see . #
# #
###############################################################################
import numpy as np
import mpld3
from biolib.common import find_nearest
from biolib.genomic_signature import GenomicSignature
from refinem.plots.base_plot import BasePlot
from refinem.plots.mpld3_plugins import Tooltip
class TdPlots(BasePlot):
"""Create histogram and scatterplot showing tetranucleotide distribution (TD) of scaffolds."""
def __init__(self, options):
"""Initialize."""
BasePlot.__init__(self, options)
def data_pts(self, genome_scaffold_stats, mean_signature):
"""Get data points to plot.
Parameters
----------
genome_scaffold_stats : d[scaffold_id] -> namedtuple of scaffold stats
Statistics for scaffolds in genome.
Returns
-------
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see . #
# #
###############################################################################
import mpld3
import numpy as np
from refinem.plots.base_plot import BasePlot
from refinem.plots.mpld3_plugins import Tooltip
class CovPercPlots(BasePlot):
"""Histogram and scatterplot showing mean percent difference of coverage profiles of scaffolds."""
def __init__(self, options):
"""Initialize."""
BasePlot.__init__(self, options)
def _mean_perc_diffs(self, genome_scaffold_stats, mean_coverage):
"""Calculate percent difference of coverage profiles for each scaffold."""
mean_perc_diffs = []
for stats in genome_scaffold_stats.values():
mean_perc_diff = []
for cov_genome, cov_scaffold in zip(mean_coverage, stats.coverage):
if cov_genome == 0:
mean_perc_diff.append(0)
elif len(mean_coverage) >= 2:
# along with this program. If not, see . #
# #
###############################################################################
import numpy as np
import matplotlib
import mpld3
from biolib.common import find_nearest
from refinem.plots.base_plot import BasePlot
from refinem.plots.mpld3_plugins import Tooltip
class GcPlots(BasePlot):
"""Create histogram and scatterplot showing GC distribution of scaffolds."""
def __init__(self, options):
"""Initialize."""
BasePlot.__init__(self, options)
def data_pts(self, genome_scaffold_stats, mean_gc):
"""Get data points to plot.
Parameters
----------
genome_scaffold_stats : d[scaffold_id] -> namedtuple of scaffold stats
Statistics for scaffolds in genome.
Returns
-------