getCSPEstimates {AnaCoDa}R Documentation

Return Codon Specific Paramters (or write to csv) estimates as data.frame


getCSPEstimates returns the codon specific parameter estimates for a given parameter and mixture or write it to a csv file.


  filename = NULL,
  mixture = 1,
  samples = 10, = T,
  report.original.ref = T,
  log.scale = F



parameter an object created by initializeParameterObject.


Posterior estimates will be written to file (format: csv). Filename will be in the format <parameter_name>_<filename>.csv.


estimates for which mixture should be returned


The number of samples used for the posterior estimates.

Boolean determining if parameters should be relative to the preferred codon or the alphabetically last codon (Default=TRUE). Only applies to ROC and FONSE models


Include the original reference codon (Default = TRUE). Note this is only included for the purposes of simulations, which expect the input parameter file to be in a specific format. Later version of AnaCoDa will remove this.


Calculate posterior means, standard deviation, and posterior probability intervals on the natural log scale. Should be used for PA and PANSE models only.


returns a list data.frame with the posterior estimates of the models codon specific parameters or writes it directly to a csv file if filename is specified


genome_file <- system.file("extdata", "genome.fasta", package = "AnaCoDa")

genome <- initializeGenomeObject(file = genome_file)
sphi_init <- c(1,1)
numMixtures <- 2
geneAssignment <- c(rep(1,floor(length(genome)/2)),rep(2,ceiling(length(genome)/2)))
parameter <- initializeParameterObject(genome = genome, sphi = sphi_init, 
                                       num.mixtures = numMixtures, 
                                       gene.assignment = geneAssignment, 
                                       mixture.definition = "allUnique")
model <- initializeModelObject(parameter = parameter, model = "ROC")
samples <- 2500
thinning <- 50
adaptiveWidth <- 25
mcmc <- initializeMCMCObject(samples = samples, thinning = thinning, 
                             adaptive.width=adaptiveWidth, est.expression=TRUE, 
                             est.csp=TRUE, est.hyper=TRUE, est.mix = TRUE) 
divergence.iteration <- 10
## Not run: 
runMCMC(mcmc = mcmc, genome = genome, model = model, 
        ncores = 4, divergence.iteration = divergence.iteration)

## return estimates for codon specific parameters
csp_mat <- getCSPEstimates(parameter)

# write the result directly to the filesystem as a csv file. No values are returned
getCSPEstimates(parameter, filename=file.path(tempdir(), "test.csv"))

## End(Not run)

[Package AnaCoDa version Index]