def run(items):
    """Normalization and log2 ratio calculation plus CNV calling for full cohort.

    - Combine coverage of each region for each sample
    - Prepare read counts for each sample
    - Normalize coverages in cohort by gene and sample, and calculate log2 ratios
    - Call amplifications and deletions
    """
    items = [utils.to_single_data(x) for x in items]
    work_dir = _sv_workdir(items[0])

    input_backs = list(set(filter(lambda x: x is not None,
                                  [dd.get_background_cnv_reference(d, "seq2c") for d in items])))
    coverage_file = _combine_coverages(items, work_dir, input_backs)
    read_mapping_file = _calculate_mapping_reads(items, work_dir, input_backs)
    normal_names = []
    if input_backs:
        with open(input_backs[0]) as in_handle:
            for line in in_handle:
                if len(line.split()) == 2:
                    normal_names.append(line.split()[0])
    normal_names += [dd.get_sample_name(x) for x in items if population.get_affected_status(x) == 1]
    seq2c_calls_file = _call_cnv(items, work_dir, read_mapping_file, coverage_file, normal_names)
    items = _split_cnv(items, seq2c_calls_file, read_mapping_file, coverage_file)
    return items
def run ( items ) : items = [ utils . to_single_data ( x ) for x in items ] work_dir = _sv_workdir ( items [ 0 ] ) input_backs = list ( set ( filter ( lambda x : x is not None , [ dd . get_background_cnv_reference ( d , "seq2c" ) for d in items ] ) ) ) coverage_file = _combine_coverages ( items , work_dir , input_backs ) read_mapping_file = _calculate_mapping_reads ( items , work_dir , input_backs ) normal_names = [ ] if input_backs : with open ( input_backs [ 0 ] ) as in_handle : for line in in_handle : if len ( line . split ( ) ) == 2 : normal_names . append ( line . split ( ) [ 0 ] ) normal_names += [ dd . get_sample_name ( x ) for x in items if population . get_affected_status ( x ) == 1 ] seq2c_calls_file = _call_cnv ( items , work_dir , read_mapping_file , coverage_file , normal_names ) items = _split_cnv ( items , seq2c_calls_file , read_mapping_file , coverage_file ) return items
Normalization and log2 ratio calculation plus CNV calling for full cohort.

    - Combine coverage of each region for each sample
    - Prepare read counts for each sample
    - Normalize coverages in cohort by gene and sample, and calculate log2 ratios
    - Call amplifications and deletions