---
title: "PARATI: Parental Allele Transmission Inference"
author: "Jinyi Che"
date: "`r Sys.Date()`"
output:
  BiocStyle::html_document:
    toc: true
vignette: >
  %\VignetteIndexEntry{parati Workflow}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

## Abstract

PARATI is an R package for inferring parental transmitted and non-transmitted
alleles in trio genotype data. It fills a gap in current Bioconductor workflows
for analyzing genetic nurture and transgenerational effects, complementing
packages such as `VariantAnnotation` by providing SNP-specific transmission
inference for trio data.

## Introduction

PARATI infers maternal and paternal transmitted and non-transmitted alleles
from phased trio genotype data. While Bioconductor packages such as
`VariantAnnotation` provide robust infrastructure for reading and representing
VCF data, they do not directly implement trio-specific transmission inference.
PARATI builds on that infrastructure by accepting `VariantAnnotation::VCF`
objects or VCF file paths and returning R objects suitable for downstream
analysis.

## Installation

```{r eval=FALSE}
if (!requireNamespace("BiocManager", quietly = TRUE)) {
    install.packages("BiocManager")
}
BiocManager::install("parati")
```

## Load packages and example data

```{r}
library(parati)
library(VariantAnnotation)

vcf_file <- system.file("extdata", "Toy_TrioGenotype.vcf.gz", package = "parati")
fam_file <- system.file("extdata", "Toy_FamilyIndexTable.xlsx", package = "parati")
```

## Run PARATI from a VCF file path

```{r}
res <- parati_run(
  vcf = vcf_file,
  fam = fam_file,
  chr = 1,
  hap_length = 500000
)

names(res)
```

## Explore returned results

```{r}
head(res$vcf_trans, 3)
head(res$vcf_nontrans, 3)
head(res$sim_perc_summary, 3)
```

## Integration with Bioconductor VCF workflows

```{r eval=FALSE}
vcf_obj <- readVcf(vcf_file, genome = "unknown")

res_from_vcf <- parati_run(
  vcf = vcf_obj,
  fam = fam_file,
  chr = 1,
  hap_length = 500000
)

names(res_from_vcf)
```

## Inputs

### 1. Trio genotype VCF

- Standard phased VCF input
- Autosomal biallelic SNPs are recommended
- Sample IDs must match `IndividualID` in the family table

### 2. Family index table

Columns required:

- `FamilyIndex`
- `IndividualID`
- `Role`

## Notes

The primary interface returns R objects rather than writing files to disk.
This design is intended to align with Bioconductor workflows and facilitate
downstream analyses. Users can save returned results manually as needed.

## Session Info

```{r}
sessionInfo()
```
