コード例 #1
0
def info_comand(strseq):
    """INFO seq
    returns: The string with the information
    """
    # Create the object sequence from the string
    s = Seq(strseq)
    s_length = s.len()
    count_a = s.count_a('A')
    pa = "{:.1f}".format(100 * count_a / s_length)
    count_c = s.count_c('C')
    pc = "{:.1f}".format(100 * count_c / s_length)
    count_g = s.count_g('G')
    pg = "{:.1f}".format(100 * count_g / s_length)
    count_t = s.count_t('T')
    pt = "{:.1f}".format(100 * count_t / s_length)

    response = f"""Sequence: {s}
Total length: {s_length}
A: {count_a} ({pa}%)
C: {count_c} ({pc}%)
G: {count_g} ({pg}%)
T: {count_t} ({pt}%)"""
    return response