plot_heterogeneity {amplican} | R Documentation

## Plots heterogeneity of the reads using ggplot2.

### Description

This function creates stacked barplot explaining reads heterogeneity. It groups reads by user defined levels and measures how unique are reads in this level. Uniqueness of reads is simplified to the bins and colored according to the color gradient. Default color black indicates very high heterogeneity of the reads. The more yellow (default) the more similar are reads and less heterogeneous.

### Usage

    plot_heterogeneity(
      alignments,
      config,
      level = "ID",
      colors = c("#000000", "#F0E442"),
      bins = c(0, 5, seq(10, 100, 10))
    )

### Arguments

`alignments` | (data.frame) Loaded alignment information from alignments_events.csv file.
`config` | (data.frame) Loaded table from config_summary.csv file.
`level` | (string) Name of the column from config file specifying levels to group by.
`colors` | (html colors vector) Two colours for gradient, eg. c('#000000', '#F0E442').
`bins` | (numeric vector) Numeric vector from 0 to 100 specifying bins eg. c(0, 5, seq(10, 100, 10)).

### Value

(heterogeneity plot) ggplot2 object of heterogeneity plot

### See Also

Other specialized plots: `metaplot_deletions()`, `metaplot_insertions()`, `metaplot_mismatches()`, `plot_cuts()`, `plot_deletions()`, `plot_insertions()`, `plot_mismatches()`, `plot_variants()`

### Examples

    #example config
    config <- read.csv(system.file("extdata", "results", "config_summary.csv",
                                   package = "amplican"))
    #example alignments results
    alignments_file <- system.file("extdata", "results", "alignments",
                                   "events_filtered_shifted_normalized.csv",
                                   package = "amplican")
    alignments <- read.csv(alignments_file)
    plot_heterogeneity(alignments[alignments$consensus, ], config)

[Package amplican version 1.16.0 Index]