0

我想取两个字符串(DNA 序列)并生成一个对齐分数。我找到了 DECIPHER 包,但它只让我生成对齐,而不是对齐分数。我也尝试使用“Biostrings”,但我无法生成分数。

谢谢你的帮助!

string1 <- "ACAGT"
string2 <- "CCAGTA"

我正在寻找这样的东西

t <- FunctionThatWouldReturnAlignmentScore(string1, string2)
print(t) # this returns 2
4

1 回答 1

2

In Biostrings I did

> aln = pairwiseAlignment(pattern = c("succeed", "precede"), subject = "supersede")
> aln
Global PairwiseAlignmentsSingleSubject (1 of 2)
pattern: succ--eed
subject: supersede
score: -33.99738
> score(aln)
[1] -33.99738 -25.11710

by following the vignette on pairwise sequence alignment linked from the page above.

I also discovered

> dist = stringDist(DNAStringSet(c(string1, string2)))
> methods(class=class(dist))
[1] as.matrix   coerce      format      initialize  labels      print
[7] show        slotsFromS3
see '?methods' for accessing help and source code
> as.matrix(dist)
  1 2
1 0 2
2 2 0
于 2019-08-30T13:45:18.173 回答