Skip to contents

Introduction

SCEVAN enables comparative analysis of copy number alterations across multiple samples. This is particularly useful for:

  • Longitudinal studies: Comparing primary tumor vs metastasis
  • Treatment response: Pre- and post-treatment samples
  • Patient cohorts: Identifying shared vs patient-specific alterations

Preparing Multi-Sample Data

Data Structure

Multi-sample analysis requires a named list of count matrices:

# Example structure
listCountMtx <- list(
  "Sample1" = count_mtx_1,
  "Sample2" = count_mtx_2,
  "Sample3" = count_mtx_3
)

Download Example Data

# Load glioblastoma multi-sample data
load(url("https://www.dropbox.com/s/esqvnltucdqajg1/listCountMtx.RData?raw=1"))

# Examine structure
names(listCountMtx)

# Sample sizes
sapply(listCountMtx, ncol)

Running Multi-Sample Analysis

Basic Comparison

multiSampleComparisonClonalCN(
  listCountMtx,
  analysisName = "GBM_comparison",
  organism = "human",
  par_cores = 4
)

With Known Normal Cells

# Optionally provide known normal cells per sample
listNormCells <- list(
  "MGH102" = c("cell_a", "cell_b"),
  "MGH104" = c("cell_c", "cell_d"),
  "MGH105" = NULL,  # Auto-detect
  "MGH106" = NULL
)

multiSampleComparisonClonalCN(
  listCountMtx,
  listNormCells = listNormCells,
  analysisName = "GBM_with_normals",
  par_cores = 4
)

Output Interpretation

Generated Files

list.files("./output", pattern = "GBM_comparison")
File Description
*_allOncoHeat.png Combined OncoPrint across samples
*_comparison.png Side-by-side CN profiles
*_CloneTree.png Cross-sample phylogeny

Comparative Heatmap

The multi-sample comparison generates combined visualization files:

  • *_allOncoHeat.png - Combined OncoPrint showing shared and sample-specific alterations
  • *_CloneTree.png - Cross-sample phylogenetic tree

Visualization Functions

Plot All Clonal Profiles

# Generate combined clonal CN plot
plotAllClonalCN(
  sampleNames = names(listCountMtx),
  pathOutput = "./output"
)

Plot Subclonal Profiles

# Generate combined subclonal CN plot
plotAllSubclonalCN(
  sampleNames = names(listCountMtx),
  pathOutput = "./output"
)

Advanced Analysis

Identifying Shared Alterations

# Load individual results
results_list <- lapply(names(listCountMtx), function(s) {
  seg_file <- paste0("./output/", s, "_Clonal_CN.seg")
  if(file.exists(seg_file)) {
    read.table(seg_file, header = TRUE, sep = "\t")
  }
})
names(results_list) <- names(listCountMtx)

# Find alterations present in all samples
find_shared_alterations <- function(results_list) {
  # Get altered regions per sample
  altered_regions <- lapply(results_list, function(df) {
    if(!is.null(df)) {
      df[df$CN != 2, c("Chr", "Pos", "End", "CN")]
    }
  })
  
  # Find overlaps (simplified example)
  # In practice, use GenomicRanges for proper overlap detection
  altered_regions
}

shared <- find_shared_alterations(results_list)

Custom Comparison Plots

# Create custom comparison visualization
create_cn_comparison <- function(sample_names, output_path) {
  
  cn_data <- lapply(sample_names, function(s) {
    load(paste0(output_path, "/", s, "_CNAmtx.RData"))
    data.frame(
      sample = s,
      mean_cn = colMeans(CNA_mtx_relat)
    )
  })
  
  cn_df <- do.call(rbind, cn_data)
  
  ggplot(cn_df, aes(x = sample, y = mean_cn, fill = sample)) +
    geom_boxplot() +
    theme_minimal() +
    labs(
      title = "Global CNA Burden Comparison",
      x = "Sample",
      y = "Mean CNA Score"
    ) +
    theme(legend.position = "none")
}

# Generate plot
create_cn_comparison(names(listCountMtx), "./output")

Case Study: Head & Neck Cancer

Primary vs Lymph Node Metastasis

# Load HNSCC data
load(url("https://www.dropbox.com/s/6zns12amobs39g8/HNSCC26_data.RData?raw=1"))

# Examine samples
names(listCountMtx)  # Should show "Primary" and "LN"

# Run comparison
multiSampleComparisonClonalCN(
  listCountMtx,
  analysisName = "HNSCC26_comparison",
  organism = "human",
  par_cores = 4,
  plotTree = TRUE
)

Interpreting Primary vs Metastasis

Key questions to address:

  1. Clonal evolution: Which alterations are clonal (present in both)?
  2. Metastasis-specific: New alterations in lymph node
  3. Lost alterations: Present in primary but not metastasis

Statistical Considerations

Sample Size Requirements

Analysis Type Minimum Cells/Sample Recommendation
Cell classification 100 500+
Subclone detection 200 1000+
Cross-sample comparison 300 1000+

Batch Effect Considerations

When comparing samples:

  • Process with same protocol if possible
  • Consider batch correction methods
  • Verify normal cell detection consistency

Best Practices

Workflow Checklist

Common Pitfalls

Issue Cause Solution
No shared alterations Different tumor types Verify sample identity
All alterations shared Contamination Check for cross-sample mixing
Inconsistent segmentation Different cell counts Normalize comparison

Session Info

sessionInfo()
#> R version 4.4.0 (2024-04-24)
#> Platform: aarch64-apple-darwin20
#> Running under: macOS 15.6.1
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib 
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0
#> 
#> locale:
#> [1] C
#> 
#> time zone: Asia/Shanghai
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.39     desc_1.4.3        R6_2.6.1          fastmap_1.2.0    
#>  [5] xfun_0.56         cachem_1.1.0      knitr_1.51        htmltools_0.5.9  
#>  [9] rmarkdown_2.30    lifecycle_1.0.5   cli_3.6.5         sass_0.4.10      
#> [13] pkgdown_2.1.3     textshaping_1.0.4 jquerylib_0.1.4   systemfonts_1.3.1
#> [17] compiler_4.4.0    tools_4.4.0       ragg_1.5.0        bslib_0.9.0      
#> [21] evaluate_1.0.5    yaml_2.3.12       otel_0.2.0        jsonlite_2.0.0   
#> [25] rlang_1.1.7       fs_1.6.6          htmlwidgets_1.6.4