Create a Region Plot with Genetic Data and Recombination Rates
gg_regionplot.RdThis function generates a region plot with genetic data for a given chromosome and position range, and overlays it with recombination rates. Significant genetic variants are highlighted with labels, and a gene plot is included below the main plot.
Usage
gg_regionplot(
df,
rsid,
chrom,
pos,
p_value,
label = NULL,
labels = TRUE,
trait = NULL,
plot_pvalue_threshold = 0.1,
genome_build = "GRCh38",
population = "EUR",
plot_title = NULL,
plot_subtitle = NULL
)Arguments
- df
A data frame containing genetic data. It must include the following columns:
SNP: SNP identifier (rsid).CHR: Chromosome number.pos: Position of the SNP (e.g., in base pairs).EA: Effect allele (ref).OA: Other allele (alt).phenotype: The trait or phenotype associated with the SNP.p_value: P-value for the association.
- rsid
A character vector of SNP identifiers to label on the plot.
- chrom
The chromosome number to be used for plotting.
- pos
The column name that contains the SNP positions.
- p_value
The column name containing the p-values for each SNP.
- label
A character vector of SNPs to label on the plot. Default is
NULL.- labels
Logical for whether to show text labels for
labelSNPs- trait
The trait associated with the SNP. Default is
NULL.- plot_pvalue_threshold
The p-value threshold for plotting. SNPs with p-values greater than this threshold are excluded from the plot. Default is
0.1.- genome_build
The genome build used for the data (e.g., "GRCh38"). Default is
"GRCh38".- population
The population for which the data was analyzed. Default is
"EUR".- plot_title
The title of the plot. Default is
NULL.- plot_subtitle
The subtitle of the plot. Default is
NULL.