Skip to content

Commit

Permalink
Update polyRAD models
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-sandercock committed Feb 6, 2025
1 parent cb2dc31 commit de129cb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
4 changes: 2 additions & 2 deletions R/DosageCall_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @importFrom vcfR read.vcfR is.biallelic write.vcf
#' @importFrom R.utils gunzip
#'
polyRAD_dosage_call <- function(vcf, ploidy, model, p1 = NULL, p2 = NULL, backcross.gen = 0, intercross.gen = 0, selfing.gen = 0, session) {
polyRAD_dosage_call <- function(vcf, ploidy, model, p1 = NULL, p2 = NULL, backcross.gen = 0, intercross.gen = 0, selfing.gen = 0, contamRate = 0.001, session) {

# Variables
vcf_path <- vcf
Expand Down Expand Up @@ -40,7 +40,7 @@ polyRAD_dosage_call <- function(vcf, ploidy, model, p1 = NULL, p2 = NULL, backcr
min.ind.with.reads = 1,
min.ind.with.minor.allele = 0,
taxaPloidy = ploidy,
contamRate = 0.001,
contamRate = contamRate,
phaseSNPs = FALSE

)
Expand Down
31 changes: 27 additions & 4 deletions R/mod_DosageCall.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,37 @@ mod_DosageCall_ui <- function(id){
ns = ns,
textInput(ns("output_name"), "Output File Name"),
numericInput(ns("ploidy"), "Species Ploidy", min = 1, value = NULL),
selectInput(ns("polyRAD_model"), "polyRAD Model", choices = c("IterateHWE","Iterate_LD","IteratePopStruct","IteratePopStruct_LD","PipelineMapping2Parents"), selected = "IterateHWE"),
#selectInput(ns("polyRAD_model"), "polyRAD Model", choices = c("IterateHWE","Iterate_LD","IteratePopStruct","IteratePopStruct_LD","PipelineMapping2Parents"), selected = "IterateHWE"),
selectInput(ns("polyRAD_model"), "polyRAD Model", choices = c("IterateHWE","IteratePopStruct","PipelineMapping2Parents"), selected = "IterateHWE"),
conditionalPanel(
condition = "input.polyRAD_model == 'PipelineMapping2Parents'",
ns = ns,
tags$div(
style = "padding-left: 20px;", # Add padding/indentation
textInput(
inputId = ns("parent1"),
label = "Enter parent1 ID:",
label = "Donor Parent ID:",
value = NULL
),
textInput(
inputId = ns("parent2"),
label = "Enter parent2 ID:",
label = "Recurrent Parent ID:",
value = NULL
),
numericInput(
inputId = ns("bx.gen"),
label = "No. of Backcross Generations:",
value = 0
),
numericInput(
inputId = ns("inter.gen"),
label = "No. of Intermating Generations:",
value = 0
),
numericInput(
inputId = ns("self.gen"),
label = "No. of Selfing Geneerations:",
value = 0
)
)
)
Expand Down Expand Up @@ -439,7 +455,14 @@ mod_DosageCall_server <- function(input, output, session, parent_session){
} else {
# PolyRAD
updateProgressBar(session = session, id = "pb_madc", value = 35, title = "Performing Dosage Calling")
polyrad_items <- polyRAD_dosage_call(vcf = input$madc_file$datapath, ploidy = input$ploidy, model = input$polyRAD_model)
polyrad_items <- polyRAD_dosage_call(vcf = input$madc_file$datapath,
ploidy = input$ploidy,
model = input$polyRAD_model,
p1 = input$parent1,
p2 = input$parent2,
backcross.gen = input$bx.gen,
intercross.gen = input$inter.gen,
selfing.gen = input$self.gen)
updateProgressBar(session = session, id = "pb_madc", value = 100, title = "Finished")
polyrad_items
}
Expand Down

0 comments on commit de129cb

Please sign in to comment.