Skip to contents

Classify genetic association signals as cis or trans relative to the gene encoding the target protein.

Usage

cis.vs.trans.classification(
  hits,
  panel,
  id = "uniprot",
  radius = 1e+06,
  verbose = TRUE
)

Arguments

hits

Data frame of association signals containing at least:

  • identifier column (specified by id)

  • chromosome column Chr

  • position column bp

panel

Annotation data frame containing:

  • uniprot (or other id column)

  • gene, chr, start, end

id

Join key (default: "uniprot").

radius

Cis window size in base pairs (default: 1e6).

verbose

Logical; print summary if TRUE.

Value

A list containing:

  • data: annotated data frame with cis/trans classification

    • p.gene, p.chr, p.start, p.end

    • cis (logical)

    • cis.trans ("cis" / "trans")

    • cis.start, cis.end

  • table: gene × cis/trans contingency table

  • total: named vector of total cis and trans counts

Details

A variant is classified as cis if it lies on the same chromosome as the gene and within a specified window around the gene boundaries.

Examples

#----------------------------------------------------------
# minimal reproducible example
#----------------------------------------------------------

hits <- data.frame(
  uniprot = c("P1", "P2", "P3", "P1"),
  Chr = c("1", "1", "2", "1"),
  bp = c(100000, 2000000, 500000, 105000)
)

panel <- data.frame(
  uniprot = c("P1", "P2", "P3"),
  gene = c("G1", "G2", "G3"),
  chr = c("1", "1", "2"),
  start = c(90000, 1500000, 400000),
  end = c(110000, 2500000, 600000)
)

ct <- cis.vs.trans.classification(hits, panel)
#> 
#> Cis/trans classification
#> ------------------------
#> Variants : 4 
#> Proteins : 3 
#> 
#> 
#> cis 
#>   4 
#> 

ct$total
#> 
#> cis 
#>   4 
head(ct$data)
#>   uniprot Chr      bp p.gene p.chr p.start   p.end cis.start cis.end  cis
#> 1      P1   1  100000     G1     1   90000  110000     0e+00 1110000 TRUE
#> 2      P1   1  105000     G1     1   90000  110000     0e+00 1110000 TRUE
#> 3      P2   1 2000000     G2     1 1500000 2500000     5e+05 3500000 TRUE
#> 4      P3   2  500000     G3     2  400000  600000     0e+00 1600000 TRUE
#>   cis.trans
#> 1       cis
#> 2       cis
#> 3       cis
#> 4       cis
with(ct$data, table(p.gene, cis.trans))
#>       cis.trans
#> p.gene cis
#>     G1   2
#>     G2   1
#>     G3   1