去除序列比对后的符号“-”
#==========================================
# This code was written by Sihua Peng, PhD.
#==========================================
#Cut the alignment sign "-"
from Bio import SeqIO
input_file = "hiv.fasta"
output_file = "hiv_clean22.fasta"
with open(input_file, "r") as input_handle, open(output_file, "w") as output_handle:
for record in SeqIO.parse(input_handle, "fasta"):
record.seq = record.seq.ungap("-")
SeqIO.write(record, output_handle, "fasta")