scout/parse/case.py
def parse_case_data(config=None, ped=None, owner=None, vcf_snv=None,
                    vcf_sv=None, vcf_cancer=None, vcf_str=None, peddy_ped=None,
                    peddy_sex=None, peddy_check=None, delivery_report=None, multiqc=None):
    """Parse all data necessary for loading a case into scout

    This can be done either by providing a VCF file and other information
    on the command line. Or all the information can be specified in a config file.
    Please see Scout documentation for further instructions.

    Args:
        config(dict): A yaml formatted config file
        ped(iterable(str)): A ped formatted family file
        owner(str): The institute that owns a case
        vcf_snv(str): Path to a vcf file
        vcf_str(str): Path to a VCF file
        vcf_sv(str): Path to a vcf file
        vcf_cancer(str): Path to a vcf file
        peddy_ped(str): Path to a peddy ped
        multiqc(str): Path to dir with multiqc information

    Returns:
        config_data(dict): Holds all the necessary information for loading
                           Scout
    """
    config_data = copy.deepcopy(config) or {}
    # Default the analysis date to now if not specified in load config
    if 'analysis_date' not in config_data:
        config_data['analysis_date'] = datetime.datetime.now()

    # If the family information is in a ped file we nned to parse that
    if ped:
        family_id, samples = parse_ped(ped)
        config_data['family'] = family_id
        config_data['samples'] = samples

    # Each case has to have a owner. If not provided in config file it needs to be given as a
    # argument
    if 'owner' not in config_data:
        if not owner:
            raise SyntaxError("Case has no owner")
        else:
            config_data['owner'] = owner

    if 'gene_panels' in config_data:
        # handle whitespace in gene panel names
        config_data['gene_panels'] = [panel.strip() for panel in
                                      config_data['gene_panels']]
        config_data['default_gene_panels'] = [panel.strip() for panel in
                                              config_data['default_gene_panels']]

    ##################### Add information from peddy if existing #####################
    config_data['peddy_ped'] = peddy_ped or config_data.get('peddy_ped')
    config_data['peddy_sex_check'] = peddy_sex or config_data.get('peddy_sex')
    config_data['peddy_ped_check'] = peddy_check or config_data.get('peddy_check')

    # This will add information from peddy to the individuals
    add_peddy_information(config_data)

    ##################### Add multiqc information #####################
    config_data['multiqc'] = multiqc or config_data.get('multiqc')

    config_data['vcf_snv'] = vcf_snv if vcf_snv else config_data.get('vcf_snv')
    config_data['vcf_sv'] = vcf_sv if vcf_sv else config_data.get('vcf_sv')
    config_data['vcf_str'] = vcf_str if vcf_str else config_data.get('vcf_str')
    log.debug("Config vcf_str set to {0}".format(config_data['vcf_str']))

    config_data['vcf_cancer'] = vcf_cancer if vcf_cancer else config_data.get('vcf_cancer')

    config_data['delivery_report'] = delivery_report if delivery_report else config_data.get('delivery_report')

    config_data['rank_model_version'] = config_data.get('rank_model_version')
    config_data['rank_score_threshold'] = config_data.get('rank_score_threshold', 0)

    config_data['track'] = config_data.get('track', 'rare')
    if config_data['vcf_cancer']:
        config_data['track'] = 'cancer'

    return config_data
def parse_case_data(config=None, ped=None, owner=None, vcf_snv=None,
                    vcf_sv=None, vcf_cancer=None, vcf_str=None, peddy_ped=None,
                    peddy_sex=None, peddy_check=None, delivery_report=None, multiqc=None):
    config_data = copy.deepcopy(config) or {}
    # Default the analysis date to now if not specified in load config
    if 'analysis_date' not in config_data:
        config_data['analysis_date'] = datetime.datetime.now()

    # If the family information is in a ped file we nned to parse that
    if ped:
        family_id, samples = parse_ped(ped)
        config_data['family'] = family_id
        config_data['samples'] = samples

    # Each case has to have a owner. If not provided in config file it needs to be given as a
    # argument
    if 'owner' not in config_data:
        if not owner:
            raise SyntaxError("Case has no owner")
        else:
            config_data['owner'] = owner

    if 'gene_panels' in config_data:
        # handle whitespace in gene panel names
        config_data['gene_panels'] = [panel.strip() for panel in
                                      config_data['gene_panels']]
        config_data['default_gene_panels'] = [panel.strip() for panel in
                                              config_data['default_gene_panels']]

    ##################### Add information from peddy if existing #####################
    config_data['peddy_ped'] = peddy_ped or config_data.get('peddy_ped')
    config_data['peddy_sex_check'] = peddy_sex or config_data.get('peddy_sex')
    config_data['peddy_ped_check'] = peddy_check or config_data.get('peddy_check')

    # This will add information from peddy to the individuals
    add_peddy_information(config_data)

    ##################### Add multiqc information #####################
    config_data['multiqc'] = multiqc or config_data.get('multiqc')

    config_data['vcf_snv'] = vcf_snv if vcf_snv else config_data.get('vcf_snv')
    config_data['vcf_sv'] = vcf_sv if vcf_sv else config_data.get('vcf_sv')
    config_data['vcf_str'] = vcf_str if vcf_str else config_data.get('vcf_str')
    log.debug("Config vcf_str set to {0}".format(config_data['vcf_str']))

    config_data['vcf_cancer'] = vcf_cancer if vcf_cancer else config_data.get('vcf_cancer')

    config_data['delivery_report'] = delivery_report if delivery_report else config_data.get('delivery_report')

    config_data['rank_model_version'] = config_data.get('rank_model_version')
    config_data['rank_score_threshold'] = config_data.get('rank_score_threshold', 0)

    config_data['track'] = config_data.get('track', 'rare')
    if config_data['vcf_cancer']:
        config_data['track'] = 'cancer'

    return config_data
def parse_case_data ( config = None , ped = None , owner = None , vcf_snv = None , vcf_sv = None , vcf_cancer = None , vcf_str = None , peddy_ped = None , peddy_sex = None , peddy_check = None , delivery_report = None , multiqc = None ) : config_data = copy . deepcopy ( config ) or { } # Default the analysis date to now if not specified in load config if 'analysis_date' not in config_data : config_data [ 'analysis_date' ] = datetime . datetime . now ( ) # If the family information is in a ped file we nned to parse that if ped : family_id , samples = parse_ped ( ped ) config_data [ 'family' ] = family_id config_data [ 'samples' ] = samples # Each case has to have a owner. If not provided in config file it needs to be given as a # argument if 'owner' not in config_data : if not owner : raise SyntaxError ( "Case has no owner" ) else : config_data [ 'owner' ] = owner if 'gene_panels' in config_data : # handle whitespace in gene panel names config_data [ 'gene_panels' ] = [ panel . strip ( ) for panel in config_data [ 'gene_panels' ] ] config_data [ 'default_gene_panels' ] = [ panel . strip ( ) for panel in config_data [ 'default_gene_panels' ] ] ##################### Add information from peddy if existing ##################### config_data [ 'peddy_ped' ] = peddy_ped or config_data . get ( 'peddy_ped' ) config_data [ 'peddy_sex_check' ] = peddy_sex or config_data . get ( 'peddy_sex' ) config_data [ 'peddy_ped_check' ] = peddy_check or config_data . get ( 'peddy_check' ) # This will add information from peddy to the individuals add_peddy_information ( config_data ) ##################### Add multiqc information ##################### config_data [ 'multiqc' ] = multiqc or config_data . get ( 'multiqc' ) config_data [ 'vcf_snv' ] = vcf_snv if vcf_snv else config_data . get ( 'vcf_snv' ) config_data [ 'vcf_sv' ] = vcf_sv if vcf_sv else config_data . get ( 'vcf_sv' ) config_data [ 'vcf_str' ] = vcf_str if vcf_str else config_data . get ( 'vcf_str' ) log . debug ( "Config vcf_str set to {0}" . format ( config_data [ 'vcf_str' ] ) ) config_data [ 'vcf_cancer' ] = vcf_cancer if vcf_cancer else config_data . get ( 'vcf_cancer' ) config_data [ 'delivery_report' ] = delivery_report if delivery_report else config_data . get ( 'delivery_report' ) config_data [ 'rank_model_version' ] = config_data . get ( 'rank_model_version' ) config_data [ 'rank_score_threshold' ] = config_data . get ( 'rank_score_threshold' , 0 ) config_data [ 'track' ] = config_data . get ( 'track' , 'rare' ) if config_data [ 'vcf_cancer' ] : config_data [ 'track' ] = 'cancer' return config_data
Parse all data necessary for loading a case into scout

    This can be done either by providing a VCF file and other information
    on the command line. Or all the information can be specified in a config file.
    Please see Scout documentation for further instructions.

    Args:
        config(dict): A yaml formatted config file
        ped(iterable(str)): A ped formatted family file
        owner(str): The institute that owns a case
        vcf_snv(str): Path to a vcf file
        vcf_str(str): Path to a VCF file
        vcf_sv(str): Path to a vcf file
        vcf_cancer(str): Path to a vcf file
        peddy_ped(str): Path to a peddy ped
        multiqc(str): Path to dir with multiqc information

    Returns:
        config_data(dict): Holds all the necessary information for loading
                           Scout
Parse all data necessary for loading a case into scout