Install from CRAN:
install.packages("topr")
Or from github:
devtools::install_github("GenuityScience/topr")
And then load the package:
See the Input datasets vignette for more detailed information.
Input datasets must include least three columns (CHROM, POS
and P
), where naming of the columns is flexible (i.e the chr label can be either chr or chrom and is case insensitive).
topr has 3 in-built datasets (GWASes), take a look at one of them by issuing the following command:
head(CD_UKBB)
The chromosome in the CHROM
column can be represented with our without the chr suffix, e.g (chr1 or 1)
topr’s two main plotting functions are manhattan()
and regionplot()
See the Manhattan vignette for more detailed examples of how to use the manhattan plot function
View the whole genome association results on a Manhattan plot:
manhattan(CD_UKBB)
Annotate the lead/index variants (with p-values below 5e-09) with their nearest gene:
manhattan(CD_UKBB, annotate=5e-09)
Display genes of interest at the bottom of the Manhattan plot to get a visual representation of their position relative to association peaks:
View one chromosome only:
manhattan(CD_UKBB, annotate=5e-09, chr="chr1")
Create a Manhattan of multiple GWAS results (in a list) on the same plot
Use the ntop
argument to control how many GWASes are displayed at the top and bottom of the plot:
manhattan(list(UC_UKBB, CD_UKBB,CD_FINNGEN), legend_labels=c("UC UKBB", "CD UKBB","CD FINNGEN"), ntop=1)
See the Regionplot vignette for more detailed examples of how to use the regionplot function.
Further zoom-in on a genetic region by gene name:
regionplot(CD_UKBB, gene="IL23R")
Label the top variant with it´s ID (rsid):
regionplot(CD_UKBB, gene="IL23R", annotate=5e-09)
Denser labelling of top variants (every 100000 kb) with vlines to get a better visual of where the variants are in relation to the genes and exons shown below:
regionplot(CD_UKBB, gene="IL23R", annotate_with_vline=5e-09, region_size=100000)
View the correlation pattern between the variants within the region in a locuszoom like plot. Note that the variant correlation (R2) has to be pre-calculated and included in the input dataframe.
locuszoom(R2_CD_UKBB, gene="IL23R")
A region plot of multiple GWASes zoomed in on the IL23R gene
regionplot(list(UC_UKBB, CD_UKBB))
Extract lead/index variants from the GWAS dataset (CD_UKBB
):
get_best_snp_per_MB(CD_UKBB)
Annotate the lead/index variants with their nearest gene:
get_best_snp_per_MB(CD_UKBB) %>% annotate_with_nearest_gene()
Get genomic coordinates for a gene:
get_gene(gene_name="IL23R")
Get snps within a region:
get_snps_within_region(CD_UKBB, region = "chr1:67138906-67259979")
Get the top variant on a chromosome:
get_top_snp(CD_UKBB, chr="chr1")
?manhattan()
?regionplot()
?locuszoom()