Example #1
0
def china_chicken_0313(taxons, args):
    'Find china chicken before 03/2013'
    always_in =droplist.do_not_remove()
    always_in.extend(droplist.h7n9_all())
    taxons = filt_taxon_by_time(taxons, args.stringent_h9n2, args.stringent_h7n9)
    taxons = filt_taxon_by_location(taxons, always_in)
    taxons = filt_taxon_by_host(taxons, always_in)
    return taxons
Example #2
0
def filt_taxon_by_time(taxons, h9n2_before_april=False, h7n9_before_april=False):
    '''
    Take a tree file (dendropy format)
    return droplist

    False/False -> strip H9N2 in 2014, strip all H7N9
    True/True -> strip H9N2 and H7N9 before Aripl 2013
    '''
    lbs=[lb for lb in taxons if not lb.endswith('2014')] # remove 2014
    if h9n2_before_april: # drop taxon list
        # due to the fact that i remove duplicats in my process 
        # and changed chichen, Chicken and ChiCken to chicken.
        h9n2 =droplist.h9n2()
        h9n2.extend([l.replace('Chicken','chicken') for l in h9n2]) # one capital C
        h9n2.extend([l.replace('ChiCken','chicken') for l in h9n2]) # two capital C
        lbs =[lb for lb in lbs if not lb in h9n2]
    # filt by h7
    if h7n9_before_april: # drop post-march 2013
        lbs =[lb for lb in lbs if not lb in droplist.h7n9_part2()]
    else: # drop all
        lbs =[lb for lb in lbs if not lb in droplist.h7n9_all()]
    return lbs
Example #3
0
def add_h7n9_label(tree):
    for ts in tree.taxon_set:
        if ts.label in droplist.h7n9_all():
            ts.label = ts.label + '    *H7N9*    '
    return tree