Skip to content

Commit

Permalink
Merge pull request #26 from nanxstats/fail-pwa-early
Browse files Browse the repository at this point in the history
Resolve `pairwiseAlignment()` early and consistently
  • Loading branch information
nanxstats committed Aug 31, 2024
2 parents 74037b5 + 6c076f0 commit 21370ac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/704-calcProtSeqSim.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.calcSeqPairSim = function(
twoid, protlist = protlist, type = type, submat = submat) {
pwa = resolve_pwa()

id1 = twoid[1]
id2 = twoid[2]
Expand All @@ -10,7 +11,6 @@

} else {

pwa = resolve_pwa()
s1 = try(Biostrings::AAString(protlist[[id1]]), silent = TRUE)
s2 = try(Biostrings::AAString(protlist[[id2]]), silent = TRUE)
s12 = try(pwa(s1, s2, type = type, substitutionMatrix = submat, scoreOnly = TRUE), silent = TRUE)
Expand Down Expand Up @@ -77,6 +77,7 @@

calcParProtSeqSim = function(
protlist, cores = 2, type = 'local', submat = 'BLOSUM62') {
invisible(resolve_pwa())

doParallel::registerDoParallel(cores)

Expand Down Expand Up @@ -140,11 +141,11 @@ calcParProtSeqSim = function(

calcTwoProtSeqSim = function(
seq1, seq2, type = 'local', submat = 'BLOSUM62') {
pwa = resolve_pwa()

# sequence alignment for two protein sequences
s1 = try(Biostrings::AAString(seq1), silent = TRUE)
s2 = try(Biostrings::AAString(seq2), silent = TRUE)
pwa = resolve_pwa()
s12 = try(pwa(s1, s2, type = type, substitutionMatrix = submat), silent = TRUE)

return(s12)
Expand Down

0 comments on commit 21370ac

Please sign in to comment.