scout/server/blueprints/panels/controllers.py
def new_panel(store, institute_id, panel_name, display_name, csv_lines):
    """Create a new gene panel.

    Args:
        store(scout.adapter.MongoAdapter)
        institute_id(str)
        panel_name(str)
        display_name(str)
        csv_lines(iterable(str)): Stream with genes

    Returns:
        panel_id: the ID of the new panel document created or None

    """
    institute_obj = store.institute(institute_id)
    if institute_obj is None:
        flash("{}: institute not found".format(institute_id))
        return None

    panel_obj = store.gene_panel(panel_name)
    if panel_obj:
        flash("panel already exists: {} - {}".format(panel_obj['panel_name'],
                                                     panel_obj['display_name']))
        return None

    log.debug("parse genes from CSV input")
    try:
        new_genes = parse_genes(csv_lines)
    except SyntaxError as error:
        flash(error.args[0], 'danger')
        return None

    log.debug("build new gene panel")

    panel_id = None
    try:
        panel_data = build_panel(dict(
            panel_name=panel_name,
            institute=institute_obj['_id'],
            version=1.0,
            date=dt.datetime.now(),
            display_name=display_name,
            genes=new_genes,
        ), store)
        panel_id= store.add_gene_panel(panel_data)

    except Exception as err:
        log.error('An error occurred while adding the gene panel {}'.format(err))

    return panel_id
def new_panel(store, institute_id, panel_name, display_name, csv_lines):
    institute_obj = store.institute(institute_id)
    if institute_obj is None:
        flash("{}: institute not found".format(institute_id))
        return None

    panel_obj = store.gene_panel(panel_name)
    if panel_obj:
        flash("panel already exists: {} - {}".format(panel_obj['panel_name'],
                                                     panel_obj['display_name']))
        return None

    log.debug("parse genes from CSV input")
    try:
        new_genes = parse_genes(csv_lines)
    except SyntaxError as error:
        flash(error.args[0], 'danger')
        return None

    log.debug("build new gene panel")

    panel_id = None
    try:
        panel_data = build_panel(dict(
            panel_name=panel_name,
            institute=institute_obj['_id'],
            version=1.0,
            date=dt.datetime.now(),
            display_name=display_name,
            genes=new_genes,
        ), store)
        panel_id= store.add_gene_panel(panel_data)

    except Exception as err:
        log.error('An error occurred while adding the gene panel {}'.format(err))

    return panel_id
def new_panel ( store , institute_id , panel_name , display_name , csv_lines ) : institute_obj = store . institute ( institute_id ) if institute_obj is None : flash ( "{}: institute not found" . format ( institute_id ) ) return None panel_obj = store . gene_panel ( panel_name ) if panel_obj : flash ( "panel already exists: {} - {}" . format ( panel_obj [ 'panel_name' ] , panel_obj [ 'display_name' ] ) ) return None log . debug ( "parse genes from CSV input" ) try : new_genes = parse_genes ( csv_lines ) except SyntaxError as error : flash ( error . args [ 0 ] , 'danger' ) return None log . debug ( "build new gene panel" ) panel_id = None try : panel_data = build_panel ( dict ( panel_name = panel_name , institute = institute_obj [ '_id' ] , version = 1.0 , date = dt . datetime . now ( ) , display_name = display_name , genes = new_genes , ) , store ) panel_id = store . add_gene_panel ( panel_data ) except Exception as err : log . error ( 'An error occurred while adding the gene panel {}' . format ( err ) ) return panel_id
Create a new gene panel.

    Args:
        store(scout.adapter.MongoAdapter)
        institute_id(str)
        panel_name(str)
        display_name(str)
        csv_lines(iterable(str)): Stream with genes

    Returns:
        panel_id: the ID of the new panel document created or None
Create a new gene panel .