Skip to content

Commit

Permalink
Hotfix allow heuristic determination of marking mechanism.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmymathews committed Sep 22, 2023
1 parent ef97a8e commit 907a9ec
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,12 @@ def _infer_common_marking_mechanism(channels: DataFrame) -> str:
if len(mechanisms) == 1:
mechanism = mechanisms[0]
else:
mechanism = ''
logger.warning('Failed to infer marking mechanism.')
mechanism = ChannelsPhenotypesParser._get_most_common_marking_mechanism(channels)
logger.info('Inferred marking mechanism: %s', mechanism)
return mechanism

@classmethod
def _get_most_common_marking_mechanism(cls, channels: DataFrame) -> str:
frequencies = list(channels.value_counts('Marking mechanism').items())
frequencies = sorted(frequencies, key=lambda row: row[1], reverse=True)
return str(frequencies[0][0])

0 comments on commit 907a9ec

Please sign in to comment.