# This file was auto generated by Styx.
# Do not edit this file directly.

import typing
import pathlib
from styxdefs import *
import dataclasses

FDRVAL_METADATA = Metadata(
    id="f92df9dc9c7bd351f5f06439c97a5434e22b31b8.boutiques",
    name="fdrval",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class FdrvalOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fdrval(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output: OutputPathType
    """Computed q-values or p-values for the given thresholds"""


def fdrval(
    dset: InputPathType,
    sub: float,
    val_list: list[float],
    pval: bool = False,
    ponly: bool = False,
    qonly: bool = False,
    qinput: bool = False,
    inverse: bool = False,
    runner: Runner | None = None,
) -> FdrvalOutputs:
    """
    Computes q-values from FDR curve data stored in dataset headers.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        dset: Input dataset.
        sub: Sub-brick number.
        val_list: List of threshold values.
        pval: Output the p-value (on the same line, after q).
        ponly: Don't output q-values, just p-values.
        qonly: Don't output p-values, just q-values.
        qinput: The 'val' inputs are taken to be q-values and then the outputs\
            are the corresponding statistical thresholds.
        inverse: Inverse of the usual operation. 'Val' inputs must be between 0\
            and 1 (exclusive). Cannot be used with '-ponly' or '-pval'.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FdrvalOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FDRVAL_METADATA)
    cargs = []
    cargs.append("fdrval")
    cargs.append(execution.input_file(dset))
    cargs.append(str(sub))
    cargs.extend(map(str, val_list))
    if pval:
        cargs.append("-pval")
    if ponly:
        cargs.append("-ponly")
    if qonly:
        cargs.append("-qonly")
    if qinput:
        cargs.append("-qinput")
    if inverse:
        cargs.append("-inverse")
    ret = FdrvalOutputs(
        root=execution.output_file("."),
        output=execution.output_file("stdout.txt"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FDRVAL_METADATA",
    "FdrvalOutputs",
    "fdrval",
]
