scout/parse/case.py
def parse_case(config):
    """Parse case information from config or PED files.

    Args:
        config (dict): case config with detailed information

    Returns:
        dict: parsed case data
    """
    if 'owner' not in config:
        raise ConfigError("A case has to have a owner")

    if 'family' not in config:
        raise ConfigError("A case has to have a 'family'")

    individuals = parse_individuals(config['samples'])
    case_data = {
        'owner': config['owner'],
        'collaborators': [config['owner']],
        'case_id': config['family'],
        'display_name': config.get('family_name', config['family']),
        'genome_build': config.get('human_genome_build'),
        'rank_model_version': config.get('rank_model_version'),
        'rank_score_threshold': config.get('rank_score_threshold', 0),
        'analysis_date': config['analysis_date'],
        'individuals': individuals,
        'vcf_files': {
            'vcf_snv': config.get('vcf_snv'),
            'vcf_sv': config.get('vcf_sv'),
            'vcf_str': config.get('vcf_str'),
            'vcf_cancer': config.get('vcf_cancer'),
            'vcf_snv_research': config.get('vcf_snv_research'),
            'vcf_sv_research': config.get('vcf_sv_research'),
            'vcf_cancer_research': config.get('vcf_cancer_research'),
        },
        'default_panels': config.get('default_gene_panels', []),
        'gene_panels': config.get('gene_panels', []),
        'assignee': config.get('assignee'),
        'peddy_ped': config.get('peddy_ped'),
        'peddy_sex': config.get('peddy_sex'),
        'peddy_check': config.get('peddy_check'),
        'delivery_report': config.get('delivery_report'),
        'multiqc': config.get('multiqc'),
        'track': config.get('track', 'rare'),
    }

    # add the pedigree figure, this is a xml file which is dumped in the db
    if 'madeline' in config:
        mad_path = Path(config['madeline'])
        if not mad_path.exists():
            raise ValueError("madeline path not found: {}".format(mad_path))
        with mad_path.open('r') as in_handle:
            case_data['madeline_info'] = in_handle.read()
    
    if (case_data['vcf_files']['vcf_cancer'] or case_data['vcf_files']['vcf_cancer_research']):
        case_data['track'] = 'cancer'
    
    return case_data
def parse_case(config):
    """Parse case information from config or PED files.

    Args:
        config (dict): case config with detailed information

    Returns:
        dict: parsed case data
    """
    if 'owner' not in config:
        raise ConfigError("A case has to have a owner")

    if 'family' not in config:
        raise ConfigError("A case has to have a 'family'")

    individuals = parse_individuals(config['samples'])
    case_data = {
        'owner': config['owner'],
        'collaborators': [config['owner']],
        'case_id': config['family'],
        'display_name': config.get('family_name', config['family']),
        'genome_build': config.get('human_genome_build'),
        'rank_model_version': config.get('rank_model_version'),
        'rank_score_threshold': config.get('rank_score_threshold', 0),
        'analysis_date': config['analysis_date'],
        'individuals': individuals,
        'vcf_files': {
            'vcf_snv': config.get('vcf_snv'),
            'vcf_sv': config.get('vcf_sv'),
            'vcf_str': config.get('vcf_str'),
            'vcf_cancer': config.get('vcf_cancer'),
            'vcf_snv_research': config.get('vcf_snv_research'),
            'vcf_sv_research': config.get('vcf_sv_research'),
            'vcf_cancer_research': config.get('vcf_cancer_research'),
        },
        'default_panels': config.get('default_gene_panels', []),
        'gene_panels': config.get('gene_panels', []),
        'assignee': config.get('assignee'),
        'peddy_ped': config.get('peddy_ped'),
        'peddy_sex': config.get('peddy_sex'),
        'peddy_check': config.get('peddy_check'),
        'delivery_report': config.get('delivery_report'),
        'multiqc': config.get('multiqc'),
        'track': config.get('track', 'rare'),
    }

    # add the pedigree figure, this is a xml file which is dumped in the db
    if 'madeline' in config:
        mad_path = Path(config['madeline'])
        if not mad_path.exists():
            raise ValueError("madeline path not found: {}".format(mad_path))
        with mad_path.open('r') as in_handle:
            case_data['madeline_info'] = in_handle.read()
    
    if (case_data['vcf_files']['vcf_cancer'] or case_data['vcf_files']['vcf_cancer_research']):
        case_data['track'] = 'cancer'
    
    return case_data
Parse case information from config or PED files.

    Args:
        config (dict): case config with detailed information

    Returns:
        dict: parsed case data