######################################################
#
# Make a copy of this file and edit it to your liking
#
######################################################

# Which population to plot
species_names = ["Bacteroides_vulgatus_57955"]
 
# Output filename
filename = parse_midas_data.analysis_directory+'Bacteroides_vulgatus_demo_timecourse.png'


####################################################################
#
#  Function controlling which mutations are colored
#
#      Returns: true for colored
#               false for not colored
#
####################################################################
def color_condition(population_idx, chromosome, location, gene_name, variant_type, times, freqs, depths):
    
    condition = True
     
    #condition = ( gene_name=='435590.9.peg.242' )
    
    #condition = (freqs.max()-freqs.min() > 0.8)
    #condition = (freqs[0]<0.05)*(freqs[1]<0.05)*((freqs.max()-freqs.min()) > 0.5)
    # Examples:
    # 
    # Mutation is in the majority at the end of the experiment
    # condition = f(60000) > 0.5
    #
    # Mutation is a structural variant in the nadR gene
    # condition = (gene_name == 'nadR') and var_type='sv'
    #
    # Mutation is in one of the mut* genes
    # condition = gene_name.startswith('mut')
    # ... 
    
    if condition:
        items = [chromosome, location, gene_name, variant_type]
        print_str = ", ".join([str(item) for item in items])
        sys.stderr.write("%s\n" % print_str)
    
    return condition
