% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/diffdriver.R
\name{diffdriver}
\alias{diffdriver}
\title{Run diffDriver with Input Files}
\usage{
diffdriver(
  gene,
  mut,
  pheno,
  anno_dir = ".",
  k = 6,
  totalnttype = 96,
  BMRmode = c("signature", "regular"),
  output_dir = tempdir(),
  output_prefix = "diffdriver_results"
)
}
\arguments{
\item{gene}{A vector of genes to be included in the analysis.}

\item{mut}{A data frame containing all somatic mutations from the cohort. The format is:
\describe{
  \item{Chromosome}{<int>}
  \item{Position}{<int>}
  \item{Ref}{<chr>}
  \item{Alt}{<chr>}
  \item{SampleID}{<chr>}
}
Example:
\preformatted{
Chromosome Position Ref Alt SampleID
1 19 55653236 C T TCGA-N6-A4VE-01A-11D-A28R-08
}}

\item{pheno}{A data frame containing sample phenotypes. The format is:
#' \describe{
  \item{SampleID}{<chr>}
  \item{Phenotype1}{<dbl>}
  \item{Phenotype2}{<dbl>}
  \item{...}{...}
}
Example:
\preformatted{
SampleID SmokingCessation BMI
TCGA-N5-A4R8-01A-11D-A28R-08 0.5319630 20.0
TCGA-N5-A4RD-01A-11D-A28R-08 0.0448991 24.4
}}

\item{anno_dir}{The path to the directory with all the annotation files.
Please download from Zenodo.The default is current folder}

\item{k}{The number of topics used in modeling background mutation rate.
The default is 6.}

\item{totalnttype}{either 9 or 96. Will look for annotation files
anno9_ntypexxx_annodata.txt when totalnttype is 9 or anno96_ntypexxx_annodata
when totalnttype is 96.}

\item{BMRmode}{There are two modes to run diffdriver. One is "signature",
this will model individual level BMR, this is the default. The second one is
"regular", this assumes BMR is the same across individuals, only models
position-level difference.}

\item{output_dir}{The path to the output directory. Defaults to \code{tempdir()}.}

\item{output_prefix}{The prefix being added to the output file names.}
}
\description{
This function runs diffDriver.
}
\value{
A data frame with one row per tested gene. The returned columns include
\code{dd.p}, \code{mlr.p}, \code{mlr.v2.p}, \code{fisher.p}, \code{binom.p},
and \code{lr.p}, which are p-values from DiffDriver and comparator methods;
the corresponding \code{.fdr} columns, which contain Benjamini-Hochberg adjusted
p-values; and \code{mut.E1}, \code{mut.E0}, \code{E1}, and \code{E0}, which
summarize mutation and sample counts in the two phenotype groups used by the
Fisher test.
}
\examples{
phenof <- system.file(
  "extdata", "example_phenotypes.txt",
  package = "diffdriver"
)
genef <- system.file(
  "extdata", "example_gene.txt",
  package = "diffdriver"
)
mutf <- system.file(
  "extdata", "example_mutations.txt",
  package = "diffdriver"
)

pheno <- read.table(phenof, header = TRUE)
gene <- read.table(genef, header = FALSE)
mut <- read.table(mutf, header = TRUE)

\dontrun{
# Download the annotation files and replace this with their directory.
annodir <- "/path/to/annodir96"

result <- diffdriver(
  gene = gene,
  mut = mut,
  pheno = pheno,
  anno_dir = annodir,
  k = 6,
  totalnttype = 96,
  BMRmode = "signature",
  output_dir = tempdir(),
  output_prefix = "diffdriver_example"
)
result
}
}
