Plots all coverage profiles in the data for comparison. This is useful for identifying scaffold patterns across multiple coverage profiles and spot potential contaminants.

mmplot_cov_profiles(
  mm,
  normalise = FALSE,
  alpha = 0.6,
  color_by = NULL,
  color_vector = c("blue", "green", "red"),
  color_scale_log10 = FALSE,
  y_scale_log10 = FALSE,
  plot_lines = TRUE,
  interactive_plot = FALSE,
  mm_normalise = NULL,
  mm_normalise_index = NULL
)

Arguments

mm

(required) A dataframe loaded with mmload.

normalise

(Logical) Normalises each coverage column in mm to its highest value and multiplies by 100. (Default: TRUE)

alpha

The transparancy of the scaffold points and lines, where 0 is invisible and 1 is opaque. (Default: 0.6)

color_by

Color the scaffolds by a variable in mm. (Default: NULL)

color_vector

The colors from which to generate a color gradient when color_by is set and the variable is continuous. Any number of colors can be used. (Default: c("blue", "green", "red"))

color_scale_log10

(Logical) Log10-scale the color gradient when color_by is set and the variable is continuous. (Default: FALSE)

y_scale_log10

(Logical) Log10-scale the y axis. (Default: FALSE)

plot_lines

(Logical) Connect scaffolds with lines. (Default: TRUE)

interactive_plot

(Logical) Return an interactive plotly plot or not. (Default: FALSE)

mm_normalise

A dataframe loaded with mmload to normalise by.

mm_normalise_index

A coverage column to serve as an index for normalisation.

Value

A ggplot or plotly object. Note that mmgenome2 hides all warnings produced by ggplot objects.

Examples

library(mmgenome2) data(mmgenome2) mmgenome2
#> # A tibble: 97,285 x 13 #> scaffold length gc cov_C13.11.14 cov_C13.11.25 cov_C13.12.03 cov_C14.01.09 #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 1 8264 57.8 1.44 53.6 0 0.066 #> 2 2 1027 57.0 0.625 24.2 0 0 #> 3 3 1665 55.9 13.5 434. 0.166 0.177 #> 4 4 9056 35.9 0.01 23.4 0 0 #> 5 5 3343 64.0 3.20 16.4 0 0 #> 6 6 98207 39.1 0.00966 24.5 3.29 9.85 #> 7 7 6480 63.0 2.61 19.2 1.46 12.3 #> 8 8 15790 61.7 2.78 21.2 1.62 10.3 #> 9 9 1403 70.4 85.1 192. 0 0 #> 10 10 2018 70.2 50.3 101. 0 0 #> # … with 97,275 more rows, and 6 more variables: PC1 <dbl>, PC2 <dbl>, #> # PC3 <dbl>, geneID <chr>, taxonomy <fct>, rRNA16S <fct>
selection <- data.frame( cov_C13.11.25 = c(7.2, 16.2, 25.2, 23.3, 10.1), cov_C14.01.09 = c(47, 77, 52.8, 29.5, 22.1) ) mmgenome2_extraction <- mmextract(mmgenome2, min_length = 3000, selection = selection, inverse = FALSE )
#> 47 scaffolds (or 1.33% of the scaffolds in mm, weighted by length) remain after 97238 of 97285 scaffolds have been filtered.
mmplot_cov_profiles(mmgenome2_extraction, color_by = "taxonomy", normalise = FALSE )