Description Usage Arguments Value Author(s) See Also Examples
View source: R/srcImpulseDE2_fitSigmoid.R
[Model fitting function hierarchy: 1 out of 3] This primary fitting wrapper performs parralelisation of model fitting across genes.
1 | fitSigmoidModels(objectImpulseDE2, vecConfounders, strCondition)
|
objectImpulseDE2 |
(object class ImpulseDE2Object) Object to be fit with sigmoidal model. Needs to be fitted with impulse model before. |
vecConfounders |
(vector of strings number of confounding variables) Factors to correct for during batch correction. Names refer to columns in dfAnnotation. |
strCondition |
(str) Name of condition entry in lsModelFits for which sigmoidal models are to be fit to each gene. |
objectImpulseDE2 (object class ImpulseDE2Object) Object with sigmoidal fit added: objectImpulseDE2@lsModelFits is updated to: lsModelFits (list length number of conditions fit (1 or 3) +1) {'case'} or {'case', 'control', 'combined'} This is the lsModelFits object handed to this function with additional sigmoid fit entries for every gene for the given condition. One model fitting object for each condition: In case-only DE analysis, only the condition {'case'} is fit. In case-control DE analysis, the conditions {'case', 'control','combined} are fit. Each condition entry is a list of model fits for each gene. Each gene entry is a list of model fits to the individual models: Impulse model, constant model and sigmoidal fit. Each model fit per gene is a list of fitting parameters and results.
IdxGroups (list length number of conditions) Samples grouped by time points and by batches and time point vectors. Sample groups are stored in the form of index vectors in which samples of the same time point or batch have the same index.
Condition ID (list length 5) List of index vectors and time points. One entry of this format for each condition.
vecTimepointsUnique (numeric vector length number of unique timepoints) Vector of unique time coordinates observed in this condition.
vecidxTimepoint (idx vector length number of samples) Index of the time coordinates of each sample (reference is vecTimepointsUnique).
lsvecBatchUnique (list number of confounders) List of string vectors. One vector per confounder: vector of unique batches in this confounder.
lsvecidxBatches (idx list length number of confounding variables) List of index vectors. One vector per confounding variable. Each vector has one entry per sample with the index of the batch ID within the given confounding variable of the given sample. Reference is the list of unique batch ids for each confounding variable.
vecSamples (vector number of samples) Names of samples fit for this condition in same order as index vectors above.
Condition ID (list length number of genes) List of fits for each gene to the samples of this condition. One entry of this format for all conditions fit.
Gene ID (list length 2) Impulse, constant and sigmoidal model fit to gene observations. One entry of this format for all gene IDs.
lsImpulseFit (list) List of impulse fit parameters and results. For details, read the annotation of fitModels.
lsConstFit (list) List of constant fit parameters and results. For details, read the annotation of fitModels.
ls SigmoidFit (list) List of sigmoidal fit parameters and results.
vecSigmoidParam (numeric vector length 4) {beta, h0, h1, t} Maximum likelihood estimators of sigmoidal model parameters.
vecSigmoidValue (numeric vector length number of time points) Values of sigmoid model fit at time points used for fit.
lsvecBatchFactors (list length number of confounders) List of vectors of scalar batch correction factors for each sample. These are also maximum likelihood estimators. NULL if no confounders given.
scaDispParam (scalar) Dispersion parameter estimate used in fitting (hyper-parameter).
scaLL (scalar) Loglikelihood of data under maximum likelihood estimator model.
scaConvergence (scalar) Convergence status of optim on sigmoidal model.
David Sebastian Fischer
Calls fitSigmoidGene to perform fitting on each gene.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | lsSimulatedData <- simulateDataSetImpulseDE2(
vecTimePointsA = rep(seq(1,8),3),
vecTimePointsB = NULL,
vecBatchesA = NULL,
vecBatchesB = NULL,
scaNConst = 0,
scaNImp = 20,
scaNLin = 10,
scaNSig = 20)
objectImpulseDE2 <- runImpulseDE2(
matCountData = lsSimulatedData$matObservedCounts,
dfAnnotation = lsSimulatedData$dfAnnotation,
boolCaseCtrl = FALSE,
vecConfounders = NULL,
boolIdentifyTransients = FALSE,
scaNProc = 1 )
# You could have used boolIdentifyTransients=TRUE
# to avoid the following post wrapper fitting.
objectImpulseDE2 <- fitSigmoidModels(
objectImpulseDE2 = objectImpulseDE2,
vecConfounders = NULL,
strCondition = 'case')
objectImpulseDE2 <- updateDEAnalysis(
objectImpulseDE2=objectImpulseDE2,
scaQThresTransients=0.001)
head(objectImpulseDE2$dfImpulseDE2Results)
# dfImpulseDE2Results now contain 'transients-analysis'.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.