Learn R Programming

comorbidPGS

comorbidPGS is a tool for analysing an already computed Polygenic Score (PGS, also named PRS/GRS for binary outcomes) distribution to investigate shared genetic aetiology in multiple conditions.

comorbidPGS is under GPL-3 license, and is freely available for download.

Prerequisite

  • R version 3.5 or higher with the following packages:
    • stats
    • utils
    • ggplot2

Installation

You can install the development version of comorbidPGS from GitHub with:

# install.packages("devtools")
devtools::install_github("VP-biostat/comorbidPGS")

Example

Building an Association Table

This is a basic example which shows you how to do basic association with the example dataset:

library(comorbidPGS)
#> 
#> Attachement du package : 'comorbidPGS'
#> L'objet suivant est masqué depuis 'package:graphics':
#> 
#>     assocplot

# use the demo dataset
dataset <- comorbidData
# NOTE: The dataset must have at least 3 different columns:
# - an ID column (the first one)
# - a PGS column (must be numeric, by default it is the column named "SCORESUM" or the second column if "SCORESUM" is not present)
# - a Phenotype column, can be factors, numbers or characters

# do an association of one PGS with one Phenotype
result_1 <- assoc(dataset, prs_col = "t2d_PGS", phenotype_col = "t2d")
PGSPhenotypePhenotype_typeStatistical_methodCovarN_casesN_controlsNEffectSElower_CIupper_CIP_value
t2d_PGSt2dCases/ControlsBinary logistic regressionNA7309270100001.688258NA1.5618211.8249310
# do multiple associations
assoc <- expand.grid(c("t2d_PGS", "ldl_PGS"), c("ethnicity","brc","t2d","log_ldl","sbp_cat"))
result_2 <- multiassoc(df = dataset, assoc_table = assoc, covar = c("age", "sex", "gen_array"))
#> Warning in phenotype_type(df = df, phenotype_col = phenotype_col): Phenotype
#> column log_ldl is continuous and not normal, please normalise prior association

#> Warning in phenotype_type(df = df, phenotype_col = phenotype_col): Phenotype
#> column log_ldl is continuous and not normal, please normalise prior association
PGSPhenotypePhenotype_typeStatistical_methodCovarN_casesN_controlsNEffectSElower_CIupper_CIP_value
2t2d_PGSethnicity 1 ~ 2CategoricalMultinomial logistic regressionage+sex+gen_array2142638185230.9814174NA0.93451501.03067390.4528020
3t2d_PGSethnicity 1 ~ 3CategoricalMultinomial logistic regressionage+sex+gen_array1205638175861.0178971NA0.95709311.08256400.5724292
4t2d_PGSethnicity 1 ~ 4CategoricalMultinomial logistic regressionage+sex+gen_array272638166530.9434640NA0.83559801.06525420.3474694
21ldl_PGSethnicity 1 ~ 2CategoricalMultinomial logistic regressionage+sex+gen_array2142638185230.9925623NA0.94516781.04233340.7648927
31ldl_PGSethnicity 1 ~ 3CategoricalMultinomial logistic regressionage+sex+gen_array1205638175861.0083869NA0.94812151.07248300.7905175
41ldl_PGSethnicity 1 ~ 4CategoricalMultinomial logistic regressionage+sex+gen_array272638166530.9760204NA0.86472261.10164330.6943783
1t2d_PGSbrcCases/ControlsBinary logistic regressionage+sex+gen_array402504154431.0061678NA0.90875431.11402350.9057882
11ldl_PGSbrcCases/ControlsBinary logistic regressionage+sex+gen_array402504154431.1037106NA0.99563701.22351530.0605407
12t2d_PGSt2dCases/ControlsBinary logistic regressionage+sex+gen_array7309270100001.7359738NA1.60298671.87999380.0000000
13ldl_PGSt2dCases/ControlsBinary logistic regressionage+sex+gen_array7309270100000.9823272NA0.91024111.06012230.6465580
14t2d_PGSlog_ldlContinuousLinear regressionage+sex+gen_arrayNANA100000.00599610.00227470.00153780.01045440.0084010
15ldl_PGSlog_ldlContinuousLinear regressionage+sex+gen_arrayNANA100000.08285450.00211830.07870270.08700640.0000000
16t2d_PGSsbp_catOrdered CategoricalOrdinal logistic regressionage+sex+gen_arrayNANA100001.0628744NA1.02360441.10365090.0015002
17ldl_PGSsbp_catOrdered CategoricalOrdinal logistic regressionage+sex+gen_arrayNANA100001.0078855NA0.97073301.04645980.6818849

Examples of plot

densityplot(dataset, prs_col = "ldl_PGS", phenotype_col = "sbp_cat")
# show multiple associations in a plot
assoplot <- assocplot(score_table = result_2)
assoplot$continuous_phenotype
assoplot$discrete_phenotype

NOTE: The score_table should have the assoc() output format

centileplot(dataset, prs_col = "brc_PGS", phenotype_col = "brc")
#> Warning in centileplot(dataset, prs_col = "brc_PGS", phenotype_col = "brc"):
#> The dataset has less than 10,000 individuals, centiles plot may not look good!
#> Use the argument decile = T to adapt to small datasets

As those graphical functions use ggplot2, you can fully customize your plot:

library(ggplot2)
centileplot(dataset, prs_col = "t2d_PGS", phenotype_col = "t2d") + 
  scale_color_gradient(low = "green", high = "red")
decileboxplot(dataset, prs_col = "ldl_PGS", phenotype_col = "ldl")

Citation

If you use comorbidPGS in any published work, please cite the following manuscript:

Copy Link

Version

Install

install.packages('comorbidPGS')

Monthly Downloads

185

Version

0.3.4

License

GPL (>= 3)

Maintainer

Vincent Pascat

Last Published

April 30th, 2024

Functions in comorbidPGS (0.3.4)

comorbidData

Mock dataset for comorbidPGS package
assoc

Association of a PGS distribution with a Phenotype
densityplot

Density Plot from a PGS Association
centileplot

Centiles Plot from a PGS Association
multiassoc

Multiple PGS Associations from a Data Frame
assocplot

Multiple PGS Associations Plot
decileboxplot

Deciles BoxPlot from a PGS Association with a Continuous Phenotype
multiphenassoc

Multiple PGS Associations from different Phenotypes