Skip to content
Snippets Groups Projects
Commit 65058422 authored by Christina Azodi's avatar Christina Azodi
Browse files

update description and namespace

parent cb2c845e
No related branches found
No related tags found
No related merge requests found
Showing with 2841 additions and 377 deletions
Package: splatter Package: sirPLUS
Type: Package Type: Package
Title: Simple Simulation of Single-cell RNA Sequencing Data Title: Using stochastic individual compartment models (ICMs) to simulate COVID-19 spread
Version: 1.11.1 Version: 1.0
Date: 2020-01-30 Date: 2020-03-23
Authors@R: Authors@R:
c(person("Luke", "Zappia", role = c("aut", "cre"), c(person("Christina", "Azodi", role = c("aut"),
email = "luke@lazappi.id.au", email = "cazodi@svi.edu.au",
comment = c(ORCID = "0000-0001-7744-8565")), comment = c(ORCID = "0000-0002-6097-606X")),
person("Belinda", "Phipson", role = c("aut"), person("Puxue", "Qiao", role = c("aut"),
email = "belinda.phipson@mcri.edu.au", email = "pqiao@svi.edu.au"),
comment = c(ORCID = "0000-0002-1711-7454")), person("Ruqian", "Lyu", role = c("aut"),
person("Alicia", "Oshlack", role = c("aut"), email = "rlyu@svi.edu.au"),
email = "alicia.oshlack@mcri.edu.au", person("Davis", "McCarthy", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-9788-5690"))) email = "dmccarthy@svi.edu.au",
Description: Splatter is a package for the simulation of single-cell RNA comment = c(ORCID = "0000-0002-2218-6833")))
sequencing count data. It provides a simple interface for creating complex Description: sirPlus is a package for the modeling of COVID-19 spread using
simulations that are reproducible and well-documented. Parameters can be stochastic individual compartment models (ICMs). It provides a simple interface
estimated from real data and functions are provided for comparing real and for creating experiments to demonstrate how factors like social-distancing and
simulated datasets. epidemeological parameters will change the curve.
License: GPL-3 + file LICENSE License: GPL-3 + file LICENSE
LazyData: TRUE LazyData: TRUE
Depends: Depends:
R (>= 3.6), R (>= 3.6)
SingleCellExperiment
Imports: Imports:
akima, tidyverse,
BiocGenerics, magrittr,
BiocParallel, lubridate,
checkmate, stringr,
edgeR, tibble,
dplyr, broom,
data.table,
fitdistrplus,
ggplot2, ggplot2,
locfit, gt,
matrixStats,
methods,
scales,
scater,
stats,
SummarizedExperiment,
utils,
crayon,
S4Vectors,
rlang
Suggests:
BiocStyle,
covr,
cowplot,
knitr, knitr,
devtools,
DiagrammeR,
parallel,
foreach,
tictoc,
EpiModel,
incidence,
earlyR
Suggests:
magick, magick,
limSolve,
lme4,
progress,
pscl,
testthat, testthat,
rmarkdown, rmarkdown,
scDD,
scran,
mfa,
phenopath,
BASiCS (>= 1.7.10),
zinbwave,
SparseDC,
BiocManager, BiocManager,
spelling, spelling
igraph, biocViews: Epidemiology, Software
DropletUtils
biocViews: SingleCell, RNASeq, Transcriptomics, GeneExpression, Sequencing,
Software, ImmunoOncology
URL: https://github.com/Oshlack/splatter
BugReports: https://github.com/Oshlack/splatter/issues
RoxygenNote: 7.0.2 RoxygenNote: 7.0.2
VignetteBuilder: knitr VignetteBuilder: knitr
Encoding: UTF-8 Encoding: UTF-8
......
# Generated by roxygen2: do not edit by hand # Generated by roxygen2: do not edit by hand
S3method(BASiCSEstimate,SingleCellExperiment)
S3method(BASiCSEstimate,matrix)
S3method(kersplatEstimate,SingleCellExperiment)
S3method(kersplatEstimate,matrix)
S3method(lun2Estimate,SingleCellExperiment)
S3method(lun2Estimate,matrix)
S3method(lunEstimate,SingleCellExperiment)
S3method(lunEstimate,matrix)
S3method(mfaEstimate,SingleCellExperiment)
S3method(mfaEstimate,matrix)
S3method(phenoEstimate,SingleCellExperiment)
S3method(phenoEstimate,matrix)
S3method(scDDEstimate,SingleCellExperiment)
S3method(scDDEstimate,default)
S3method(scDDEstimate,matrix)
S3method(simpleEstimate,SingleCellExperiment)
S3method(simpleEstimate,matrix)
S3method(sparseDCEstimate,SingleCellExperiment)
S3method(sparseDCEstimate,matrix)
S3method(splatEstimate,SingleCellExperiment)
S3method(splatEstimate,matrix)
S3method(zinbEstimate,SingleCellExperiment)
S3method(zinbEstimate,matrix)
export(BASiCSEstimate)
export(BASiCSSimulate)
export(addGeneLengths)
export(compareSCEs)
export(diffSCEs)
export(eQTLEstimate)
export(eQTLSimulate)
export(getParam)
export(getParams)
export(kersplatEstimate)
export(kersplatSample)
export(kersplatSetup)
export(kersplatSimulate)
export(listSims)
export(lun2Estimate)
export(lun2Simulate)
export(lunEstimate)
export(lunSimulate)
export(makeCompPanel)
export(makeDiffPanel)
export(makeOverallPanel)
export(mfaEstimate)
export(mfaSimulate)
export(newBASiCSParams)
export(newKersplatParams)
export(newLun2Params)
export(newLunParams)
export(newMFAParams)
export(newPhenoParams)
export(newSCDDParams)
export(newSimpleParams)
export(newSparseDCParams)
export(newSplatParams)
export(newZINBParams)
export(neweQTLParams)
export(phenoEstimate)
export(phenoSimulate)
export(scDDEstimate)
export(scDDSimulate)
export(setParam)
export(setParams)
export(simpleEstimate)
export(simpleSimulate)
export(sparseDCEstimate)
export(sparseDCSimulate)
export(splatEstimate)
export(splatSimulate)
export(splatSimulateGroups)
export(splatSimulatePaths)
export(splatSimulateSingle)
export(splatSimulateeQTL)
export(summariseDiff)
export(zinbEstimate)
export(zinbSimulate)
exportClasses(BASiCSParams)
exportClasses(KersplatParams)
exportClasses(Lun2Params)
exportClasses(LunParams)
exportClasses(MFAParams)
exportClasses(PhenoParams)
exportClasses(SCDDParams)
exportClasses(SimpleParams)
exportClasses(SparseDCParams)
exportClasses(SplatParams)
exportClasses(ZINBParams)
exportClasses(eQTLParams)
importFrom(BiocParallel,SerialParam)
importFrom(BiocParallel,bplapply)
importFrom(S4Vectors,"metadata<-")
importFrom(S4Vectors,metadata)
importFrom(SingleCellExperiment,"cpm<-")
importFrom(SingleCellExperiment,SingleCellExperiment)
importFrom(SingleCellExperiment,cbind)
importFrom(SingleCellExperiment,cpm)
importFrom(SummarizedExperiment,"assays<-")
importFrom(SummarizedExperiment,"colData<-")
importFrom(SummarizedExperiment,"rowData<-")
importFrom(SummarizedExperiment,assays)
importFrom(SummarizedExperiment,colData)
importFrom(SummarizedExperiment,rowData)
importFrom(checkmate,checkCharacter)
importFrom(checkmate,checkClass)
importFrom(checkmate,checkDataFrame)
importFrom(checkmate,checkFactor)
importFrom(checkmate,checkFlag)
importFrom(checkmate,checkInt)
importFrom(checkmate,checkIntegerish)
importFrom(checkmate,checkNumber)
importFrom(checkmate,checkNumeric)
importFrom(data.table,.I)
importFrom(data.table,between)
importFrom(data.table,data.table)
importFrom(ggplot2,aes_string)
importFrom(ggplot2,coord_fixed)
importFrom(ggplot2,element_blank)
importFrom(ggplot2,facet_wrap)
importFrom(ggplot2,geom_abline)
importFrom(ggplot2,geom_boxplot)
importFrom(ggplot2,geom_hline)
importFrom(ggplot2,geom_point)
importFrom(ggplot2,geom_smooth)
importFrom(ggplot2,geom_tile)
importFrom(ggplot2,geom_violin)
importFrom(ggplot2,ggplot)
importFrom(ggplot2,ggtitle)
importFrom(ggplot2,scale_colour_manual)
importFrom(ggplot2,scale_fill_distiller)
importFrom(ggplot2,scale_fill_manual)
importFrom(ggplot2,scale_x_log10)
importFrom(ggplot2,scale_y_continuous)
importFrom(ggplot2,scale_y_log10)
importFrom(ggplot2,theme)
importFrom(ggplot2,theme_minimal)
importFrom(ggplot2,xlab)
importFrom(ggplot2,ylab)
importFrom(locfit,locfit)
importFrom(methods,"slot<-")
importFrom(methods,as)
importFrom(methods,callNextMethod)
importFrom(methods,is)
importFrom(methods,new)
importFrom(methods,show)
importFrom(methods,slot)
importFrom(methods,slotNames)
importFrom(methods,validObject)
importFrom(stats,aggregate)
importFrom(stats,approxfun)
importFrom(stats,cor)
importFrom(stats,dbeta)
importFrom(stats,density)
importFrom(stats,dnbinom)
importFrom(stats,ks.test)
importFrom(stats,median)
importFrom(stats,model.matrix)
importFrom(stats,nls)
importFrom(stats,pnorm)
importFrom(stats,qgamma)
importFrom(stats,qnorm)
importFrom(stats,quantile)
importFrom(stats,rbinom)
importFrom(stats,rchisq)
importFrom(stats,rgamma)
importFrom(stats,rlnorm)
importFrom(stats,rnbinom)
importFrom(stats,rnorm)
importFrom(stats,rpois)
importFrom(stats,runif)
importFrom(stats,sd) importFrom(stats,sd)
importFrom(stats,shapiro.test)
importFrom(utils,globalVariables)
importFrom(utils,head)
importFrom(utils,read.delim)
importFrom(utils,write.table)
#' Example GFF file
#'
#' An example GFF file containing human genes from chromosome 22 of the GRCh38
#'
#' @docType data
#'
#' @usage data(ex_gff)
#'
#' @format A data frame with 504 rows and 9 variables:
#' \describe{
#' \item{V1}{id}
#' \item{V2}{source}
#' \item{V3}{feature}
#' \item{V4}{start}
#' \item{V5}{end}
#' \item{V6}{score}
#' \item{V7}{direction}
#' \item{V8}{frame}
#' \item{V9}{attribute}
#' ...
#' }
#' @source \url{ftp://ftp.ensembl.org/pub/release-98/gff3/homo_sapiens/Homo_sapiens.GRCh38.98.chromosome.22.gff3.gz
#'}
"ex_gff"
#' Example simulated genotype file (vcf)
#'
#' An example genotype file in the .vcf format, where each column is a sample
#' and each row is a SNP.
#'
#' @docType data
#'
#' @usage data(ex_snps)
#'
#' @format A data frame with 141882 rows and 109 variables:
#'
#' @source \url{ftp://ftp.ensembl.org/pub/release-98/gff3/homo_sapiens/Homo_sapiens.GRCh38.98.chromosome.22.gff3.gz
#'}
"ex_snps"
#' Example gene mean data for a whole population (from GTEx)
#'
#' An example population wide gene mean data.frame, where each column is a
#' sample and each row is a gene. Data is from the Thyroid tissue from the GTEx
#' dataset. Example data has already been filtered to remove genes with >50%
#' of samples have < 0.1 TPM
#'
#' @docType data
#'
#' @usage data(ex_means)
#'
#' @format A data frame with 2438 rows and 850 variables:
#'
#' @source \url{https://storage.googleapis.com/gtex_analysis_v8/rna_seq_data/GTEx_Analysis_2017-06-05_v8_RNASeQCv1.1.9_gene_tpm.gct.gz
#'}
"ex_means"
#' Example eQTL results from GTEx Thyroid tissue
#'
#' An example dataframe with eQTL pairs and effect sizes from the Thyroid
#' tissue from the GTEx dataset. This example data has already been filtered to
#' include only the top eSNP for each gene. Columns that must be included are:
#' 'gene_id', 'pval_nominal', and 'slope'.
#'
#' @docType data
#'
#' @usage data(ex_pairs)
#'
#' @format A data frame with 25,244 rows and 9 variables:
#'
#' @source \url{https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/all_snp_gene_associations/Thyroid.allpairs.txt.gz
#'}
"ex_pairs"
This diff is collapsed.
#' Get times
#'
#' Function to extract timings and assemble results in a dataframe
#'
#' @param simulate_results results from `simulte()` function.
#'
#' @return Dataframe of
get_times <- function(simulate_results) {
sim <- simulate_results$sim
for (s in 1:sim$control$nsims) {
if (s == 1) {
times <- sim$times[[paste("sim", s, sep = "")]]
times <- times %>% mutate(s = s)
} else {
times <- times %>% bind_rows(sim$times[[paste("sim", s, sep = "")]]
%>% mutate(s = s))
}
}
times <- times %>% mutate(infTime = ifelse(infTime < 0, -5,
infTime), expTime = ifelse(expTime < 0, -5, expTime)) %>%
mutate(incubation_period = infTime - expTime, illness_duration = recovTime -
expTime, illness_duration_hosp = dischTime - expTime,
hosp_los = dischTime - hospTime, quarantine_delay = quarTime -
infTime, survival_time = fatTime - infTime) %>%
select(s, incubation_period, quarantine_delay, illness_duration,
illness_duration_hosp, hosp_los, survival_time) %>%
pivot_longer(-s, names_to = "period_type", values_to = "duration") %>%
mutate(period_type = factor(period_type, levels = c("incubation_period",
"quarantine_delay", "illness_duration", "illness_duration_hosp",
"hosp_los", "survival_time"), labels = c("Incubation period",
"Delay entering isolation", "Illness duration", "Illness duration (hosp)",
"Hospital care required duration", "Survival time of case fatalities"), ordered = TRUE))
return(times)
}
This diff is collapsed.
#' sirPlus
#'
#' \pkg{sirPlus} is a package for modeling COVID-19 spread, focusing on rates
#' of hospitalization, which should be useful for hospitals.
#'
#'
#' @name sirPlus
#' @docType package
NULL
#' @importFrom utils globalVariables
utils::globalVariables(c("pval_nominal", 'perc', 'ex_pairs', 'ex_means'))
#' Logistic function
#'
#' Implementation of the logistic function
#'
#' @param x value to apply the function to.
#' @param x0 midpoint parameter. Gives the centre of the function.
#' @param k shape parameter. Gives the slope of the function.
#'
#' @return Value of logistic function with given parameters
logistic <- function(x, x0, k) {
1 / (1 + exp(-k * (x - x0)))
}
#' Bind rows (matched)
#'
#' Bind the rows of two data frames, keeping only the columns that are common
#' to both.
#'
#' @param df1 first data.frame to bind.
#' @param df2 second data.frame to bind.
#'
#' @return data.frame containing rows from \code{df1} and \code{df2} but only
#' common columns.
rbindMatched <- function(df1, df2) {
common.names <- intersect(names(df1), names(df2))
if (length(common.names) < 2) {
stop("There must be at least two columns in common")
}
combined <- rbind(df1[, common.names], df2[, common.names])
return(combined)
}
#' Bring items forward #' Bring items forward
#' #'
...@@ -61,39 +26,28 @@ bringItemsForward <- function(ll, items) { ...@@ -61,39 +26,28 @@ bringItemsForward <- function(ll, items) {
return(ll) return(ll)
} }
#' Winsorize vector #' cum_discr_si
#'
#' Set outliers in a numeric vector to a specified percentile.
#'
#' @param x Numeric vector to winsorize
#' @param q Percentile to set from each end
#'
#' @return Winsorized numeric vector
winsorize <- function(x, q) {
checkmate::check_numeric(x, any.missing = FALSE)
checkmate::check_number(q, lower = 0, upper = 1)
lohi <- stats::quantile(x, c(q, 1 - q), na.rm = TRUE)
if (diff(lohi) < 0) { lohi <- rev(lohi) }
x[!is.na(x) & x < lohi[1]] <- lohi[1]
x[!is.na(x) & x > lohi[2]] <- lohi[2]
return(x)
}
#' Calculate coefficient of variation
#'
#' Implementation of the coefficient of variation
#' #'
#' @param x vector of values. #' cum_discr_si
#' #'
#' @param vecTimeSinceExp ?
#' @param scale ?
#' @param shape ?
#'
#' @return Value of coefficient of variation for vector #' @return Value of coefficient of variation for vector
#' @importFrom stats sd #' @importFrom stats sd
co.var <- function(x) { cum_discr_si <- function(vecTimeSinceExp, scale, shape) {
sd(x)/mean(x) vlen <- length(vecTimeSinceExp)
} if (vlen > 0) {
probVec <- numeric(vlen)
for (p in 1:vlen) {
probVec[p] <- pweibull(vecTimeSinceExp[p], shape=shape, scale=scale)
}
} else {
probVec <- 0
}
return(probVec)
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/epi-functions.R
\name{arrivals.FUN}
\alias{arrivals.FUN}
\title{Arrivals function}
\usage{
arrivals.FUN(dat, at)
}
\arguments{
\item{dat}{Input data needed.}
\item{at}{Not sure???}
}
\value{
Updated dat
}
\description{
Function to handel background demographics for the SEIQHRF model.
Specifically arrivals (births and immigration). Uses the original EpiModel
code currently. A replacement that implements modelling the arrival of
infected individuals is under development -- but for now, all arrivals
go into the S compartment..
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sirPlus-functions.R
\name{control.icm}
\alias{control.icm}
\title{Check control ICM}
\usage{
control.icm(
type,
nsteps,
nsims = 1,
rec.rand = TRUE,
quar.rand = TRUE,
hosp.rand = TRUE,
disch.rand = TRUE,
fat.rand = TRUE,
a.rand = TRUE,
d.rand = TRUE,
initialize.FUN = initialize.icm,
infection.FUN = infection.icm,
recovery.FUN = recovery.icm,
departures.FUN = departures.icm,
arrivals.FUN = arrivals.icm,
get_prev.FUN = get_prev.icm,
verbose = FALSE,
verbose.int = 0,
skip.check = FALSE,
ncores = 1,
...
)
}
\arguments{
\item{type}{Model type}
}
\value{
Control icm
}
\description{
Function to check the control icm
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{cum_discr_si}
\alias{cum_discr_si}
\title{cum_discr_si}
\usage{
cum_discr_si(vecTimeSinceExp, scale, shape)
}
\arguments{
\item{vecTimeSinceExp}{?}
\item{scale}{?}
\item{shape}{?}
}
\value{
Value of coefficient of variation for vector
}
\description{
cum_discr_si
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/epi-functions.R
\name{departures.FUN}
\alias{departures.FUN}
\title{Departures function}
\usage{
departures.FUN(dat, at)
}
\arguments{
\item{dat}{Input data needed.}
\item{at}{Not sure???}
}
\value{
Updated dat
}
\description{
Function to handel background demographics for the SEIQHRF model.
Specifically departures (deaths not due to the virus, and emigration).
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/epi-functions.R
\name{get_prev.FUN}
\alias{get_prev.FUN}
\title{Get previous function}
\usage{
get_prev.FUN(dat, at)
}
\arguments{
\item{dat}{Input data needed.}
\item{at}{Not sure???}
}
\value{
Updated dat
}
\description{
Utility function that collects prevalence and transition time data from each
run and stores it away in the simulation result object.
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/results-parse.R
\name{get_times}
\alias{get_times}
\title{Get times}
\usage{
get_times(simulate_results)
}
\arguments{
\item{simulate_results}{results from `simulte()` function.}
}
\value{
Dataframe of
}
\description{
Function to extract timings and assemble results in a dataframe
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sirPlus-functions.R
\name{icm.seiqhrf}
\alias{icm.seiqhrf}
\title{Infection function}
\usage{
icm.seiqhrf(param, init, control)
}
\arguments{
\item{param}{ICM parameters.}
\item{init}{Initial value parameters.}
\item{control}{Control parameters.}
}
\value{
Updated dat
}
\description{
Function to implement infection processes for SEIQHRF model
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/epi-functions.R
\name{infection.FUN}
\alias{infection.FUN}
\title{Infection function}
\usage{
infection.FUN(dat, at)
}
\arguments{
\item{dat}{Input data needed.}
\item{at}{Not sure???}
}
\value{
Updated dat
}
\description{
Function to implement infection processes for SEIQHRF model
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sirPlus-functions.R
\name{infection.seiqhrf.icm}
\alias{infection.seiqhrf.icm}
\title{Model infections in ICM}
\usage{
infection.seiqhrf.icm(dat, at)
}
\arguments{
\item{dat}{Object containing all data}
\item{at}{?}
}
\value{
Updated dat
}
\description{
Function to model infections in icm
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sirPlus-functions.R
\name{init_status.icm}
\alias{init_status.icm}
\title{Initialize status of ICM}
\usage{
init_status.icm(dat)
}
\arguments{
\item{dat}{Object containing all data}
}
\value{
Updated dat
}
\description{
Function to get the status of the initialized icm
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/epi-functions.R
\name{initialize.FUN}
\alias{initialize.FUN}
\title{Initialize ICM}
\usage{
initialize.FUN(param, init, control)
}
\arguments{
\item{param}{ICM parameters.}
\item{init}{Initial value parameters.}
\item{control}{Control parameters.}
}
\value{
Updated dat
}
\description{
Function to initialize the icm
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sirPlus-functions.R
\name{merge.seiqhrf.icm}
\alias{merge.seiqhrf.icm}
\title{Merge icm}
\usage{
\method{merge}{seiqhrf.icm}(x, y, ...)
}
\arguments{
\item{x}{First to merge}
\item{y}{Second to merge}
}
\value{
Combined
}
\description{
Function to merge icms
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment