Skip to content

Errors/bug in odp_color_manager and odp_nway_rbh ? #109

@odethier-ulb

Description

@odethier-ulb

Hello, I had different errors when trying to generate a custom linkage group DB:

The first one was a NameError ... line 250 in odp_color_manager.py , which seems to be caused by species_count_sorted_keys that was never declared in that block of code:

 else:
                # get the largest
                # if the first is at least 10 times larger than the second, return it
                if species_count_sorted_keys[0][1] >= (species_count_sorted_keys[0][2] * 10): # ERROR
                    return species_count_sorted_keys[0][0]
                # or if the top two are the same, return either
                if species_count_sorted_keys[0][1] == species_count_sorted_keys[0][2]: # ERROR
                    print("There are two species with the same number of matches: {} and {}. Count: {}".format(
                          species_count_sorted_keys[0][0], species_count_sorted_keys[1][0],
                          species_count_sorted_keys[0][1]), file = sys.stderr) 
                    return species_count_sorted_keys[0][0]
                else:
                    return None

I fixed it by declaring species_count_sorted_keys = sorted(species_count.items(), key=lambda item: item[1], reverse=True) in top of the else condition. I've also changed the indices for the two species_count_sorted_keys[0][2] to species_count_sorted_keys[1][1].


The second error I encountered was a KeyError: 0 ... line 593 in odp_nway_rbh and happened when no alpha value > 0 could be retrieved when looping backward in the precomputed FDR ones in that block of code:

for index, row in grouped_multiple.iterrows():
            if row["alpha"] == 0:
                # now reassign the alpha to the next group that we've seen
                done = False
                countdown_index = 1
                while not done:
                    new_alpha = alpha_dict[row["count"] - countdown_index] # ERROR
                    if new_alpha == 0:
                        countdown_index += 1
                    else:
                        done = True
                        grouped_multiple.loc[index, "alpha"] = new_alpha
                        grouped_multiple.loc[index, "alpha_type"] = "less_than"

I "fixed" it by setting the alpha to 1.0 when an error is caught in the while loop (not the best solution tho...).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions