def add_nonN_count(df, nonN_count_file):
    """Count number of nonambiguous nucleotides per sequence and
    add counts to dataframe"""
    count_dict = {}
    with open(nonN_count_file, 'r') as f:
        for line in f:
            id, count = line.rstrip('\n').split('\t')
            count_dict[id] = int(count)
    assert len(df.index) == len(count_dict)
    count_list = [count_dict[id] for id in df["strain"]]
    df["nonN_count"] = count_list
    return df