Skip to content

Commit

Permalink
Fix lift-over bug when all cultivars are selected
Browse files Browse the repository at this point in the history
  • Loading branch information
memgonzales committed Dec 19, 2023
1 parent 7a1e334 commit 2c4cb26
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions callbacks/lift_over/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,15 @@ def get_unique_genes_in_other_ref(refs, ref, genomic_intervals):
with open(f'{Constants.NB_MAPPING}/{ref}_to_Nb.pickle', 'rb') as f:
nb_ortholog_mapping = pickle.load(f)

unique_genes['Ortholog in Nipponbare'] = unique_genes.apply(
lambda x: get_nb_ortholog(x['Name'], nb_ortholog_mapping), axis=1)
try:
unique_genes['Ortholog in Nipponbare'] = unique_genes.apply(
lambda x: get_nb_ortholog(x['Name'], nb_ortholog_mapping), axis=1)

# This error manifests when all cultivars are selected
except KeyError:
unique_genes = unique_genes.rename(columns={'index': 'Name'})
unique_genes['Ortholog in Nipponbare'] = unique_genes.apply(
lambda x: get_nb_ortholog(x['Name'], nb_ortholog_mapping), axis=1)

unique_genes = unique_genes[FRONT_FACING_COLUMNS +
['Ortholog in Nipponbare']]
Expand Down

0 comments on commit 2c4cb26

Please sign in to comment.