Skip to content

Conversation

@yaront
Copy link
Contributor

@yaront yaront commented Dec 31, 2025

Added an option to customize font family in volcano plots and bubble maps
Suppressed missing fonts messages if system's fallback is a valid font

Closes #54

@yaront yaront requested a review from Copilot December 31, 2025 17:51
@yaront yaront merged commit 746a7f7 into master Dec 31, 2025
8 checks passed
@yaront yaront deleted the font-family branch December 31, 2025 17:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses missing fonts in Linux by adding font family customization options to volcano plots and bubble maps, and suppressing matplotlib font manager warning messages for missing system fonts.

  • Adds a font_family parameter to plotting functions allowing users to specify custom font families
  • Suppresses matplotlib font_manager warnings by setting the logger level to ERROR when a valid system fallback font exists
  • Removes trailing whitespace in several functions

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
src/kinase_library/modules/enrichment.py Adds logging configuration to suppress font warnings and implements font_family parameter in plot_volcano and plot_bubblemap functions
src/kinase_library/enrichment/mea.py Adds font_family parameter to plot_volcano method and passes it through to the base plotting function; removes trailing whitespace
src/kinase_library/enrichment/differential_phosphorylation.py Adds logging configuration to suppress font warnings and implements font_family parameter in volcano plotting methods; removes trailing whitespace
src/kinase_library/enrichment/binary_enrichment.py Adds font_family parameter to plot_volcano method and passes it through to the base plotting function; removes trailing whitespace
Comments suppressed due to low confidence (5)

src/kinase_library/modules/enrichment.py:199

def combine_diff_phos_enrichment_results(enrichment_results_dict, enrichment_type='combined', data_type='kl_object',
                                        lff_col_name=None, pval_col_name=None, cont_kins_col_name=None):

src/kinase_library/modules/enrichment.py:507

  • Except block directly handles BaseException.
    except:

src/kinase_library/enrichment/binary_enrichment.py:609

  • Instantiating an exception, but not raising it, has no effect.
                ValueError(f'Warning: kins_label_dict has unexpected keys: {set(kins_label_dict) - set(kins_labels.values())}')

src/kinase_library/enrichment/differential_phosphorylation.py:707

  • Instantiating an exception, but not raising it, has no effect.
                ValueError(f'Warning: kins_label_dict has unexpected keys: {set(kins_label_dict) - set(kins_labels.values())}')

src/kinase_library/enrichment/mea.py:573

  • Instantiating an exception, but not raising it, has no effect.
                ValueError(f'Warning: kins_label_dict has unexpected keys: {set(kins_label_dict) - set(kins_labels.values())}')

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +795 to +796
if font_family:
mpl.rcParams['font.family'] = font_family
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifying global matplotlib rcParams within a function can have unintended side effects. The font_family change persists after the function returns and affects all subsequent matplotlib operations in the same Python session, not just this plot. Consider using a context manager approach to temporarily change the font family. For example, you could use with mpl.rc_context({'font.family': font_family}): to wrap the plotting code, which would restore the original font settings after the plot is complete.

Copilot uses AI. Check for mistakes.
Comment on lines +428 to +429
font_family : string, optional
Customized font family for the figures. The default is None.
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter type should be 'str' instead of 'string' to maintain consistency with other parameter documentation in this file. All other string parameters in the codebase use 'str' (e.g., lines 390, 392, 421, 575, etc.).

Copilot uses AI. Check for mistakes.
Comment on lines +782 to +783
font_family : string, optional
Customized font family for the figures. The default is None.
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter type should be 'str' instead of 'string' to maintain consistency with other parameter documentation in this file. All other string parameters in the codebase use 'str' (e.g., lines 752, 770, 772, etc.).

Copilot uses AI. Check for mistakes.
Comment on lines +545 to +546
font_family : string, optional
Customized font family for the figures. The default is None.
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter type should be 'str' instead of 'string' to maintain consistency with other parameter documentation in this codebase. All other string parameters in the file use 'str' (e.g., lines 527, 531, 533, 538, etc.).

Copilot uses AI. Check for mistakes.
Comment on lines +685 to +686
font_family : string, optional
Customized font family for the figures. The default is None.
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter type should be 'str' instead of 'string' to maintain consistency with other parameter documentation in this codebase. All other string parameters in the file use 'str' (e.g., lines 667, 671, 673, 678, etc.).

Copilot uses AI. Check for mistakes.
Comment on lines +863 to +864
font_family : string, optional
Customized font family for the figures. The default is None.
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter type should be 'str' instead of 'string' to maintain consistency with other parameter documentation in this codebase. All other string parameters in the file use 'str' (e.g., lines 847, 849, 851, 856, etc.).

Copilot uses AI. Check for mistakes.
Comment on lines +573 to +574
font_family : string, optional
Customized font family for the figures. The default is None.
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter type should be 'str' instead of 'string' to maintain consistency with other parameter documentation in this codebase. All other string parameters in the file use 'str' (e.g., lines 555, 559, 561, 566, etc.).

Copilot uses AI. Check for mistakes.
Comment on lines +444 to +445
if font_family:
mpl.rcParams['font.family'] = font_family
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifying global matplotlib rcParams within a function can have unintended side effects. The font_family change persists after the function returns and affects all subsequent matplotlib operations in the same Python session, not just this plot. Consider using a context manager approach to temporarily change the font family. For example, you could use with mpl.rc_context({'font.family': font_family}): to wrap the plotting code, which would restore the original font settings after the plot is complete.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

findfont: Font family 'Arial' not found.

2 participants