Contents

Progenetix is an open data resource that provides curated individual cancer copy number aberrations (CNA) profiles along with associated metadata sourced from published oncogenomic studies and various data repositories. This vignette offers a comprehensive guide on accessing and visualizing CNV frequency data within the Progenetix database. CNV frequency is pre-calculated based on CNV segment data in Progenetix and reflects the CNV pattern in a cohort. It is defined as the percentage of samples showing a CNV for a genomic region (1MB-sized genomic bins in this case) over the total number of samples in a cohort specified by filters. If your focus lies in cancer cell lines, you can access data from cancercelllines.org by specifying the dataset parameter as “cancercelllines”. This data repository originates from CNV profiling data of cell lines initially collected as part of Progenetix and currently includes additional types of genomic mutations.

1 Load library

library(pgxRpi)
library(SummarizedExperiment) # for pgxmatrix data
#> Loading required package: MatrixGenerics
#> Loading required package: matrixStats
#> 
#> Attaching package: 'MatrixGenerics'
#> The following objects are masked from 'package:matrixStats':
#> 
#>     colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
#>     colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
#>     colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
#>     colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
#>     colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
#>     colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
#>     colWeightedMeans, colWeightedMedians, colWeightedSds,
#>     colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
#>     rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
#>     rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
#>     rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
#>     rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
#>     rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
#>     rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
#>     rowWeightedSds, rowWeightedVars
#> Loading required package: GenomicRanges
#> Loading required package: stats4
#> Loading required package: BiocGenerics
#> 
#> Attaching package: 'BiocGenerics'
#> The following objects are masked from 'package:stats':
#> 
#>     IQR, mad, sd, var, xtabs
#> The following objects are masked from 'package:base':
#> 
#>     Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
#>     as.data.frame, basename, cbind, colnames, dirname, do.call,
#>     duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
#>     lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
#>     pmin.int, rank, rbind, rownames, sapply, setdiff, table, tapply,
#>     union, unique, unsplit, which.max, which.min
#> Loading required package: S4Vectors
#> 
#> Attaching package: 'S4Vectors'
#> The following object is masked from 'package:utils':
#> 
#>     findMatches
#> The following objects are masked from 'package:base':
#> 
#>     I, expand.grid, unname
#> Loading required package: IRanges
#> Loading required package: GenomeInfoDb
#> Loading required package: Biobase
#> Welcome to Bioconductor
#> 
#>     Vignettes contain introductory material; view with
#>     'browseVignettes()'. To cite Bioconductor, see
#>     'citation("Biobase")', and for packages 'citation("pkgname")'.
#> 
#> Attaching package: 'Biobase'
#> The following object is masked from 'package:MatrixGenerics':
#> 
#>     rowMedians
#> The following objects are masked from 'package:matrixStats':
#> 
#>     anyMissing, rowMedians
library(GenomicRanges) # for pgxfreq data

1.1 pgxLoader function

This function loads various data from Progenetix database.

The parameters of this function used in this tutorial:

  • type A string specifying output data type. Available options are “biosample”, “individual”, “variant” or “frequency”.
  • output A string specifying output file format. When the parameter type is “frequency”, available options are “pgxfreq” or “pgxmatrix”.
  • filters Identifiers for cancer type, literature, cohorts, and age such as c(“NCIT:C7376”, “pgx:icdom-98353”, “PMID:22824167”, “pgx:cohort-TCGAcancers”, “age:>=P50Y”). For more information about filters, see the documentation.
  • dataset A string specifying the dataset to query. Default is “progenetix”. Other available options are “cancercelllines”.

2 Retrieve CNV frequency data

2.1 Relevant parameters

type, output, filters, dataset

2.2 The first output format (output = “pgxfreq”)

freq_pgxfreq <- pgxLoader(type="frequency", output ="pgxfreq",
                         filters=c("NCIT:C4038","pgx:icdom-85003"))

freq_pgxfreq
#> GRangesList object of length 2:
#> $`NCIT:C4038`
#> GRanges object with 3106 ranges and 3 metadata columns:
#>          seqnames            ranges strand | gain_frequency loss_frequency
#>             <Rle>         <IRanges>  <Rle> |      <numeric>      <numeric>
#>      [1]        1          0-400000      * |          1.250          1.875
#>      [2]        1    400000-1400000      * |          1.875         10.000
#>      [3]        1   1400000-2400000      * |          2.500         10.625
#>      [4]        1   2400000-3400000      * |          2.500         13.125
#>      [5]        1   3400000-4400000      * |          3.125         13.125
#>      ...      ...               ...    ... .            ...            ...
#>   [3102]        Y 52400000-53400000      * |              0          0.625
#>   [3103]        Y 53400000-54400000      * |              0          0.625
#>   [3104]        Y 54400000-55400000      * |              0          0.625
#>   [3105]        Y 55400000-56400000      * |              0          0.625
#>   [3106]        Y 56400000-57227415      * |              0          0.625
#>                 no
#>          <integer>
#>      [1]         1
#>      [2]         2
#>      [3]         3
#>      [4]         4
#>      [5]         5
#>      ...       ...
#>   [3102]      3102
#>   [3103]      3103
#>   [3104]      3104
#>   [3105]      3105
#>   [3106]      3106
#>   -------
#>   seqinfo: 24 sequences from an unspecified genome; no seqlengths
#> 
#> $`pgx:icdom-85003`
#> GRanges object with 3106 ranges and 3 metadata columns:
#>          seqnames            ranges strand | gain_frequency loss_frequency
#>             <Rle>         <IRanges>  <Rle> |      <numeric>      <numeric>
#>      [1]        1          0-400000      * |          6.603          4.838
#>      [2]        1    400000-1400000      * |          8.368         10.262
#>      [3]        1   1400000-2400000      * |          6.667         12.356
#>      [4]        1   2400000-3400000      * |          8.801         23.789
#>      [5]        1   3400000-4400000      * |          6.772         22.489
#>      ...      ...               ...    ... .            ...            ...
#>   [3102]        Y 52400000-53400000      * |          0.008          0.361
#>   [3103]        Y 53400000-54400000      * |          0.008          0.361
#>   [3104]        Y 54400000-55400000      * |          0.008          0.361
#>   [3105]        Y 55400000-56400000      * |          0.008          0.361
#>   [3106]        Y 56400000-57227415      * |          0.008          0.361
#>                 no
#>          <integer>
#>      [1]         1
#>      [2]         2
#>      [3]         3
#>      [4]         4
#>      [5]         5
#>      ...       ...
#>   [3102]      3102
#>   [3103]      3103
#>   [3104]      3104
#>   [3105]      3105
#>   [3106]      3106
#>   -------
#>   seqinfo: 24 sequences from an unspecified genome; no seqlengths

The returned data is stored in GRangesList container which consists of multiple GRanges objects. Each GRanges object stores CNV frequency from samples pecified by a particular filter. Within each GRanges object, you can find annotation columns “gain_frequency” and “loss_frequency” in each row, which express the percentage values across samples (%) for gains and losses that overlap the corresponding genomic interval.

These genomic intervals are derived from the partitioning of the entire genome (GRCh38). Most of these bins have a size of 1MB, except for a few bins located near the telomeres. In total, there are 3106 intervals encompassing the genome.

To access the CNV frequency data from specific filters, you could access like this

freq_pgxfreq[["NCIT:C4038"]]
#> GRanges object with 3106 ranges and 3 metadata columns:
#>          seqnames            ranges strand | gain_frequency loss_frequency
#>             <Rle>         <IRanges>  <Rle> |      <numeric>      <numeric>
#>      [1]        1          0-400000      * |          1.250          1.875
#>      [2]        1    400000-1400000      * |          1.875         10.000
#>      [3]        1   1400000-2400000      * |          2.500         10.625
#>      [4]        1   2400000-3400000      * |          2.500         13.125
#>      [5]        1   3400000-4400000      * |          3.125         13.125
#>      ...      ...               ...    ... .            ...            ...
#>   [3102]        Y 52400000-53400000      * |              0          0.625
#>   [3103]        Y 53400000-54400000      * |              0          0.625
#>   [3104]        Y 54400000-55400000      * |              0          0.625
#>   [3105]        Y 55400000-56400000      * |              0          0.625
#>   [3106]        Y 56400000-57227415      * |              0          0.625
#>                 no
#>          <integer>
#>      [1]         1
#>      [2]         2
#>      [3]         3
#>      [4]         4
#>      [5]         5
#>      ...       ...
#>   [3102]      3102
#>   [3103]      3103
#>   [3104]      3104
#>   [3105]      3105
#>   [3106]      3106
#>   -------
#>   seqinfo: 24 sequences from an unspecified genome; no seqlengths

To get metadata such as count of samples used to calculate frequency, use mcols function from GenomicRanges package:

mcols(freq_pgxfreq)
#> DataFrame with 2 rows and 3 columns
#>                          filter                  label sample_count
#>                     <character>            <character>    <numeric>
#> NCIT:C4038           NCIT:C4038   Lung Carcinoid Tumor          160
#> pgx:icdom-85003 pgx:icdom-85003 Infiltrating duct ca..        12464

2.3 The second output format (output = “pgxmatrix”)

Choose 8 NCIT codes of interests that correspond to different tumor types

code <-c("C3059","C3716","C4917","C3512","C3493","C3771","C4017","C4001")
# add prefix for query
code <- sub(".",'NCIT:C',code)

load data with the specified code

freq_pgxmatrix <- pgxLoader(type="frequency",output ="pgxmatrix",filters=code)
freq_pgxmatrix
#> class: RangedSummarizedExperiment 
#> dim: 6212 8 
#> metadata(0):
#> assays(1): frequency
#> rownames(6212): 1 2 ... 6211 6212
#> rowData names(1): type
#> colnames(8): NCIT:C3059 NCIT:C3493 ... NCIT:C4017 NCIT:C4917
#> colData names(3): filter label sample_count

The returned data is stored in RangedSummarizedExperiment object, which is a matrix-like container where rows represent ranges of interest (as a GRanges object) and columns represent filters.

To get metadata such as count of samples used to calculate frequency, use colData function from SummarizedExperiment package:

colData(freq_pgxmatrix)
#> DataFrame with 8 rows and 3 columns
#>                 filter                  label sample_count
#>            <character>            <character>    <numeric>
#> NCIT:C3059  NCIT:C3059                 Glioma         8183
#> NCIT:C3493  NCIT:C3716 Lung Squamous Cell C..         1938
#> NCIT:C3512  NCIT:C4917    Lung Adenocarcinoma         4664
#> NCIT:C3716  NCIT:C3512 Primitive Neuroectod..         2214
#> NCIT:C3771  NCIT:C3493 Breast Lobular Carci..          904
#> NCIT:C4001  NCIT:C3771 Breast Inflammatory ..           27
#> NCIT:C4017  NCIT:C4017 Breast Ductal Carcin..        10097
#> NCIT:C4917  NCIT:C4001 Lung Small Cell Carc..          558

To access the CNV frequency matrix, use assay accesssor from SummarizedExperiment package

head(assay(freq_pgxmatrix))
#>   NCIT:C3059 NCIT:C3493 NCIT:C3512 NCIT:C3716 NCIT:C3771 NCIT:C4001 NCIT:C4017
#> 1      3.324      2.683      1.758      3.659      1.106      3.704      7.794
#> 2      7.112      6.192      5.039      7.453      2.212      7.407      9.646
#> 3      8.982      5.315      5.103      8.943      2.434      7.407      7.794
#> 4     10.033      9.030     12.093      8.672      3.982      3.704      9.904
#> 5     10.730      7.534     10.892      9.033      3.429      3.704      7.616
#> 6      7.736      7.379     10.699      7.949      2.434      3.704      5.606
#>   NCIT:C4917
#> 1      9.319
#> 2     22.760
#> 3     21.685
#> 4     27.061
#> 5     25.806
#> 6     25.806

The matrix has 6212 rows (genomic regions) and 8 columns (filters). The rows comprised 3106 intervals with “gain status” plus 3106 intervals with “loss status”.

The value is the percentage of samples from the corresponding filter having one or more CNV events in the specific genomic intervals. You could get the interval information by rowRanges function from SummarizedExperiment package

rowRanges(freq_pgxmatrix)
#> GRanges object with 6212 ranges and 1 metadata column:
#>        seqnames            ranges strand |        type
#>           <Rle>         <IRanges>  <Rle> | <character>
#>      1        1          0-400000      * |         DUP
#>      2        1    400000-1400000      * |         DUP
#>      3        1   1400000-2400000      * |         DUP
#>      4        1   2400000-3400000      * |         DUP
#>      5        1   3400000-4400000      * |         DUP
#>    ...      ...               ...    ... .         ...
#>   6208        Y 52400000-53400000      * |         DEL
#>   6209        Y 53400000-54400000      * |         DEL
#>   6210        Y 54400000-55400000      * |         DEL
#>   6211        Y 55400000-56400000      * |         DEL
#>   6212        Y 56400000-57227415      * |         DEL
#>   -------
#>   seqinfo: 24 sequences from an unspecified genome; no seqlengths

For example, if the value in the second row and first column is 8.457, it means that 8.457% samples from the corresponding filter NCIT:C3059 having one or more duplication events in the genomic interval in chromosome 1: 400000-1400000.

Note: it is different from CNV status matrix introduced in Introduction_2_loadvariants. Value in this matrix is percentage (%) of samples having one or more CNVs overlapped with the binned interval while the value in CNV status matrix is fraction in individual samples to indicate how much the binned interval overlaps with one or more CNVs in the individual sample.

3 Calculate CNV frequency data

3.1 segtoFreq function

This function computes the binned CNV frequency from segment data.

The parameters of this function:

  • data: Segment data with CNV states. The first four columns should specify sample ID, chromosome, start position, and end position, respectively. The column representing CNV states should contain either “DUP” for duplications or “DEL” for deletions.
  • cnv_column_idx: Index of the column specifying CNV state. Default is 6, following the “pgxseg” format used in Progenetix. If the input segment data uses the general .seg file format, it might need to be set differently.
  • cohort_name: A string specifying the cohort name. Default is “unspecified cohort”.
  • assembly: A string specifying the genome assembly version for CNV frequency calculation. Allowed options are “hg19” or “hg38”. Default is “hg38”.
  • bin_size: Size of genomic bins used to split the genome, in base pairs (bp). Default is 1,000,000.
  • overlap: Numeric value defining the amount of overlap between bins and segments considered as bin-specific CNV, in base pairs (bp). Default is 1,000.
  • soft_expansion: Fraction of bin_size to determine merge criteria. During the generation of genomic bins, division starts at the centromere and expands towards the telomeres on both sides. If the size of the last bin is smaller than soft_expansion * bin_size, it will be merged with the previous bin. Default is 0.1.

Suppose you have segment data from several biosamples:

# access variant data
vardata <- pgxLoader(type="variant",biosample_id = c("pgxbs-kftvhmz9", "pgxbs-kftvhnqz","pgxbs-kftvhupd"),output="pgxseg")
# only keep segment cnv data
segdata <- vardata[vardata$variant_type %in% c("DUP","DEL"),]

You can then calculate the CNV frequency from this cohort comprised of these samples. The output is stored in “pgxfreq” format:

segfreq <- segtoFreq(segdata,cohort_name="c1")
segfreq
#> GRangesList object of length 1:
#> $c1
#> GRanges object with 3106 ranges and 2 metadata columns:
#>          seqnames            ranges strand | gain_frequency loss_frequency
#>             <Rle>         <IRanges>  <Rle> |      <numeric>      <numeric>
#>      [1]        1          0-400000      * |              0         0.0000
#>      [2]        1    400000-1400000      * |              0         0.0000
#>      [3]        1   1400000-2400000      * |              0         0.0000
#>      [4]        1   2400000-3400000      * |              0         0.0000
#>      [5]        1   3400000-4400000      * |              0        33.3333
#>      ...      ...               ...    ... .            ...            ...
#>   [3102]        Y 52400000-53400000      * |              0              0
#>   [3103]        Y 53400000-54400000      * |              0              0
#>   [3104]        Y 54400000-55400000      * |              0              0
#>   [3105]        Y 55400000-56400000      * |              0              0
#>   [3106]        Y 56400000-57227415      * |              0              0
#>   -------
#>   seqinfo: 24 sequences from an unspecified genome; no seqlengths

4 Visualization of CNV frequency data using ‘pgxfreq’ format

4.1 pgxFreqplot function

This function provides CNV frequency plots by genome or chromosomes as you request.

The parameters of this function:

  • data: frequency object returned by pgxLoader function.
  • chrom: a vector with chromosomes to be plotted. If NULL, return the plot by genome. If specified the frequencies are plotted with one panel for each chromosome. Default is NULL.
  • layout: number of columns and rows in plot. Only used in plot by chromosome. Default is c(1,1).
  • filters: Index or string value to indicate which filter to be plotted. The length of filters is limited to one if the parameter circos is False. Default is the first filter.
  • circos: a logical value to indicate if return a circos plot. If TRUE, it can return a circos plot with multiple group ids for display and comparison. Default is FALSE.
  • highlight: Indices of genomic bins to be highlighted with red color.
  • assembly: A string specifying which genome assembly version should be applied to CNV frequency plotting. Allowed options are “hg19”, “hg38”. Default is “hg38” (genome version used in Progenetix).

4.2 CNV frequency plot by genome

4.2.1 Input is pgxfreq object.

pgxFreqplot(freq_pgxfreq, filters="pgx:icdom-85003")

4.2.2 Input is pgxmatrix object.

pgxFreqplot(freq_pgxmatrix, filters = "NCIT:C3512")

4.3 CNV frequency plot by chromosomes

pgxFreqplot(freq_pgxfreq, filters='NCIT:C4038',chrom=c(1,2,3), layout = c(3,1))