def read_fasta(fn):
    """
    read fasta file
    :param fn: file name
    :return: AA sequences, AA names
    """
    seq_names = []
    seqs = []
    with open(fn, 'r') as f:
        lines = f.readlines()
        for line in lines:
            line = line.strip()
            if line[0] == '>':
                # 去掉'|'后的标签，因为可能是程序自己加的
                if '|' in line:
                    line = line.split('|')[0]
                seq_names.append(line)

            else:
                seqs.append(line)
    return seqs, seq_names