Skip to content

Commit

Permalink
Merge pull request #68 from jeekinlau/main
Browse files Browse the repository at this point in the history
update plot_progeny_dosage_change
  • Loading branch information
mmollina authored Nov 24, 2023
2 parents 7326e9d + b7f8890 commit 1ddbf87
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 25 deletions.
22 changes: 16 additions & 6 deletions R/plot_progeny_dosage_change.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@
#'
#' @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{[email protected]}, with optimization by Cristiane Taniguti, \email{[email protected]}
#'
#' @import ggplot2
#' @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")
Expand Down Expand Up @@ -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)}
}


9 changes: 6 additions & 3 deletions man/plot_progeny_dosage_change.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions man/split_and_rephase.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit 1ddbf87

Please sign in to comment.