def SAMflags(x):
    """
    Explains a SAM flag.

    :param x: flag

    :returns: complete SAM flag explanaition
    """
    flags=[]

    if x & 1:
        l="1: Read paired"
    else:
        l="0: Read unpaired"
    flags.append(l)

    if x & 2 :
        l="1: Read mapped in proper pair"
    else:
        l="0: Read not mapped in proper pair"
    flags.append(l)

    if x & 4 :
        l="1: Read unmapped"
    else:
        l="0: Read mapped"
    flags.append(l)

    if x & 8 :
        l="1: Mate unmapped"
    else:
        l="0: Mate mapped"
    flags.append(l)

    if x & 16 :
        l="1: Read reverse strand"
    else:
        l="0: Read direct strand"
    flags.append(l)

    if x & 32 :
        l="1: Mate reverse strand"
    else:
        l="0: Mate direct strand"
    flags.append(l)

    if x & 64 :
        l="1: First in pair"
    else:
        l="0: Second in pair"
    flags.append(l)

    if x & 128 :
        l="1: Second in pair"
    else:
        l="0: First in pair"
    flags.append(l)

    if x & 256 :
        l="1: Not primary alignment"
    else:
        l="0: Primary alignment"
    flags.append(l)

    if x & 512 :
        l="1: Read fails platform/vendor quality checks"
    else:
        l="0: Read passes platform/vendor quality checks"
    flags.append(l)

    if x & 1024 :
        l="1: Read is PCR or optical duplicate"
    else:
        l="0: Read is not PCR or optical duplicate"
    flags.append(l)

    if x & 2048 :
        l="1: Supplementary alignment"
    else:
        l="0: Not supplementary alignment"
    flags.append(l)

    return flags