Exemple #1
0
def display_chr_pos_ref_alt(topOfSlideTextbox, dfRow):
    chromosome = xls_parsing_functions.get_xls_value(dfRow, 'Chromosome',
                                                     '****')
    pos = xls_parsing_functions.get_xls_value(dfRow, 'Position', '****')
    ref = xls_parsing_functions.get_xls_value(dfRow, 'Reference Allele',
                                              '****')
    alt = xls_parsing_functions.get_xls_value(dfRow, 'Sample Allele', '****')
    chrPos = ':'.join([chromosome, pos])
    refAlt = ">".join([ref, alt])
    text = ''.join([chrPos, refAlt])
    #add the text to the slide
    p = topOfSlideTextbox.add_paragraph()
    try:
        p.text = make_string_safe_for_unicode(text)
    except ValueError:
        p.text = 'no value'
Exemple #2
0
def display_tscriptId_tscriptVariant_proteinVariant_and_exon(
        topOfSlideTextbox, dfRow):
    tscriptId = xls_parsing_functions.get_xls_value(dfRow, 'Transcript ID',
                                                    '****')
    tscriptVariant = xls_parsing_functions.get_xls_value(
        dfRow, 'Transcript Variant', '****')
    proteinVariant = xls_parsing_functions.get_xls_value(
        dfRow, 'Protein Variant', '****')
    exon = xls_parsing_functions.get_xls_value(dfRow, 'Gene Region', '****')
    #print tscriptId, tscriptVariant, proteinVariant
    text = ' | '.join([tscriptId, tscriptVariant, proteinVariant, exon])
    #add the text to the slide
    p = topOfSlideTextbox.add_paragraph()
    #text = text.encode('utf-8').strip()
    try:
        p.text = make_string_safe_for_unicode(text)
    except ValueError:
        p.text = 'no value'
Exemple #3
0
def display_gene_function_textbox(slide, dfRow):
    #ALERT--add logic that resizes the text boxes based on how much text there is
    if (True): geneFunctionHeight = DEFAULT_TEXTBOX_HEIGHT
    shape = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, TEXT_BOX_LEFT_OFFSET,
                                   ELEMENT_TOP_OFFSET, TEXT_BOX_WIDTH,
                                   geneFunctionHeight)
    set_shape_color(shape, 80, 172, 196)
    info = xls_parsing_functions.get_xls_value(dfRow, 'SwissProtFunction')
    set_shape_text(shape, "Gene function: ", info)
    return ELEMENT_TOP_OFFSET + geneFunctionHeight
Exemple #4
0
def display_functional_studies_textbox(slide, dfRow, currentOffsetFromTop):
    #if text in the gene function box is bleeding over, make sure to resize my new text box so it is lower down
    functionalStudiesOffset = currentOffsetFromTop + OFFSET_BETWEEN_STUDIES_BOX
    #ALERT--add logic that resizes the text boxes based on how much text there is
    if (True): functionalStudiesHeight = DEFAULT_TEXTBOX_HEIGHT
    shape = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, TEXT_BOX_LEFT_OFFSET,
                                   functionalStudiesOffset, TEXT_BOX_WIDTH,
                                   functionalStudiesHeight)
    set_shape_color(shape, 156, 186, 95)
    info = xls_parsing_functions.get_xls_value(dfRow, 'mgi')
    set_shape_text(shape, "Functional studies: ", info)
    return currentOffsetFromTop + DEFAULT_TEXTBOX_HEIGHT + OFFSET_BETWEEN_STUDIES_BOX
Exemple #5
0
def display_gene_name(topOfSlideTextbox, dfRow):
    geneName = xls_parsing_functions.get_xls_value(dfRow, 'Gene Symbol')
    if len(geneName) < 2:
        #print geneName
        geneName = 'not found'  #we need to hack around some unicode errors
    try:
        topOfSlideTextbox.text = make_string_safe_for_unicode("GENE: " +
                                                              geneName)
    except ValueError:
        topOfSlideTextbox.text = 'no value'
    #we get the first paragraph (which is set by deafult), and make it bold
    topOfSlideTextbox.paragraphs[0].font.bold = True
Exemple #6
0
def display_known_disease_association_textbox(slide, dfRow,
                                              currentOffsetFromTop):
    knownDiseaseAssocOffset = currentOffsetFromTop + OFFSET_BETWEEN_STUDIES_BOX
    #ALERT--add logic that resizes the text boxes based on how much text there is
    if (True): knownDiseaseAssocHeight = DEFAULT_TEXTBOX_HEIGHT
    shape = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, TEXT_BOX_LEFT_OFFSET,
                                   knownDiseaseAssocOffset, TEXT_BOX_WIDTH,
                                   knownDiseaseAssocHeight)
    set_shape_color(shape, 190, 7, 18)
    #Alert we need to change this
    info = xls_parsing_functions.get_xls_value(dfRow,
                                               'SwissProtDiseaseAssociation')
    set_shape_text(shape, "Known Disease Association: ", info)
Exemple #7
0
def populate_slide(slide, dfRow, udnId):

    ####################################
    display_udn_logo(slide)
    display_udn_id(slide, udnId)
    #CREATE THE TOP OF THE SLIDE: Gene, name, chrom, pos etc
    #we use current offset from the top as an intermediate variable that helps us put stuff in the right place
    display_top_of_slide_textbox(slide, dfRow)
    currentOffsetFromTop = display_gene_function_textbox(slide, dfRow)
    currentOffsetFromTop = display_functional_studies_textbox(
        slide, dfRow, currentOffsetFromTop)
    display_known_disease_association_textbox(slide, dfRow,
                                              currentOffsetFromTop)
    currentOffsetFromTop = display_in_silico_prediction_table(slide, dfRow)
    currentOffsetFromTop = display_allele_frequency_table(
        slide, dfRow, currentOffsetFromTop)
    #Do the 1-D tables--note that in the interest of minimal copy pasting of code some code from the display allele freq tables is re
    igvStatus = xls_parsing_functions.get_xls_value(dfRow, 'IGV')
    currentOffsetFromTop = display_1d_table(slide, currentOffsetFromTop, 'IGV',
                                            igvStatus)
    display_1d_table(slide, currentOffsetFromTop, 'Variant Decision', 'tbd')
Exemple #8
0
def set_table_body_rows(slide, table, dfRow, rowNames):
    idx = 1
    for displayRowName, excelKey in rowNames:
        rowValue = xls_parsing_functions.get_xls_value(dfRow, excelKey)
        set_text_size_and_font(table.cell(idx, 0), TABLE_TEXT_SIZE)
        set_text_size_and_font(table.cell(idx, 1), TABLE_TEXT_SIZE)

        displayRowName = make_string_safe_for_unicode(displayRowName)
        rowValue = make_string_safe_for_unicode(rowValue)
        try:
            table.cell(idx, 0).text = displayRowName
        except ValueError:
            table.cell(idx, 0).text = 'no value'
        try:
            table.cell(idx, 1).text = rowValue
        except ValueError:
            table.cell(idx, 1).text = 'no value'

        #Make the cells white
        adjust_cell_color(table, idx, 0, RGBColor(255, 255, 255))
        adjust_cell_color(table, idx, 1, RGBColor(255, 255, 255))
        idx += 1