scout/server/blueprints/panels/views.py
def gene_edit(panel_id, hgnc_id):
    """Edit additional information about a panel gene."""
    panel_obj = store.panel(panel_id)
    hgnc_gene = store.hgnc_gene(hgnc_id)
    panel_gene = controllers.existing_gene(store, panel_obj, hgnc_id)

    form = PanelGeneForm()
    transcript_choices = []
    for transcript in hgnc_gene['transcripts']:
        if transcript.get('refseq_id'):
            refseq_id = transcript.get('refseq_id')
            transcript_choices.append((refseq_id, refseq_id))
    form.disease_associated_transcripts.choices = transcript_choices

    if form.validate_on_submit():
        action = 'edit' if panel_gene else 'add'
        info_data = form.data.copy()
        if 'csrf_token' in info_data:
            del info_data['csrf_token']
        store.add_pending(panel_obj, hgnc_gene, action=action, info=info_data)
        return redirect(url_for('.panel', panel_id=panel_id))

    if panel_gene:
        for field_key in ['disease_associated_transcripts', 'reduced_penetrance',
                          'mosaicism', 'inheritance_models', 'database_entry_version', 'comment']:
            form_field = getattr(form, field_key)
            if not form_field.data:
                panel_value = panel_gene.get(field_key)
                if panel_value is not None:
                    form_field.process_data(panel_value)
    return dict(panel=panel_obj, form=form, gene=hgnc_gene, panel_gene=panel_gene)
def gene_edit(panel_id, hgnc_id):
    panel_obj = store.panel(panel_id)
    hgnc_gene = store.hgnc_gene(hgnc_id)
    panel_gene = controllers.existing_gene(store, panel_obj, hgnc_id)

    form = PanelGeneForm()
    transcript_choices = []
    for transcript in hgnc_gene['transcripts']:
        if transcript.get('refseq_id'):
            refseq_id = transcript.get('refseq_id')
            transcript_choices.append((refseq_id, refseq_id))
    form.disease_associated_transcripts.choices = transcript_choices

    if form.validate_on_submit():
        action = 'edit' if panel_gene else 'add'
        info_data = form.data.copy()
        if 'csrf_token' in info_data:
            del info_data['csrf_token']
        store.add_pending(panel_obj, hgnc_gene, action=action, info=info_data)
        return redirect(url_for('.panel', panel_id=panel_id))

    if panel_gene:
        for field_key in ['disease_associated_transcripts', 'reduced_penetrance',
                          'mosaicism', 'inheritance_models', 'database_entry_version', 'comment']:
            form_field = getattr(form, field_key)
            if not form_field.data:
                panel_value = panel_gene.get(field_key)
                if panel_value is not None:
                    form_field.process_data(panel_value)
    return dict(panel=panel_obj, form=form, gene=hgnc_gene, panel_gene=panel_gene)
def gene_edit ( panel_id , hgnc_id ) : panel_obj = store . panel ( panel_id ) hgnc_gene = store . hgnc_gene ( hgnc_id ) panel_gene = controllers . existing_gene ( store , panel_obj , hgnc_id ) form = PanelGeneForm ( ) transcript_choices = [ ] for transcript in hgnc_gene [ 'transcripts' ] : if transcript . get ( 'refseq_id' ) : refseq_id = transcript . get ( 'refseq_id' ) transcript_choices . append ( ( refseq_id , refseq_id ) ) form . disease_associated_transcripts . choices = transcript_choices if form . validate_on_submit ( ) : action = 'edit' if panel_gene else 'add' info_data = form . data . copy ( ) if 'csrf_token' in info_data : del info_data [ 'csrf_token' ] store . add_pending ( panel_obj , hgnc_gene , action = action , info = info_data ) return redirect ( url_for ( '.panel' , panel_id = panel_id ) ) if panel_gene : for field_key in [ 'disease_associated_transcripts' , 'reduced_penetrance' , 'mosaicism' , 'inheritance_models' , 'database_entry_version' , 'comment' ] : form_field = getattr ( form , field_key ) if not form_field . data : panel_value = panel_gene . get ( field_key ) if panel_value is not None : form_field . process_data ( panel_value ) return dict ( panel = panel_obj , form = form , gene = hgnc_gene , panel_gene = panel_gene )
Edit additional information about a panel gene.
Edit additional information about a panel gene .