Skip to content

Commit

Permalink
combineSeqs
Browse files Browse the repository at this point in the history
  • Loading branch information
noriakis committed Jun 21, 2024
1 parent 615e880 commit 56d1678
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions R/combineSeqs.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions man/combineSeqs.Rd

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

0 comments on commit 56d1678

Please sign in to comment.