addSelfAlignments: Add PAF self-alignments to a SVbyEye miropeat style plot.

View source: R/addSelfAlignments.R

addSelfAlignmentsR Documentation

Add PAF self-alignments to a SVbyEye miropeat style plot.

Description

This function takes a ggplot2 object generated using plotMiro function and adds PAF self-alignments stored in the 'paf.table' to the plot.

Usage

addSelfAlignments(
  ggplot.obj = NULL,
  paf.table = NULL,
  color.by = "direction",
  color.palette = NULL,
  coordinate.space = "target",
  annotation.level = 0.05,
  annotation.label = NULL
)

Arguments

ggplot.obj

A ggplot2 object generated using plotMiro function.

paf.table

A data.frame or tibble containing a single or multiple PAF record(s) with 12 mandatory columns along with CIGAR string defined in 'cg' column.

color.by

Color alignments either by directionality ('direction'), fraction of matched base pairs ('identity'), or a custom column name present in submitted 'paf.table'.

color.palette

A discrete color palette defined as named character vector (elements = colors, names = discrete levels).

coordinate.space

A coordinate space ranges in 'annot.gr' are reported, either 'target', 'query' or 'self'.

annotation.level

A numeric that defines a fraction of y-axis to be the y-axis position for the annotation track (Default : '0.05').

annotation.label

A character string to be used as a label to added annotation track.

Value

A ggplot2 object.

Author(s)

David Porubsky

Examples

## Get PAF to process ##
paf.file <- system.file("extdata", "test1.paf", package = "SVbyEye")
## Read in PAF
paf.table <- readPaf(paf.file = paf.file, include.paf.tags = TRUE, restrict.paf.tags = "cg")
## Make a plot
plt <- plotMiro(paf.table = paf.table)
## Create custom PAF alignments
paf.annot <- tibble::tibble(
    q.name = "target.region",
    q.len = 0,
    q.start = c(19000000, 19200000),
    q.end = c(19100000, 19220000),
    strand = c("+", "-"),
    t.name = "target.region",
    t.len = 0,
    t.start = c(19200000, 19300000),
    t.end = c(19250000, 19330000),
    n.match = 0,
    aln.len = 0,
    mapq = 0
)
## Add self-alignments to the plot
addSelfAlignments(ggplot.obj = plt, paf.table = paf.annot, coordinate.space = "target")


daewoooo/SVbyEye documentation built on Oct. 15, 2024, 6:12 a.m.