Skip to content

It would be nice to separate 'graphical' and 'functional' parts of the code to separate functions. I know this is quite some work, but I also believe it would be worth from the perspective of readability. #46

@xiaoliz0

Description

@xiaoliz0
          It would be nice to separate 'graphical' and 'functional' parts of the code to separate functions. I know this is quite some work, but I also believe it would be worth from the perspective of readability. 

Here is just a small example - lines 1432-1454 - a new function set_slide6_layout_parameters is defined below for dealing with various slide6 layout parameters and a new dictionary slide6_layout_params is defined to hold all the parameters in one data structure instead of all the different variables:

def set_slide6_layout_parameters(DNA_normal_sampleID, output_file_preMTB_table_path):
      layout_params = dict()
            
      if (DNA_normal_sampleID != ""):
            layout_params['table_header'] = ["Gene symbol", "Protein change", "Coding status", "VAF tumor DNA [0,1]", "VAF normal DNA"]
      else:
            layout_params['table_header'] = ["Gene symbol", "Protein change", "Coding status", "VAF tumor DNA [0,1]"]
            
      layout_params['table_data_file'] = output_file_preMTB_table_path + "_AllReporVariants_AltProtein.txt" 
      layout_params['table_pptSlide']  = [2,6,7]
      layout_params['table_name']      = "Variants that alter protein coding sequence "
      layout_params['header_left']     = 7.36
      layout_params['header_top']      = 0.82
      layout_params['header_width']    = 2.55
      layout_params['table_left']      = 7.23
      layout_params['table_top']       = 1.06
      layout_params['table_width']     = 2.76
      layout_params['table_height']    = 1.63
      layout_params['table_font_size'] = 7
      layout_params['if_print_rowNo']  = False
           
      return layout_params

then one can use the function in the main like in the last line here:

DNA_normal_sampleID="IPDXXXX-D01-X01-XXX"
output_file_preMTB_table_path="output_path/some_filename_prefix"
slide6_layout_params=dict()

slide6_layout_params = set_slide6_layout_parameters(DNA_normal_sampleID, output_file_preMTB_table_path)

and afterwards all the 'slide6' variables used as inputs in insert_table_to_ppt() can be reduced to 'slide6_layout_params' and read from the dictionary inside the function as needed.

Hopefully I did not forget any other place where the slide6 variables are used...

Originally posted by @tinavisnovska in #36 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions