scout/load/panel.py
def load_panel(panel_path, adapter, date=None, display_name=None, version=None, panel_type=None, 
               panel_id=None, institute=None):
    """Load a manually curated gene panel into scout
    
    Args:
        panel_path(str): path to gene panel file
        adapter(scout.adapter.MongoAdapter)
        date(str): date of gene panel on format 2017-12-24
        display_name(str)
        version(float)
        panel_type(str)
        panel_id(str)
        institute(str)
    
    """
    panel_lines = get_file_handle(panel_path)

    try:
        # This will parse panel metadata if includeed in panel file
        panel_info = get_panel_info(
            panel_lines=panel_lines,
            panel_id=panel_id,
            institute=institute,
            version=version,
            date=date,
            display_name=display_name
            )
    except Exception as err:
        raise err

    version = None
    if panel_info.get('version'):
        version = float(panel_info['version'])

    panel_id = panel_info['panel_id']
    display_name = panel_info['display_name'] or panel_id
    institute = panel_info['institute']
    date = panel_info['date']

    if not institute:
        raise SyntaxError("A Panel has to belong to a institute")

    #Check if institute exists in database
    if not adapter.institute(institute):
        raise SyntaxError("Institute {0} does not exist in database".format(institute))

    if not panel_id:
        raise SyntaxError("A Panel has to have a panel id")
    
    if version:
        existing_panel = adapter.gene_panel(panel_id, version)
    else:
        ## Assuming version 1.0
        existing_panel = adapter.gene_panel(panel_id)
        version = 1.0
        LOG.info("Set version to %s", version)

    if existing_panel:
        LOG.info("found existing panel")
        if version == existing_panel['version']:
            LOG.warning("Panel with same version exists in database")
            LOG.info("Reload with updated version")
            raise SyntaxError()
        display_name = display_name or existing_panel['display_name']
        institute = institute or existing_panel['institute']
    
    parsed_panel = parse_gene_panel(
        path=panel_path,
        institute=institute,
        panel_type=panel_type,
        date=date,
        version=version,
        panel_id=panel_id,
        display_name=display_name,
    )
    
    try:
        adapter.load_panel(parsed_panel=parsed_panel)
    except Exception as err:
        raise err
def load_panel(panel_path, adapter, date=None, display_name=None, version=None, panel_type=None, 
               panel_id=None, institute=None):
    """Load a manually curated gene panel into scout
    
    Args:
        panel_path(str): path to gene panel file
        adapter(scout.adapter.MongoAdapter)
        date(str): date of gene panel on format 2017-12-24
        display_name(str)
        version(float)
        panel_type(str)
        panel_id(str)
        institute(str)
    
    """
    panel_lines = get_file_handle(panel_path)

    try:
        # This will parse panel metadata if includeed in panel file
        panel_info = get_panel_info(
            panel_lines=panel_lines,
            panel_id=panel_id,
            institute=institute,
            version=version,
            date=date,
            display_name=display_name
            )
    except Exception as err:
        raise err

    version = None
    if panel_info.get('version'):
        version = float(panel_info['version'])

    panel_id = panel_info['panel_id']
    display_name = panel_info['display_name'] or panel_id
    institute = panel_info['institute']
    date = panel_info['date']

    if not institute:
        raise SyntaxError("A Panel has to belong to a institute")

    #Check if institute exists in database
    if not adapter.institute(institute):
        raise SyntaxError("Institute {0} does not exist in database".format(institute))

    if not panel_id:
        raise SyntaxError("A Panel has to have a panel id")
    
    if version:
        existing_panel = adapter.gene_panel(panel_id, version)
    else:
        ## Assuming version 1.0
        existing_panel = adapter.gene_panel(panel_id)
        version = 1.0
        LOG.info("Set version to %s", version)

    if existing_panel:
        LOG.info("found existing panel")
        if version == existing_panel['version']:
            LOG.warning("Panel with same version exists in database")
            LOG.info("Reload with updated version")
            raise SyntaxError()
        display_name = display_name or existing_panel['display_name']
        institute = institute or existing_panel['institute']
    
    parsed_panel = parse_gene_panel(
        path=panel_path,
        institute=institute,
        panel_type=panel_type,
        date=date,
        version=version,
        panel_id=panel_id,
        display_name=display_name,
    )
    
    try:
        adapter.load_panel(parsed_panel=parsed_panel)
    except Exception as err:
        raise err
def load_panel ( panel_path , adapter , date = None , display_name = None , version = None , panel_type = None , panel_id = None , institute = None ) : panel_lines = get_file_handle ( panel_path ) try : # This will parse panel metadata if includeed in panel file panel_info = get_panel_info ( panel_lines = panel_lines , panel_id = panel_id , institute = institute , version = version , date = date , display_name = display_name ) except Exception as err : raise err version = None if panel_info . get ( 'version' ) : version = float ( panel_info [ 'version' ] ) panel_id = panel_info [ 'panel_id' ] display_name = panel_info [ 'display_name' ] or panel_id institute = panel_info [ 'institute' ] date = panel_info [ 'date' ] if not institute : raise SyntaxError ( "A Panel has to belong to a institute" ) #Check if institute exists in database if not adapter . institute ( institute ) : raise SyntaxError ( "Institute {0} does not exist in database" . format ( institute ) ) if not panel_id : raise SyntaxError ( "A Panel has to have a panel id" ) if version : existing_panel = adapter . gene_panel ( panel_id , version ) else : ## Assuming version 1.0 existing_panel = adapter . gene_panel ( panel_id ) version = 1.0 LOG . info ( "Set version to %s" , version ) if existing_panel : LOG . info ( "found existing panel" ) if version == existing_panel [ 'version' ] : LOG . warning ( "Panel with same version exists in database" ) LOG . info ( "Reload with updated version" ) raise SyntaxError ( ) display_name = display_name or existing_panel [ 'display_name' ] institute = institute or existing_panel [ 'institute' ] parsed_panel = parse_gene_panel ( path = panel_path , institute = institute , panel_type = panel_type , date = date , version = version , panel_id = panel_id , display_name = display_name , ) try : adapter . load_panel ( parsed_panel = parsed_panel ) except Exception as err : raise err
Load a manually curated gene panel into scout
    
    Args:
        panel_path(str): path to gene panel file
        adapter(scout.adapter.MongoAdapter)
        date(str): date of gene panel on format 2017-12-24
        display_name(str)
        version(float)
        panel_type(str)
        panel_id(str)
        institute(str)
Load a manually curated gene panel into scout Args : panel_path ( str ) : path to gene panel file adapter ( scout . adapter . MongoAdapter ) date ( str ) : date of gene panel on format 2017 - 12 - 24 display_name ( str ) version ( float ) panel_type ( str ) panel_id ( str ) institute ( str )