% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot_coverage.R
\name{plot_coverage}
\alias{plot_coverage}
\title{Plot coverage in nuclear and cytoplasmic RNA for candidate probe sequences.}
\usage{
plot_coverage(
  REGION,
  PDF = "regionCoverage_fractionedData.pdf",
  OUTDIR = tempdir(),
  COVERAGE = NULL,
  CODING_ONLY = FALSE,
  VERBOSE = TRUE
)
}
\arguments{
\item{REGION}{Either a single hg19 genomic sequence including the chromosome,
start, end, and optionally strand separated by colons (e.g.,
'chr20:10199446-10288068:+'), or a string of sequences. Must be character.
Chromosome must be proceeded by 'chr'.}

\item{PDF}{The name of the PDF file. Defaults to
\code{regionCoverage_fractionedData.pdf}.}

\item{OUTDIR}{The default directory where \code{PDF} will be saved to.}

\item{COVERAGE}{The output of \link{brainflowprobes_cov} for the input
\code{REGION}. Defaults to \code{NULL} but it can be pre-computed and saved
separately since this is the step that takes the longest to run. Also, this
is the only step that depends on rtracklayer's functionality for reading
BigWig files which does not run on Windows OS. So it could be run on a
non-Windows machine, saved, and then shared with Windows users.}

\item{CODING_ONLY}{A logical vector of length 1 specifying whether to
subset the Annotated Genes to only the coding genes. That is, whether to
subset the genes by whether they have a non-NA \code{CSS} value. The Annotated
Genes are downloaded with \code{\link[GenomicState:GenomicStateHub]{GenomicState::GenomicStateHub()}}.}

\item{VERBOSE}{A logical value indicating whether to print updates from the
process of loading the data from the BigWig files.}
}
\value{
\code{plot_coverage} plots all input sequences using
\code{\link[derfinderPlot:plotRegionCoverage]{derfinderPlot::plotRegionCoverage()}}. It returns a plot for each
input candidate sequence listed in REGION. Each plot includes coverage of
the sequence(s) in nuclear (N) and cytoplasmic (C) RNA isolated from adult
(A) and fetal (F) prefrontal cortex, sequenced using two different library
preparation methods. PolyA+ libraries (P) were generated using selection
for polyadenylated transcripts, and RiboZero (R) libraries were generated
using a ribosomal RNA depletion protocol.

Each plot also shows the overlapping genes beneath the coverage, and the
genomic location. The title lists the nearest gene, the position of the
sequence relative to the gene's canonical transcriptional start site (TSS),
and further annotation information as described in the 'region' column from
\code{\link[bumphunter:matchGenes]{bumphunter::matchGenes()}}.

\code{plot_coverage} saves the results as regionCoverage_fractionedData.pdf
in a temporary directory unless otherwise specified with \code{OUTDIR}.
}
\description{
\code{plot_coverage} plots the coverage of nuclear and cytoplasmic RNA from
adult and prenatal human prefrontal cortex across a candidate or series of
candidate probe sequences for BrainFlow. If the sequence spans splice
junctions, the plot will include the introns. A good candidate sequence will
be highly and evenly expressed in nuclear RNA.
}
\examples{

## Here we use the pre-saved example coverage data such that this example
## will run fast!
plot_coverage("chr20:10286777-10288069:+",
    COVERAGE = four_panels_example_cov
)

## Without using COVERAGE, this function reads BigWig files from the web
## using rtracklayer and this functionality is not supported on Windows
## machines.
if (.Platform$OS.type != "windows") {
    plot_coverage("chr20:10286777-10288069:+",
        PDF = "regionCoverage_fractionedData_fromScratch.pdf"
    )
}
\dontrun{

## These examples will take a few minutes to run!
plot_coverage(c(
    "chr20:10286777-10288069:+",
    "chr18:74690788-74692427:-",
    "chr19:49932861-49933829:-"
))

candidates <- c(
    "chr20:10286777-10288069:+",
    "chr18:74690788-74692427:-",
    "chr19:49932861-49933829:-"
)

## General syntax:
plot_coverage(candidates,
    PDF = "PDF_file.pdf",
    OUTDIR = "/path/to/directory/"
)

plot_coverage("chr20:10286777-10288069:+",
    PDF = "PDF_file.pdf", OUTDIR = "/path/to/directory/"
)

## Explore the effect of changing CODING_ONLY
## Check how gene name and distance to TSS changes in the title of the plot
## (everything else stays the same)
cov <- brainflowprobes_cov("chr10:135379301-135379311:+")
plot_coverage("chr10:135379301-135379311:+", COVERAGE = cov)
plot_coverage("chr10:135379301-135379311:+",
    COVERAGE = cov,
    PDF = "coding_only_plot_coverage", CODING_ONLY = TRUE
)
}

}
\author{
Amanda J Price
}
