scout/parse/clinvar.py
def clinvar_submission_header(submission_objs, csv_type):
    """Determine which fields to include in csv header by checking a list of submission objects

        Args:
            submission_objs(list): a list of objects (variants or casedata) to include in a csv file
            csv_type(str) : 'variant_data' or 'case_data'

        Returns:
            custom_header(dict): A dictionary with the fields required in the csv header. Keys and values are specified in CLINVAR_HEADER and CASEDATA_HEADER

    """

    complete_header = {} # header containing all available fields
    custom_header = {}   # header reflecting the real data included in the submission objects
    if csv_type == 'variant_data' :
        complete_header = CLINVAR_HEADER
    else:
        complete_header = CASEDATA_HEADER

    for header_key, header_value in complete_header.items(): # loop over the info fields provided in each submission object
        for clinvar_obj in submission_objs: # loop over the submission objects
            for key, value in clinvar_obj.items(): # loop over the keys and values of the clinvar objects

                if not header_key in custom_header and header_key == key: # add to custom header if missing and specified in submission object
                    custom_header[header_key] = header_value

    return custom_header
def clinvar_submission_header(submission_objs, csv_type):
    complete_header = {} # header containing all available fields
    custom_header = {}   # header reflecting the real data included in the submission objects
    if csv_type == 'variant_data' :
        complete_header = CLINVAR_HEADER
    else:
        complete_header = CASEDATA_HEADER

    for header_key, header_value in complete_header.items(): # loop over the info fields provided in each submission object
        for clinvar_obj in submission_objs: # loop over the submission objects
            for key, value in clinvar_obj.items(): # loop over the keys and values of the clinvar objects

                if not header_key in custom_header and header_key == key: # add to custom header if missing and specified in submission object
                    custom_header[header_key] = header_value

    return custom_header
def clinvar_submission_header ( submission_objs , csv_type ) : complete_header = { } # header containing all available fields custom_header = { } # header reflecting the real data included in the submission objects if csv_type == 'variant_data' : complete_header = CLINVAR_HEADER else : complete_header = CASEDATA_HEADER for header_key , header_value in complete_header . items ( ) : # loop over the info fields provided in each submission object for clinvar_obj in submission_objs : # loop over the submission objects for key , value in clinvar_obj . items ( ) : # loop over the keys and values of the clinvar objects if not header_key in custom_header and header_key == key : # add to custom header if missing and specified in submission object custom_header [ header_key ] = header_value return custom_header
Determine which fields to include in csv header by checking a list of submission objects

        Args:
            submission_objs(list): a list of objects (variants or casedata) to include in a csv file
            csv_type(str) : 'variant_data' or 'case_data'

        Returns:
            custom_header(dict): A dictionary with the fields required in the csv header. Keys and values are specified in CLINVAR_HEADER and CASEDATA_HEADER
Determine which fields to include in csv header by checking a list of submission objects