fitJunctionSeqDispersionFunction {JunctionSeq}R Documentation

Fit Shared Dispersion Function

Description

Fit dispersion function to share dispersion information between features across the genome.

This function is called internally by the runJunctionSeqAnalyses function, and thus for most purposes users should not need to call this function directly. It may be useful to advanced users performing non-standard analyses.

Usage

fitJunctionSeqDispersionFunction(jscs, 
    method.GLM = c(c("advanced","DESeq2-style"), 
                 c("simpleML","DEXSeq-v1.8.0-style")),
    method.dispFit = c("parametric", "local", "mean"), 
    method.dispFinal = c("shrink","max","fitted","noShare"),
    fitDispersionsForExonsAndJunctionsSeparately = TRUE, 
    verbose = TRUE)

Arguments

jscs

A JunctionSeqCountSet. Usually initially created by readJunctionSeqCounts. Size factors must be set, usually using functions estimateSizeFactors and estimateJunctionSeqDispersions.

method.GLM

Character string. Can be used to apply alternative methodologies or implementations. Intended for advanced users who have strong opinions about the underlying statistical methodologies.

The default is "advanced" or, equivalently, "DESeq2-style". This uses the dispersion estimation methodology used by DESeq2 and DEXSeq v1.12.0 or higher to generate the initial (feature-specific) dispersion estimates. The alternative method is "simpleML" or, equivalently, "DEXSeq-v1.8.0-style". This uses a simpler maximum-likelihood-based method used by the original DESeq and by DEXSeq v1.8.0 or less.

method.dispFit

Character string. Can be used to apply alternative methodologies or implementations. Intended for advanced users who have strong opinions about the underlying statistical methodologies.

Determines the method used to generated "fitted" dispersion estimates. One of "parametric" (the default), "local", or "mean". See the DESeq2 documentation for more information.

method.dispFinal

Character string. Can be used to apply alternative methodologies or implementations. Intended for advanced users who have strong opinions about the underlying statistical methodologies.

Determines the method used to arrive at a "final" dispersion estimate. The default, "shrink" uses the maximum a posteriori estimate, combining information from both the fitted and feature-specific dispersion estimates. This is the method used by DESeq2 and DEXSeq v1.12.0 and above.

fitDispersionsForExonsAndJunctionsSeparately

When running a "junctionsAndExons" type analysis in which both exons and splice junctions are being tested simultaniously, this parameter determines whether a single fitted dispersion model should be fitted for both exons and splice junctions, or if separate fitted dispersions should be calculated for each. By default the dispersions are run separately.

verbose

if TRUE, send debugging and progress messages to the console / stdout.

...

If using the depreciated fitDispersionFunction command, use the same syntax as above.

Value

A JunctionSeqCountSet, with dispersion results included.

Examples

data(exampleDataSet,package="JctSeqData");
jscs <- fitJunctionSeqDispersionFunction(jscs);
## > fitDispersionFunction() Starting (Thu Mar 30 17:21:20 2017)
## >   (fitType = parametric)
## >   (finalDispersionMethod = shrink)
## >   (fitDispersionsForExonsAndJunctionsSeparately = TRUE)
## min(means[useForFit], na.rm=T)=0.146009972023612
## >    fdf: Fitting dispersions:
## >       (Iteration 1) Parametric Dispersion Coefs: [0.00472009572814427,0.218460947334769]
## >       (Iteration 2) Parametric Dispersion Coefs: [0.00256247314248661,0.234164421253589]
## >       (FINAL) Parametric Dispersion Coefs: [0.00256236453981216,0.234167798819113]
## >    fdf: Fitting dispersions of exons and junctions to separate fitted trends.
## >    fdf: Fitting exon dispersions:
## >       (Iteration 1) Parametric Dispersion Coefs: [0.00471170193076281,0.279913188264851]
## >       (Iteration 2) Parametric Dispersion Coefs: [0.00195226100860601,0.298767665275019]
## >       (Iteration 3) Parametric Dispersion Coefs: [0.00187840115925201,0.287865989524349]
## >       (FINAL) Parametric Dispersion Coefs: [0.00187811534730775,0.287879543718636]
## >    fdf: Fitting splice-junction dispersions:
## >       (Iteration 1) Parametric Dispersion Coefs: [0.00389781116922728,0.181506534119097]
## >       (Iteration 2) Parametric Dispersion Coefs: [0.00376412469359818,0.182903659298507]
## >       (FINAL) Parametric Dispersion Coefs: [0.0037642302236494,0.182901650968558]
## > fdf(): 'Shrinking' fitted and feature-specific dispersion estimates.
## > fdf() Dispersion estimate failed for 0 out of 482 features.
## > fitDispersionFunction() Done. (Thu Mar 30 17:21:21 2017)
## Not run: 
##D #Full example (from scratch):
##D ########################################
##D #Set up example data:
##D decoder.file <- system.file(
##D                   "extdata/annoFiles/decoder.bySample.txt",
##D                   package="JctSeqData");
##D decoder <- read.table(decoder.file,
##D                   header=TRUE,
##D                   stringsAsFactors=FALSE);
##D gff.file <- system.file(
##D             "extdata/cts/withNovel.forJunctionSeq.gff.gz",
##D             package="JctSeqData");
##D countFiles <- system.file(paste0("extdata/cts/",
##D      decoder$sample.ID,
##D      "/QC.spliceJunctionAndExonCounts.withNovel.forJunctionSeq.txt.gz"),
##D      package="JctSeqData");
##D ########################################
##D #Advanced Analysis:
##D 
##D #Make a "design" dataframe:
##D design <- data.frame(condition = factor(decoder$group.ID));
##D #Read the QoRTs counts.
##D jscs = readJunctionSeqCounts(countfiles = countFiles,
##D            samplenames = decoder$sample.ID,
##D            design = design,
##D            flat.gff.file = gff.file
##D );
##D #Generate the size factors and load them into the JunctionSeqCountSet:
##D jscs <- estimateJunctionSeqSizeFactors(jscs);
##D #Estimate feature-specific dispersions:
##D jscs <- estimateJunctionSeqDispersions(jscs);
##D #Fit dispersion function and estimate MAP dispersion:
##D jscs <- fitJunctionSeqDispersionFunction(jscs);
##D #Test for differential usage:
##D jscs <- testForDiffUsage(jscs);
##D #Estimate effect sizes and expression estimates:
##D jscs <- estimateEffectSizes( jscs);
##D 
## End(Not run)

[Package JunctionSeq version 1.5.4 Index]