# Posthoc filtering and two-staged statistical tests

Source: `R/dtu_analysis.R`
`posthoc_and_stager.Rd`

Perform optional post-hoc filtering and run two-staged statistical tests.

    posthoc_and_stager(dturtle, ofdr = 0.05, posthoc = 0.1)

## Arguments

dturtle | Result object of `run_drimseq()`. Must be of class `dturtle`.
ofdr | Overall false discovery rate (OFDR) threshold.
posthoc | Specify the minimal standard deviation of a transcripts proportion level that should be kept when performing post-hoc filtering. To disable posthoc filtering 0 or `FALSE` can be provided.

## Value

An extended `dturtle` object. Additional slots include:

- `sig_gene`: A character vector of all genes where the first stageR step was significant. Basically the significant genes, that showed signs of DTU.

- `sig_tx` : A named character vector of transcripts where the second stageR step was significant. Basically the significant transcripts of the significant genes.

- `FDR_table` : A data frame of the stage-wise adjusted p-values for all genes/transcripts. Might contain NA-values, as transcript level p-values are not available when the gene level test was not significant.

## Details

The post-hoc filter excludes transcripts, which standard deviation of the proportion per cell/sample is below the threshold. The two-staged statistical test performed by stageR first determines if any of the transcripts of a gene is showing signs of DTU. The second step tries to identify on singular transcript level the significantly different transcripts.

## See also

`run_drimseq()` for DTU object creation. `create_dtu_table()` for result table creation.

Other DTUrtle DTU: `combine_to_matrix()`, `import_counts()`, `priming_bias_detection_probability()`, `run_drimseq()`