Example #1
0
def IUAfreq(Loc, L):
    patlist = {}
    Loc.abbba = 0.
    Loc.babba = 0.
    Loc.abbaa = 0.
    Loc.babaa = 0.
    Loc.ababa = 0.
    Loc.baaba = 0.

    for col in Loc.seq.transpose():
        patlist = fillin(L[0], 'p1', col, Loc.names, patlist)
        patlist = fillin(L[1], 'p2', col, Loc.names, patlist)
        patlist = fillin(L[2], 'p3a', col, Loc.names, patlist)
        patlist = fillin(L[3], 'p3b', col, Loc.names, patlist)
        patlist = fillin(L[4], 'o', col, Loc.names, patlist)

        if not any([ all([i in ["N",'-'] for i in patlist['p1']]),
                     all([i in ["N",'-'] for i in patlist['p2']]),
                     all([i in ["N",'-'] for i in patlist['p3a']]),
                     all([i in ["N",'-'] for i in patlist['p3b']]),
                     all([i in ["N",'-'] for i in patlist['o']]) ]):
            if any([ i not in patlist['o'] for i in numpy.dstack((patlist['p3a'],patlist['p3b']))[0][0] ]):
                Loc = polyDstat5(Loc, patlist)
            else:
                None
        else:
            None
    return Loc
Example #2
0
def IUAfreq(Loc, L):
    patlist = {}
    Loc.abbba = 0.
    Loc.babba = 0.
    Loc.abbaa = 0.
    Loc.babaa = 0.
    Loc.ababa = 0.
    Loc.baaba = 0.

    Loc.bbbaa = 0.
    Loc.bbaba = 0.
    Loc.aaaba = 0.
    Loc.aabaa = 0.
    Loc.abaaa = 0.
    Loc.baaaa = 0.

    for col in Loc.seq.transpose():
        patlist = fillin(L[0], 'p1', col, Loc.names, patlist)
        patlist = fillin(L[1], 'p2', col, Loc.names, patlist)
        patlist = fillin(L[2], 'p3a', col, Loc.names, patlist)
        patlist = fillin(L[3], 'p3b', col, Loc.names, patlist)
        patlist = fillin(L[4], 'o', col, Loc.names, patlist)

        " exclude sites with missing data "
        if not any([ all([i in ["N",'-'] for i in patlist['p1']]),
                     all([i in ["N",'-'] for i in patlist['p2']]),
                     all([i in ["N",'-'] for i in patlist['p3a']]),
                     all([i in ["N",'-'] for i in patlist['p3b']]),
                     all([i in ["N",'-'] for i in patlist['o']]) ]):
            " if site in not invariable "
            isvar = len(set(col)-set(["N","-"])) > 1
            if isvar:
                " look for patterns in site "
                Loc = polyDstatfoil(Loc, patlist)
    return Loc