擅长:python、mysql、java
<p>使用生物疗法和裸体:</p>
<pre><code>from Bio import AlignIO
from collections import Counter
import numpy as np
alignment = AlignIO.read("alignment.fasta", "fasta")
events = []
for i in range(alignment.get_alignment_length()):
this_column = alignment[:, i]
# Mark insertions, polymorphism and deletions following PM 2Ring notation
events.append(["U" if b == this_column[0] else
"I" if this_column[0] == "-" else
"P" if b != "-" else
"D" for b in this_column])
# Apply a Counter over the columns (axis 0) of the array
print(np.apply_along_axis(Counter, 0, np.array(events)))
</code></pre>
<p>这应输出与对齐顺序相同的计数数组:</p>
^{pr2}$