diff --git a/R/plot_progeny_dosage_change.R b/R/plot_progeny_dosage_change.R index 24b21910..fcefeb5e 100644 --- a/R/plot_progeny_dosage_change.R +++ b/R/plot_progeny_dosage_change.R @@ -11,13 +11,14 @@ #' #' @param error error rate used in global error in the `calc_genoprob_error()` #' @param verbose T or F for `calc_genoprob_error()` and `calc_homologprob()` -#' +#' @param output_corrected TRUE or FALSE, if F only the ggplot of the changed dosage is printed, if T then a new corrected dosage matrix is output. #' #' @return A ggplot of the changed and imputed genotypic dosages #' #' @examples -#' x<-get_submap(solcap.err.map[[1]], 1:30, reestimate.rf = FALSE) -#' plot_progeny_dosage_change(list(x), error=0.05) +#' x <- get_submap(solcap.err.map[[1]], 1:30, reestimate.rf = FALSE) # subset to run fast in tests +#' plot_progeny_dosage_change(list(x), error=0.05, output_corrected=F) # no new corrected dosages +#' corrected_matrix <- plot_progeny_dosage_change(list(x), error=0.05, output_corrected=F) #output corrected #' #' @author Jeekin Lau, \email{jzl0026@tamu.edu}, with optimization by Cristiane Taniguti, \email{chtaniguti@tamu.edu} #' @@ -25,7 +26,7 @@ #' @import reshape2 #' @export plot_progeny_dosage_change -plot_progeny_dosage_change <- function(map_list, error, verbose=T){ +plot_progeny_dosage_change <- function(map_list, error, verbose=T, output_corrected=F){ Var1 <- Var2 <- value <- NULL map=map_list if(!exists(map[[1]]$info$data.name)) stop("mappoly.data object not here") @@ -175,8 +176,17 @@ plot_progeny_dosage_change <- function(map_list, error, verbose=T){ guides(fill=guide_legend(title="Dosage change")) print("done") - return(plot1) - + print(plot1) + if (output_corrected ==T){ + mrk_names=rownames(finished) + mrk_index=which(dat$mrk.names%in%mrk_names) + P1 = dat$dosage.p1[mrk_index] + P2 = dat$dosage.p2[mrk_index] + sequence = dat$chrom[mrk_index] + sequence_position = dat$genome.pos[mrk_index] + + hmm_imputed = cbind(P1,P2,sequence,sequence_position, finished) + return(hmm_imputed)} } diff --git a/man/plot_progeny_dosage_change.Rd b/man/plot_progeny_dosage_change.Rd index 03666482..710b8d0f 100644 --- a/man/plot_progeny_dosage_change.Rd +++ b/man/plot_progeny_dosage_change.Rd @@ -4,7 +4,7 @@ \alias{plot_progeny_dosage_change} \title{Look at genotypes that were imputed or changed by the HMM chain given a level of global genotypic error} \usage{ -plot_progeny_dosage_change(map_list, error, verbose = T) +plot_progeny_dosage_change(map_list, error, verbose = T, output_corrected = F) } \arguments{ \item{map_list}{a list of multiple \code{mappoly.map.list}} @@ -12,6 +12,8 @@ plot_progeny_dosage_change(map_list, error, verbose = T) \item{error}{error rate used in global error in the `calc_genoprob_error()`} \item{verbose}{T or F for `calc_genoprob_error()` and `calc_homologprob()`} + +\item{output_corrected}{TRUE or FALSE, if F only the ggplot of the changed dosage is printed, if T then a new corrected dosage matrix is output.} } \value{ A ggplot of the changed and imputed genotypic dosages @@ -25,8 +27,9 @@ Most recent update 8/29/2023: -un-hardcoded linkage groups in maps. previously hard-coded for tetraploid rose. } \examples{ - x<-get_submap(solcap.err.map[[1]], 1:30, reestimate.rf = FALSE) - plot_progeny_dosage_change(list(x), error=0.05) + x <- get_submap(solcap.err.map[[1]], 1:30, reestimate.rf = FALSE) # subset to run fast in tests + plot_progeny_dosage_change(list(x), error=0.05, output_corrected=F) # no new corrected dosages + corrected_matrix <- plot_progeny_dosage_change(list(x), error=0.05, output_corrected=F) #output corrected } \author{ diff --git a/man/split_and_rephase.Rd b/man/split_and_rephase.Rd index d45e6731..e97fd16a 100644 --- a/man/split_and_rephase.Rd +++ b/man/split_and_rephase.Rd @@ -10,6 +10,9 @@ split_and_rephase( gap.threshold = 5, size.rem.cluster = 1, phase.config = "best", + thres.twopt = 3, + thres.hmm = "best", + tol.merge = 0.001, tol.final = 0.001, verbose = TRUE ) @@ -32,6 +35,18 @@ value is 1} \item{phase.config}{which phase configuration should be used. "best" (default) will choose the maximum likelihood phase configuration} +\item{thres.twopt}{the threshold used to determine if the linkage +phases compared via two-point analysis should be considered +for the search space reduction (default = 3)} + +\item{thres.hmm}{the threshold used to determine which linkage +phase configurations should be returned when merging two maps. +If "best" (default), returns only the best linkage phase +configuration. NOTE: if merging multiple maps, it always uses +the "best" linkage phase configuration at each block insertion.} + +\item{tol.merge}{the desired accuracy for merging maps (default = 10e-04)} + \item{tol.final}{the desired accuracy for the final map (default = 10e-04)} \item{verbose}{if \code{TRUE} (default), the current progress is shown; if diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 7e21fe7e..bf307dcc 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -59,22 +59,22 @@ BEGIN_RCPP END_RCPP } -RcppExport SEXP calc_genoprob(void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP calc_genoprob_prior(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP calc_genprob_haplo(void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP calc_genprob_haplo_highprec(void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP calc_genprob_single_parent(void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP est_haplotype_map(void *, void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP est_haplotype_map_highprec(void *, void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP est_hmm_map_single_parent(void *, void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP est_map_hmm(void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP est_map_hmm_highprec(void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP get_counts_single_parent_cpp(void *, void *, void *, void *, void *, void *); -RcppExport SEXP loglike_hmm(void *, void *, void *, void *, void *, void *); -RcppExport SEXP pairwise_rf_estimation_disc(void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP pairwise_rf_estimation_disc_rcpp(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP pairwise_rf_estimation_prob(void *, void *, void *, void *, void *, void *, void *, void *); -RcppExport SEXP poly_hmm_est_CPP(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *); +RcppExport SEXP calc_genoprob(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP calc_genoprob_prior(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP calc_genprob_haplo(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP calc_genprob_haplo_highprec(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP calc_genprob_single_parent(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP est_haplotype_map(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP est_haplotype_map_highprec(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP est_hmm_map_single_parent(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP est_map_hmm(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP est_map_hmm_highprec(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP get_counts_single_parent_cpp(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP loglike_hmm(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP pairwise_rf_estimation_disc(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP pairwise_rf_estimation_disc_rcpp(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP pairwise_rf_estimation_prob(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +RcppExport SEXP poly_hmm_est_CPP(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); static const R_CallMethodDef CallEntries[] = { {"_mappoly_vcf_get_probabilities", (DL_FUNC) &_mappoly_vcf_get_probabilities, 2},