softclip_composition: Composition of Soft-clipped Bases

View source: R/softclip_analysis.R

softclip_compositionR Documentation

Composition of Soft-clipped Bases

Description

Stacked barplot of base composition of soft-clipped bases adjacent to TSSs.

Usage

softclip_composition(
  experiment,
  samples = "all",
  n_bases = NULL,
  ncol = 3,
  return_table = FALSE,
  ...
)

Arguments

experiment

TSRexploreR object.

samples

A vector of sample names to analyze.

n_bases

Number of bases from -1 position to keep.

ncol

Integer specifying the number of columns to arrange multiple plots.

return_table

Return a table of results instead of a plot.

...

Arguments passed to geom_col.

Details

Cap-trapping and TSRT-based 5' mapping methods have shown a preponderance of softclipped Gs immediately upstream of TSSs. The source of this extra G is hypothesized to be reverse transcription of the 5' cap to a C in the first-strand cDNA. In addition to this extra base, TSRT has been shown to add up to 3-4 additional bases.

This function generates a stacked barplot for each position upstream of the TSS that gives the relative base composition of each soft-clipped position, if present. 'n_bases' determines how far upstream of the TSS is checked for sofclipped bases.

If 'return_table' is TRUE, a data.frame is returned with the underlying numbers used in the plot.

Value

A ggplot2 stacked barplot of softclip base composition. If 'return_table' is TRUE a data.frame is returned instead.

See Also

import_bams to import BAMs. G_correction to correct for incidentally templated spurious 5' Gs.

Examples

bam_file <- system.file("extdata", "S288C.bam", package="TSRexploreR")
assembly <- system.file("extdata", "S288C_Assembly.fasta", package="TSRexploreR")
samples <- data.frame(sample_name="S288C", file_1=bam_file, file_2=NA)

exp <- tsr_explorer(sample_sheet=samples, genome_assembly=assembly) %>%
  import_bams(paired=TRUE)
  
p <- softclip_composition(exp)


zentnerlab/TSRexploreR documentation built on Dec. 30, 2022, 10:27 p.m.