---
title: "Primary vs Metastasis Analysis (Head & Neck Cancer)"
author: "Zaoqu Liu"
date: "`r Sys.Date()`"
output: 
  rmarkdown::html_vignette:
    toc: true
    toc_depth: 3
vignette: >
  %\VignetteIndexEntry{Primary vs Metastasis Analysis (Head & Neck Cancer)}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(
  echo = TRUE, 
  eval = FALSE,
  message = FALSE, 
  warning = FALSE
)
```

## Introduction

This vignette demonstrates comparison between primary tumor and lymph node metastasis using head and neck squamous cell carcinoma (HNSCC) data from GSE10332.

## Load Data

```{r load-data}
# Load HNSCC26 data (Primary and Lymph Node)
load(url("https://www.dropbox.com/s/6zns12amobs39g8/HNSCC26_data.RData?raw=1"))

# Examine structure
names(listCountMtx)
sapply(listCountMtx, ncol)
```

## Run Multi-Sample Comparison

```{r run-multi}
library(SCEVAN)

multiSampleComparisonClonalCN(
  listCountMtx,
  analysisName = "HNSCC26",
  organism = "human",
  par_cores = 20,
  plotTree = TRUE
)
```

## Biological Questions

This analysis helps answer:

1. **Clonal evolution**: Which alterations are present in both primary and metastasis?
2. **Metastasis drivers**: What new alterations appeared in the lymph node?
3. **Lost alterations**: Which primary alterations are absent in metastasis?

## Output Files

- `HNSCC26_allOncoHeat.png` - Combined OncoPrint
- `HNSCC26_CloneTree.png` - Phylogenetic tree
- Individual sample segmentation files

## Summary

Primary vs metastasis comparison reveals:

- Clonal alterations maintained during metastasis
- Metastasis-specific alterations (potential drivers)
- Evolutionary trajectory of the tumor

## Session Info

```{r session, eval=TRUE}
sessionInfo()
```
