JACUSA2helper: A package for post-processing JACUSA2 result files.
Source:R/common.R
      JACUSA2helper.RdAuxiliary R package for the assessment of JACUSA1.x and JACUSA2.x results.
Description
A package that provides functions to post-process result files of JACUSA2.
The following methods from JACUSA2 are supported:
- call1,2
- calling variants from one condition or a comparison of conditions. 
- pileup
- SAMtools like pileup. 
- rt-arrest
- identification of transcription arrest events. 
- lrt-arrest
- combination of variant discovery and read arrest events. 
One major new feature of JACUSA2 is the identification of read arrest events. In this method, the vector of base call is partitioned into read arrest and read through bases.
When working with stranded RNA-Seq data, inverting base calls is not necessary because JACUSA2 will automatically invert Single End (SE) and Paired End (PE) depending on the provided library type option "-P" UNSTRANDED|FR_FIRSTSTRAND|RF_SECONDSTRAND".
The central data structure in JACUSA2helper is the JACUSA2 result object that follows the 
tidy data approach to feature easy interaction with dplyr and ggplot2.
A JACUSA2 result object can be created via result <- read_result("jacusa2.out") and is 
currently represented as a tibble. Special structured columns exist that 
hold condition andn replicate related data such as: coverage, bases. arrest rate.
Furthermore, JACUSA2helper supports the analysis of several related  JACUSA2 
result files via results <- read_results(files, meta_cond) where 
meta_cond is a vector of character strings that provides a descriptive 
name for each file in files.
Check vignette("JACUSA2helper", "JACUSA2helper") for a general 
introduction and "JACUSA2helper", "JACUSA2helper" for details about 
meta conditions.
read/write functions
See:
- read_result
- Reads and unpacks a JACUSA2 result file. 
- read_results
- Allows to combine multiple result files and distinguish them with meta conditions. 
- write_bedGraph
- Writes a vector of values as bedGraph file. 
Helper functions
See:
- arrest_rate
- Calculates arrest rate from base call counts (arest, through). 
- base_count
- Calculates the bumber of observed base calls. 
- base_sub
- Calculates base substitution. 
- base_ratio
- Calculates base call ratios. 
- non_ref_ratio
- Calculates non reference base ratio to JACUSA2 result object. 
- sub_ratio
- Calculates base substitution ratio for all bases to a JACUSA2 result object. 
filter functions
This function set enables filtering by read coverage or enforcing a minimal number of variant base calls per sample.
See:
- robust
- Retains sites that are robust in one feature. The feature can be observed in all replicates of at least one condition. 
- filter_artefact
- Remove sites that have been marked as an artefact. 
- All
- Helper function 
- Any
- Helper function 
- lapply_cond
- lapply wrapper - applies function to all conditions. 
- lapply_repl
- lapply wrapper - applies function to all replicates. 
- mapply_repl
- mapply wrapper - applies function to all replicates.