From 56d1678137ed34626064dc811314083174fc1360 Mon Sep 17 00:00:00 2001 From: noriakis Date: Fri, 21 Jun 2024 14:13:26 +0900 Subject: [PATCH] combineSeqs --- R/combineSeqs.R | 14 ++++++++------ man/combineSeqs.Rd | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/R/combineSeqs.R b/R/combineSeqs.R index fc2e885..4b35600 100644 --- a/R/combineSeqs.R +++ b/R/combineSeqs.R @@ -7,15 +7,17 @@ #' @param species species ID #' @param argList args to passed to consensusSeq #' @param output_seq output just the sequence -#' @param minor_align minor allele alignment +#' @param align major and minor allele alignment #' @export #' @return new stana object combineSeqs <- function(stana_list, species, argList=list(), output_seq=FALSE, - minor_align=FALSE) { + align=FALSE) { if (!is.list(stana_list)) {stop("Please provide list of stana object")} each_ID <- lapply(stana_list, function(x) { - if (minor_align) { - ids <- paste0(row.names(x@snpsInfo[[species]]), ":minor", x@snpsInfo[[species]]$minor_allele) + if (align) { + ids <- paste0(row.names(x@snpsInfo[[species]]), + ":major", x@snpsInfo[[species]]$major_allele, + ":minor", x@snpsInfo[[species]]$minor_allele) } else { ids <- x@snpsInfo[[species]] |> row.names() } @@ -26,8 +28,8 @@ combineSeqs <- function(stana_list, species, argList=list(), output_seq=FALSE, qqcat("Common SNVs: @{length(intersected)}\n") argList[["return_mat"]] <- TRUE - if (minor_align) { - intersected <- strsplit(intersected, ":minor") %>% lapply("[", 1) %>% unlist() + if (align) { + intersected <- strsplit(intersected, ":major") %>% lapply("[", 1) %>% unlist() } argList[["site_list"]] <- intersected diff --git a/man/combineSeqs.Rd b/man/combineSeqs.Rd index 8d2ae37..3f285c0 100644 --- a/man/combineSeqs.Rd +++ b/man/combineSeqs.Rd @@ -9,7 +9,7 @@ combineSeqs( species, argList = list(), output_seq = FALSE, - minor_align = FALSE + align = FALSE ) } \arguments{ @@ -21,7 +21,7 @@ combineSeqs( \item{output_seq}{output just the sequence} -\item{minor_align}{minor allele alignment} +\item{align}{major and minor allele alignment} } \value{ new stana object