Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Imports:
foreach,
Rcpp (>= 0.11.3),
Biostrings (>= 2.52.0),
pwalign (>= 1.6.0),
RSQLite (>= 0.11.4),
stringr (>= 0.6.2),
IRanges,
Expand Down
18 changes: 9 additions & 9 deletions R/pairwise_aln.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#' @author Sarah Scharfenberg and Hajk-Georg Drost
#' @details This function provides an interface between R and common pairwise alignment computation methods.
#'
#' The current version of this function computes pairwise alignments based on the \code{\link[Biostrings]{pairwiseAlignment}}
#' function implemented in the \pkg{Biostrings} package.
#' The current version of this function computes pairwise alignments based on the \code{\link[pwalign]{pairwiseAlignment}}
#' function implemented in the \pkg{pwalign} package.
#'
#' The default pairwise alignment method is based on the \emph{Needleman-Wunsch Algorithm}.
#'
Expand Down Expand Up @@ -85,7 +85,7 @@ pairwise_aln <- function(file,
)
}

# Needleman-Wunsch using Biostrings::pairwiseAlignment( type=global)
# Needleman-Wunsch using pwalign::pairwiseAlignment( type=global)
if (tool == "NW") {
#read file
if (is.element(seq_type, c("dna", "cds"))) {
Expand Down Expand Up @@ -122,25 +122,25 @@ pairwise_aln <- function(file,

# align
aln <-
Biostrings::pairwiseAlignment(pattern = seqs[[1]],
subject = seqs[[2]],
type = "global")
pwalign::pairwiseAlignment(pattern = seqs[[1]],
subject = seqs[[2]],
type = "global")

#write file -> comment Hajk: what does pattern() and subject() do in pattern(aln), subject(aln) ?
# pattern(aln) == get aligned sequence that was set as pattern input
# subject(aln) == get aligned sequence that was set as subject input
seqinr::write.fasta(
sequences = list(Biostrings::pattern(aln), IRanges::subject(aln)),
sequences = list(pwalign::pattern(aln), pwalign::subject(aln)),
names = names,
file.out = file.out
)

if (store_locally) {
local_store_path <- file.path("orthologr_alignment_files", "_pairwise_alignment_with_score")
Biostrings::writePairwiseAlignments(aln, file.path(local_store_path, paste0(pairwise_aln_name, "_", tool, "_", seqtype, ".aln")))
pwalign::writePairwiseAlignments(aln, file.path(local_store_path, paste0(pairwise_aln_name, "_", tool, "_", seqtype, ".aln")))
} else {
local_store_path <- file.path(tempdir(), "_pairwise_alignment_with_score")
Biostrings::writePairwiseAlignments(aln, file.path(local_store_path, paste0(pairwise_aln_name, "_", tool, "_", seqtype, ".aln")))
pwalign::writePairwiseAlignments(aln, file.path(local_store_path, paste0(pairwise_aln_name, "_", tool, "_", seqtype, ".aln")))
}

if (!quiet) {
Expand Down