def test_plot_scatter() -> None: """ Test plot scatter function. """ demo_objects: DemoObjects = DemoObjects() dict_objects: Dict[str, Screen] = { "hras": demo_objects.hras_rbd, "bla": demo_objects.bla } # Define aux function def _test_plot_scatter(obj_test: Screen, parameters: list) -> bool: try: obj_test.scatter( obj_test, **parameters) # pass dictionary as arguments of method except Exception as e: # pylint: disable=broad-except logging.exception(e) print(traceback.format_exc()) return True return False # Define dictionary of parameters # Each dict in the list will be a different set of parameters list_params: list = [ { 'show': False, 'close': True, }, { 'figsize': (3, 2.5), 'y_label': r'$∆E^i_x$', 'show': False, 'close': True, }, ] # Assert for obj_label, obj_test in dict_objects.items( ): # Loop over the dictionary for parameters in list_params: # Loop over the parameters assert _test_plot_scatter( # Assert that that set of parameters works on that object obj_test, parameters, ) is False, "plot_scatter failed with {} object and {} parameters".format( obj_label, parameters, )
def test_demo_objects() -> None: """ Test class DemoObjects. """ demo_object: DemoObjects = DemoObjects() assert isinstance(demo_object.hras_rbd, Screen) assert isinstance(demo_object.bla, Screen) assert isinstance(demo_object.sumo, Screen) assert isinstance(demo_object.mapk1, Screen) assert isinstance(demo_object.ube2i, Screen) assert isinstance(demo_object.tat, Screen) assert isinstance(demo_object.rev, Screen) assert isinstance(demo_object.asynuclein, Screen) assert isinstance(demo_object.aph, Screen) assert isinstance(demo_object.b11l5f, Screen) assert isinstance(demo_object.hras_counts, Counts)
""" This module will test the heatmap plotting methods. """ import traceback import logging from typing import List from mutagenesis_visualization.main.demo.demo_objects import DemoObjects DEMO_OBJECTS: DemoObjects = DemoObjects() OBJ_TEST = DEMO_OBJECTS.hras_rbd def test_heatmap() -> None: """ Test the heatmap plot method. """ def _test_heatmap_output(parameters: dict) -> bool: try: OBJ_TEST.heatmap(**parameters) # pass dictionary as arguments of method except Exception as e: # pylint: disable=broad-except logging.exception(e) print(traceback.format_exc()) return True return False # Define dictionary of parameters # Each dict in the list will be a different set of parameters list_params: List[dict] = [ {'show': False, 'close': True}, {'mask_selfsubstitutions': True, 'hierarchical': True, 'show': False, 'close': True},
""" In this module we will produce the figures that went into the paper. """ from typing import List, Tuple import numpy as np from mutagenesis_visualization.main.demo.demo_objects import DemoObjects from mutagenesis_visualization.main.classes.screen import Screen HRAS_RBD = DemoObjects().hras_rbd HRAS_COUNTS = DemoObjects().hras_counts PATH: str = "docs/images/exported_images/paper/fig1{}.png" ANC_RAS_ENRICHMENT = np.genfromtxt( "figures_jk/enrichments/old/Ancestral167_RBD.csv", delimiter=',') SHOW = False def create_anc_ras_object() -> Tuple[Screen, List[Tuple[int, int]]]: """ This dataset is not available since it is not published yet. """ ancras: str = 'MTEYKLVVVGGGGVGKSALTIQFIQSHFVDEYDPTIEDSYRKQVVIDDEVAILDILDTAGQEEYSAMREQYMRNGEGFLLVYSITDRSSFDEISTYHEQILRVKDTDDVPMVLVGNKADLESRAVSMQEGQNLAKQLNVPFIETSAKQRMNVDEAFYTLVRVVRRH' hras: str = 'MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAGQEEYSAMRDQYMRTGEGFLCVFAINNTKSFEDIHQYREQIKRVKDSDDVPMVLVGNKCDLAARTVESRQAQDLARSYGIPYIETSAKTRQGVEDAFYTLVREIRQH' secondary: list = [ ['β1'] * (9 - 1), ['L1'] * (16 - 9), ['α1'] * (25 - 16), ['L2'] * (37 - 25), ['β2'] * (46 - 37), ['L3'] * (49 - 46), ['β3'] * (58 - 49), ['L4'] * (65 - 58), ['α2'] * (74 - 65), ['L5'] * (77 - 74), ['β4'] * (83 - 77), ['L6'] * (87 - 83), ['α3'] * (103 - 87), ['L7'] * (111 - 103), ['β5'] * (116 - 111), ['L8'] * (127 - 116), ['α4'] * (137 - 127), ['L9'] * (141 - 137), ['β6'] * (143 - 141), ['L10'] * (152 - 143), ['α5'] * (173 - 152), ['L11'] * (189 - 173) ]