Learn R Programming

geneNR (version 2.0.1)

plot_summariseSNP: Plot SNP Distribution Across Chromosomes

Description

Creates a bar chart representing the distribution of SNPs across chromosomes. Allows customization of bar color, label size, and label color. Saves the plot to a user-specified directory or a temporary directory.

Usage

plot_summariseSNP(
  snp_distribution,
  file_name = "snp_bar_chart.jpeg",
  output_dir = tempdir(),
  bar_color = "lightblue",
  label_size = 3,
  label_color = "black"
)

Value

A ggplot object for the created bar chart.

Arguments

snp_distribution

A data frame with columns Chr and SNP_Count.

file_name

The name of the file to save the plot (default: "snp_bar_chart.jpeg").

output_dir

The directory to save the file (default: tempdir()).

bar_color

The color of the bars (default: "lightblue").

label_size

The size of the text labels on the bars (default: 3).

label_color

The color of the text labels on the bars (default: "black").

Examples

Run this code
# \donttest{
demo_SNP <- system.file("extdata", "demo_SNP.hmp.txt", package = "geneNR")
data <- import_hmp(demo_SNP)
snp_distribution <- summariseSNP(data)
plot <- plot_summariseSNP(snp_distribution, bar_color = "skyblue",
label_size = 3, label_color = "red")
print(plot)
# }

Run the code above in your browser using DataLab