% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tsv-export.R
\name{to_statistics_tsv}
\alias{to_statistics_tsv}
\alias{to_statistics_tsv,RegionResult-method}
\title{Write the pairwise Statistics TSV}
\usage{
to_statistics_tsv(result, path)

\S4method{to_statistics_tsv}{RegionResult}(result, path)
}
\arguments{
\item{result}{A [`RegionResult-class`].}

\item{path}{Destination file path.}
}
\value{
Invisibly returns `path`.
}
\description{
Mirrors the React webapp's DataSummaryPanel "Export Statistics" button +
Python's `RegionResult.to_statistics_tsv()` byte-for-byte.
}
\details{
Columns: Set_A, Set_B, Name_A, Name_B, Size_A, Size_B, Intersection, Union,
Jaccard, Overlap_Coeff, Dice, Expected, Fold_Enrichment, P_value, FDR, Significant.
Float formatting:
* Jaccard / Overlap_Coeff / Dice: 4 decimals via [.js_to_fixed()]
* Expected: 2 decimals
* Fold_Enrichment: 3 decimals
* P_value / FDR: scientific (JS toExponential(2)) if `< 0.001`, else 6 decimals
* Significant: one of `"***"`, `"**"`, `"*"`, `"ns"` keyed off FDR thresholds
  (0.001, 0.01, 0.05).

Rows are sorted by P_value ascending (matches the underlying StatisticsResult).
}
\examples{
ds <- methods::new("VennDataset",
    set_names = c("A", "B"),
    items = list(A = c("x", "y"), B = c("y", "z")),
    item_order = c("x", "y", "z"),
    universe_size = 10L, source_path = NULL, format = "csv")
result <- analyze(ds)
to_statistics_tsv(result, tempfile(fileext = ".tsv"))
\donttest{
result <- analyze(load_sample("dataset_real_cancer_drivers_4"))
to_statistics_tsv(result, tempfile(fileext = ".tsv"))
}
}
