## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  echo = TRUE
)


## ----local_workflow, eval=TRUE------------------------------------------------
library(geneNR)

gff_path <- system.file("extdata", "sample_crop.gff3", package = "geneNR")

# Execute local mapping on sample datasets using the integrated reference sheet
local_results <- geneSNP(
  data_file     = "sample_data_wheat",
  upstream      = 50000,
  downstream    = 50000,
  genome_source = "local",
  gff3_file     = gff_path
)

# Display extracted candidate data matrix output lines
print(utils::head(local_results))


## ----custom_workflow, eval=TRUE-----------------------------------------------
gff_path <- system.file("extdata", "sample_crop.gff3", package = "geneNR")

# Process dynamic uneven interval segments using the offline template pipeline
custom_range_results <- geneSNPcustom(
  data_file     = "sample_data_wheat_custom",
  crop          = "wheat",
  genome_source = "local",
  gff3_file     = gff_path
)

print(utils::head(custom_range_results))


## ----summaries, eval=TRUE-----------------------------------------------------
# Import a sample HapMap tracking dataset
demo_hmp <- system.file("extdata", "demo_SNP.hmp.txt", package = "geneNR")
imported_data <- import_hmp(demo_hmp)

# Summarize variant distributions across chromosomes
snp_summary <- summariseSNP(imported_data)
print(snp_summary)


## ----plot_SNP, eval=TRUE, fig.height=5, fig.width=10--------------------------
# Load internal mock layout references
chr_details <- read.csv(system.file("extdata", "chromosome_details.csv", package = "geneNR"))
snp_locations <- read.csv(system.file("extdata", "identified_SNP.csv", package = "geneNR"))

# Generate the physical density model distribution map
snp_map <- plot_SNP(
  chromosome_details = chr_details, 
  data               = snp_locations,  
  chromosome_color   = "steelblue",  
  title              = "Chromosome map with SNPs", 
  label_color        = "black"
)

# Render the plot layout
print(snp_map)


## ----plot_summarise, eval=TRUE, fig.height=5, fig.width=7---------------------
# Generate a summary metric visualization chart
summary_chart <- plot_summariseSNP(
  snp_summary, 
  bar_color   = "skyblue",
  label_size  = 3, 
  label_color = "red"
)

# Render the layout chart
print(summary_chart)


