This module will aggregate all the mutations called in the previous steps and will then call
    snpeff on the results.

    ARGUMENTS
    1. fusion_output: <JSid for vcf generated by the fusion caller>
    2. radia_output: <JSid for vcf generated by radia>
    3. mutect_output: <JSid for vcf generated by mutect>
    4. indel_output: <JSid for vcf generated by the indel caller>

    RETURN VALUES
    1. output_file: <JSid for merged vcf>

    This module corresponds to node 15 on the tree

def run_mutation_aggregator(job, fusion_output, radia_output, mutect_output, indel_output,
                            univ_options):
    """
    This module will aggregate all the mutations called in the previous steps and will then call
    snpeff on the results.

    ARGUMENTS
    1. fusion_output: <JSid for vcf generated by the fusion caller>
    2. radia_output: <JSid for vcf generated by radia>
    3. mutect_output: <JSid for vcf generated by mutect>
    4. indel_output: <JSid for vcf generated by the indel caller>

    RETURN VALUES
    1. output_file: <JSid for merged vcf>

    This module corresponds to node 15 on the tree
    """
    job.fileStore.logToMaster('Aggregating mutations for %s' % univ_options['patient'])
    work_dir = job.fileStore.getLocalTempDir()
    input_files = {
        'mutect.vcf': mutect_output,
        'radia.vcf': radia_output['radia_parsed_filter_passing_calls.vcf'],
        'indel.vcf': indel_output,
        'fusion.vcf': fusion_output}
    input_files = get_files_from_filestore(job, input_files, work_dir, docker=False)
    # Modify these once INDELs and Fusions are implemented
    input_files.pop('indel.vcf')
    input_files.pop('fusion.vcf')
    # read files into memory
    vcf_file = defaultdict()
    mutcallers = input_files.keys()
    with open(''.join([work_dir, '/', univ_options['patient'], '_merged_mutations.vcf']),
              'w') as merged_mut_file:
        for mut_caller in mutcallers:
            caller = mut_caller.rstrip('.vcf')
            vcf_file[caller] = defaultdict()
            with open(input_files[mut_caller], 'r') as mutfile:
                for line in mutfile:
                    if line.startswith('#'):
                        if caller == 'radia':
                            print(line.strip(), file=merged_mut_file)
                        continue
                    line = line.strip().split()
                    vcf_file[caller][(line[0], line[1], line[3], line[4])] = line
    # This method can be changed in the future to incorporate more callers and
    # fancier integration methods
    merge_vcfs(vcf_file, merged_mut_file.name)
    export_results(merged_mut_file.name, univ_options)
    output_file = job.fileStore.writeGlobalFile(merged_mut_file.name)
    return output_file