Prepare sashimi plot required data, deriving data objects as needed
Usage
sashimiDataConstants(
gtf = NULL,
txdb = NULL,
tx2geneDF = NULL,
exonsByTx = NULL,
cdsByTx = NULL,
detectedTx = NULL,
detectedGenes = NULL,
flatExonsByGene = NULL,
flatExonsByTx = NULL,
filesDF = NULL,
color_sub = NULL,
envir = NULL,
empty_uses_farrisdata = TRUE,
use_memoise = TRUE,
verbose = FALSE,
...
)Arguments
- gtf, txdb, tx2geneDF, exonsByTx, cdsByTx
objects used to define the overall set of genes, transcripts, and associated exons and CDS exons. See this function description for more detail. Notes:
gtfcan be a local file, in which case it will be loaded from its current path without copying to the current directory, as long asfile.exists(gtf)isTRUE, which also means it would not have the prefix"file://". However, when it has the prefix"file://"it will usecurl::curl_download()which will copy it to the current directory. In either case, when other files are derived, such astx2geneortxdb, those files are stored in the current directory.tx2geneDFis adata.framewith at minimum two columns:gene_nameandtranscript_id. It is possible to customize these column names, however it is easiest to use these defaults.exonsByTxandcdsByTxareGRangesListobjects, and they are used to deriveflatExonsByTxandflatExonsByGenewhen those objects are not already provided. Also,exonsByTxandcdsByTxare derived usinggtfortxdbwhen necessary to deriveflatExonsByTxandflatExonsByGene.
- detectedTx, detectedGenes, flatExonsByGene, flatExonsByTx
objects used to derive a specific subset of gene-exon models using only detected transcripts or genes. See this function description for more detail.
detectedTxanddetectedGenesarecharactervectors.flatExonsByTxandflatExonsByGeneareGRangesList, where eachGRangeselement contains disjoint (non-overlapping) ranges. When not provided, they are derived fromexonsByTxandcdsByTx, which also requirestx2geneDFand eithergtfortxdb.
- filesDF
data.frame, default NULL. This argument is optional, and when supplied it will be included in the output environment. Thedata.framemust contain colnames:'sample_id':
charactername of the sample or sample group, where multiple files for the same sample or sample group all use the samecharacterstring.'url':
characterwith URL or URI link to file or web resource relevant to each data type.'type':
characterwith type of data, recognizing:'bw': bigwig coverage file
'junction': BED or bigBed file, ideally formatted as BED12 format. Scores higher than 1000 in bigBed are recognized in the 'name' column when the 'name' is entirely numeric value.
'coverage_gr':
charactername of coverage values supplied in an objectcovGRwhosevalues()contain columns ofNumericListcoverages.
- color_sub
charactervector of colors, whose names match 'sample_id' infilesDFwhen supplied. This argument is optional.- envir
environmentwhere data will be prepared, or whenenvir=NULLa new environment will be created and returned.- empty_uses_farrisdata
logicaldefault TRUE, whether to use data from the Github R package'jmw86069/farrisdata'if no data is supplied to this function. This behavior is intended to make it easy to use farrisdata to recreate the Sashimi plots in that publication. Note: When the 'farrisdata' R package is not installed, this argument is automatically set to FALSE.- use_memoise
logicaldefault TRUE, whether to usememoiseto cache intermediate data files for exons, flattened exons, transcript-gene data, and so on. This mechanism reduces time to render sashimi plots that re-use the same gene. All memoise cache folders are named with"_memoise".- verbose
logicalindicating whether to print verbose output.- ...
additional arguments are ignored.
- default_gene
characterstring indicating the default gene to use for the initial R-shiny figure.
Value
environment that contains the required data objects
for splicejam sashimi plots. Note that the environment itself
is updated during processing, so the environment does not
need to be returned for the data contained inside it to
be updated by this function.
filesDF (if provided)
flatExonsByGene, flatExonsByTx
gtf (if relevant)
detectedGenes, detectedTx
tx2geneDF
default_gene (if relevant)
color_sub (if provided)
cdsByTx, exonsByTx
txdb (if relevant)
Details
This function performs a subset of steps performed by
sashimiAppConstants(), focusing only on data required
for gene-exon structure.
The sashimiAppConstants() defines other Shiny-specific sections,
specifically the 'aboutExtra' and other guides text.
Data derived by this function sashimiDataConstants():
txdb:
TranscriptDbobject used to deriveexonsByTxandcdsByTxif either object does not already exist. Iftxdbis not supplied, it is derived fromgtfusingtxdbmaker::makeTxDbFromGFF().tx2geneDF:
data.framewith colnames:"transcript_id"and"gene_name".gtf:
characterpath to a GTF/GFF/GFF3 file, suitable fortxdbmaker::makeTxDbFromGFF(). Thegtfis only used iftx2geneDForexonsByTxare not supplied. Note that whengtfpoints to a remote server, the file is copied to the current working directory for more rapid use. If the file already exists in the local directory, it is re-used.exonsByTx:
GRangesListobject, named by"transcript_id", containing all exons for each transcript. It is derived fromtxdbif not supplied; and names should matchtx2geneDF$transcript_id.cdsByTx:
GRangesListobject, named by"transcript_id", containing only CDS (protein-coding) exons for each transcript. It is derived fromtxdbif not supplied; and names should matchtx2geneDF$transcript_id.detectedTx:
charactervector oftx2geneDF$transcript_idvalues, representing a subset of transcripts detected above background. SeedefinedDetectedTx()for one strategy to define detected transcripts. IfdetectedTxdoes not exist, it is defined by all transcripts present intx2geneDF$transcript_id. Note this step can be the rate-limiting step in the preparation offlatExonsByTx.detectedGenes:
charactervector of values that matchtx2geneDF$gene_name. If it is not supplied, it is inferred fromdetectedTxandtx2geneDF$transcript_id.flatExonsByGene:
GRangesListobject containing non-overlapping exons for each gene, whose names matchtx2geneDF$gene_name. If not supplied, it is derived usingflattenExonsBy()and objectsexonsByTx,cdsByTx,detectedTx, andtx2geneDF. This step is the key step for using a subset of detected transcripts, in order to produce a clean gene-exon model.flatExonsByTx:
GRangesListobject containing non-overlapping exons for each transcript. If not supplied, it is derived usingflattenExonsBy()and objectsexonsByTx,cdsByTx,detectedTx, andtx2geneDF. This step is the key step for using a subset of detected transcripts, in order to produce a clean transcript-exon model.filesDF:
data.framewith recognized columns:'sample_id':
charactername of the sample or sample group, where multiple files for the same sample or sample group all use the samecharacterstring.'url':
characterwith URL or URI link to file or web resource relevant to each data type.'type':
characterwith type of data, recognizing:'bw': bigwig coverage file
'junction': BED or bigBed file, ideally formatted as BED12 format. Scores higher than 1000 in bigBed are recognized in the 'name' column when the 'name' is entirely numeric value.
'coverage_gr':
charactername of coverage values supplied in an objectcovGRwhosevalues()contain columns ofNumericListcoverages.
'scale_factor': optional
numericcolumn used as a scalar and is multiplied by thenumericvalues associated with each file. For example, it can be very useful to apply normalization for raw coverage values, or raw junction counts.
When use_memoise=TRUE several R objects are cached using
memoise::memoise(), to help re-use of prepared R objects,
and to help speed the re-use of data within the R-shiny app:
See also
Other Splicejam core functions:
launchSashimiApp(),
splicejamDataFromTxDb(),
splicejamFigure()