def run_star(job, fastqs, univ_options, star_options):
    assert star_options['type'] in ('star', 'starlong')
    work_dir = os.getcwd()
    input_files = {
        'rna_cutadapt_1.fastq': fastqs[0],
        'rna_cutadapt_2.fastq': fastqs[1],
        'star_index.tar.gz': star_options['index']}
    input_files = get_files_from_filestore(job, input_files, work_dir,
                                           docker=False)
    gz = '.gz' if is_gzipfile(input_files['rna_cutadapt_1.fastq']) else ''
    if gz:
        for read_file in 'rna_cutadapt_1.fastq', 'rna_cutadapt_2.fastq':
            os.symlink(read_file, read_file + gz)
            input_files[read_file + gz] = input_files[read_file] + gz
    input_files['star_index'] = untargz(input_files['star_index.tar.gz'], work_dir)
    star_fusion_idx = os.path.join(input_files['star_index'], 'ref_genome.fa.star.idx')
    if os.path.exists(star_fusion_idx):
        input_files['star_index'] = star_fusion_idx
    input_files = {key: docker_path(path, work_dir=work_dir) for key, path in input_files.items()}
    parameters = ['--runThreadN', str(star_options['n']),
                  '--genomeDir', input_files['star_index'],
                  '--twopassMode', 'Basic',
                  '--outReadsUnmapped', 'None',
                  '--chimSegmentMin', '12',
                  '--chimJunctionOverhangMin', '12',
                  '--alignSJDBoverhangMin', '10',
                  '--alignMatesGapMax', '200000',
                  '--alignIntronMax', '200000',
                  '--chimSegmentReadGapMax', 'parameter', '3',
                  '--alignSJstitchMismatchNmax', '5', '-1', '5', '5',
                  '--outFileNamePrefix', 'rna',
                  '--readFilesIn',
                  input_files['rna_cutadapt_1.fastq' + gz],
                  input_files['rna_cutadapt_2.fastq' + gz],
                  '--outSAMattributes', 'NH', 'HI', 'AS', 'NM', 'MD',
                  '--outSAMtype', 'BAM', 'Unsorted',
                  '--quantMode', 'TranscriptomeSAM']
    if gz:
        parameters.extend(['--readFilesCommand', 'zcat'])
    if star_options['type'] == 'star':
        docker_call(tool='star', tool_parameters=parameters, work_dir=work_dir,
                    dockerhub=univ_options['dockerhub'], tool_version=star_options['version'])
    else:
        docker_call(tool='starlong', tool_parameters=parameters, work_dir=work_dir,
                    dockerhub=univ_options['dockerhub'], tool_version=star_options['version'])
    output_files = defaultdict()
    for output_file in ['rnaAligned.toTranscriptome.out.bam',
                     'rnaAligned.out.bam',
                     'rnaChimeric.out.junction']:
        output_files[output_file] = job.fileStore.writeGlobalFile('/'.join([work_dir, output_file]))
    export_results(job, output_files['rnaAligned.toTranscriptome.out.bam'], 'rna_transcriptome.bam',
                   univ_options, subfolder='alignments')
    export_results(job, output_files['rnaChimeric.out.junction'], 'rna_chimeric.junction',
                   univ_options, subfolder='mutations/fusions')
    job.fileStore.logToMaster('Ran STAR on %s successfully' % univ_options['patient'])
    return output_files