Parse a dict of patient entries to retain only the useful entries (The user may provide more
    than we need and we don't want to download redundant things)

    :param dict patient_dict: The dict of patient entries parsed from the input config
    :param bool skip_fusions: A flag to identify if we're skipping fusions
    :return: A parsed dict of items
    :rtype: dict

def parse_patients(job, patient_dict, skip_fusions=False):
    """
    Parse a dict of patient entries to retain only the useful entries (The user may provide more
    than we need and we don't want to download redundant things)

    :param dict patient_dict: The dict of patient entries parsed from the input config
    :param bool skip_fusions: A flag to identify if we're skipping fusions
    :return: A parsed dict of items
    :rtype: dict
    """
    output_dict = {'ssec_encrypted': patient_dict.get('ssec_encrypted') in (True, 'True', 'true'),
                   'patient_id': patient_dict['patient_id'],
                   'tumor_type': patient_dict['tumor_type'],
                   'filter_for_OxoG': patient_dict.get('filter_for_OxoG') in (True, 'True', 'true')}
    out_keys = set()

    if 'hla_haplotype_files' not in patient_dict:
        # If we don't have the haplotype, we necessarily need all the fastqs
        for stype in 'tumor_dna', 'normal_dna', 'tumor_rna':
            out_keys.update([x for x in patient_dict if x.startswith(stype + '_fastq')])
    else:
        out_keys.add('hla_haplotype_files')

    if 'mutation_vcf' in patient_dict:
        out_keys.add('mutation_vcf')
        # We either need a genome mapped RNA bam or fastqs for this to work
        if 'tumor_rna_bam' in patient_dict:
            out_keys.add('tumor_rna_bam')
            if 'tumor_rna_bai' in patient_dict:
                out_keys.add('tumor_rna_bai')
        else:
            out_keys.update([x for x in patient_dict if x.startswith('tumor_rna_fastq')])
    else:
        if 'fusion_bedpe' not in patient_dict:
            # We are not looking at just fusions so we either need 3 bams/fastqs to run ProTECT
            for stype in 'tumor_dna', 'normal_dna', 'tumor_rna':
                if stype + '_bam' in patient_dict:
                    out_keys.add(stype + '_bam')
                else:
                    out_keys.update([x for x in patient_dict if x.startswith(stype + '_fastq')])

    if 'expression_files' in patient_dict:
        out_keys.add('expression_files')
    else:
        # We need the transcriptome mapped RNA bam or fastqs
        if 'tumor_rna_transcriptome_bam' in patient_dict:
            out_keys.add('tumor_rna_transcriptome_bam')
        else:
            out_keys.update([x for x in patient_dict if x.startswith('tumor_rna_fastq')])

    if 'fusion_bedpe' in patient_dict:
        out_keys.add('fusion_bedpe')

    for key in out_keys:
        output_dict[key] = patient_dict[key]
    fastq1s = [x for x in output_dict if x.endswith('fastq_1')]
    for f in fastq1s:
        f = f[:-8]
        if f + '_fastq_2' not in output_dict:
            output_dict[f + '_fastq_2'] = get_fastq_2(job, patient_dict['patient_id'], f,
                                                      output_dict[f + '_fastq_1'])
    output_dict['gdc_inputs'] = [k for k, v in output_dict.items() if str(v).startswith('gdc')]
    if not any('dna' in k for k in output_dict.keys()):
        # There are no input DNA files so we cannot filter for oxog
        output_dict['filter_for_OxoG'] = False
    return output_dict