-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from jeekinlau/main
update plot_progeny_dosage_change
- Loading branch information
Showing
4 changed files
with
53 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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") | ||
|
@@ -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)} | ||
} | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters