Retains only a subset of clonal segments, e.g., all `2:1` segments.

subset_by_segment_karyotype(x, karyotypes)

Arguments

x

A new CNAqc object with subset data.

karyotypes

A list of karyotype ids in "Major:minor" notation (e.g., "1:1", "2,1", ...) that will be retained.

Examples

data('example_dataset_CNAqc', package = 'CNAqc')
x = init(mutations = example_dataset_CNAqc$mutations, cna = example_dataset_CNAqc$cna, purity = example_dataset_CNAqc$purity)
#> 
#> ── CNAqc - CNA Quality Check ───────────────────────────────────────────────────
#> 
#>  Using reference genome coordinates for: GRCh38.
#>  Found annotated driver mutations: TTN, CTCF, and TP53.
#>  Fortified calls for 12963 somatic mutations: 12963 SNVs (100%) and 0 indels.
#> ! CNAs have no CCF, assuming clonal CNAs (CCF = 1).
#>  Fortified CNAs for 267 segments: 267 clonal and 0 subclonal.
#>  12963 mutations mapped to clonal CNAs.

subset_by_segment_karyotype(x, '2:2')
#> 
#> ── CNAqc - CNA Quality Check ───────────────────────────────────────────────────
#> 
#>  Using reference genome coordinates for: GRCh38.
#>  Found annotated driver mutations: TTN, CTCF, and TP53.
#>  Fortified calls for 12963 somatic mutations: 12963 SNVs (100%) and 0 indels.
#> ! CNAs have no CCF, assuming clonal CNAs (CCF = 1).
#>  Fortified CNAs for 80 segments: 80 clonal and 0 subclonal.
#> Warning: [CNAqc] a karyotype column is present in CNA calls, and will be overwritten
#>  7478 mutations mapped to clonal CNAs.
#> 
#>               ┌ Driver(s):  TTN, TP53 ────────────────────────────┐
#>                                                                  
#>                  Driver cannot be mapped - out of any segment!   
#>                                                                  
#>               └───────────────────────────────────────────────────┘
#> ── [ CNAqc ] MySample 7478 mutations in 80 segments (80 clonal, 0 subclonal). Ge
#> 
#> ── Clonal CNAs 
#> 
#>  2:2  [n = 7478, L = 1483 Mb] ■■■■■■■■■■■■■■■■■■■■■■■■■■■  { CTCF }
#> 
#>  Sample Purity: 89% ~ Ploidy: 4.
#> 
#>  There are 1 annotated driver(s) mapped to clonal CNAs.
#>          chr     from       to ref alt  DP NV  VAF driver_label is_driver
#>        chr16 67646006 67646007   C   T 120 54 0.45         CTCF      TRUE
subset_by_segment_karyotype(x, '2:1')
#> 
#> ── CNAqc - CNA Quality Check ───────────────────────────────────────────────────
#> 
#>  Using reference genome coordinates for: GRCh38.
#>  Found annotated driver mutations: TTN, CTCF, and TP53.
#>  Fortified calls for 12963 somatic mutations: 12963 SNVs (100%) and 0 indels.
#> ! CNAs have no CCF, assuming clonal CNAs (CCF = 1).
#>  Fortified CNAs for 49 segments: 49 clonal and 0 subclonal.
#> Warning: [CNAqc] a karyotype column is present in CNA calls, and will be overwritten
#>  1563 mutations mapped to clonal CNAs.
#> 
#>               ┌ Driver(s):  CTCF, TP53 ───────────────────────────┐
#>                                                                  
#>                  Driver cannot be mapped - out of any segment!   
#>                                                                  
#>               └───────────────────────────────────────────────────┘
#> ── [ CNAqc ] MySample 1563 mutations in 49 segments (49 clonal, 0 subclonal). Ge
#> 
#> ── Clonal CNAs 
#> 
#>  2:1  [n = 1563, L =  420 Mb] ■■■■■■■■■■■■■■■■■■■■■■■■■■■  { TTN }
#> 
#>  Sample Purity: 89% ~ Ploidy: 3.
#> 
#>  There are 1 annotated driver(s) mapped to clonal CNAs.
#>         chr      from        to ref alt  DP NV       VAF driver_label is_driver
#>        chr2 179431633 179431634   C   T 117 77 0.6581197          TTN      TRUE