def run_rsem(job, bam_id, rsem_ref_url, paired=True):
work_dir = job.fileStore.getLocalTempDir()<EOL>download_url(job, url=rsem_ref_url, name='<STR_LIT>', work_dir=work_dir)<EOL>subprocess.check_call(['<STR_LIT>', '<STR_LIT>', os.path.join(work_dir, '<STR_LIT>'), '<STR_LIT>', work_dir])<EOL>os.remove(os.path.join(work_dir, '<STR_LIT>'))<EOL>rsem_files = []<EOL>for root, directories, files in os.walk(work_dir):<EOL><INDENT>rsem_files.extend([os.path.join(root, x) for x in files])<EOL><DEDENT>ref_prefix = [os.path.basename(os.path.splitext(x)[<NUM_LIT:0>]) for x in rsem_files if '<STR_LIT>' in x][<NUM_LIT:0>]<EOL>ref_folder = os.path.join('<STR_LIT>', os.listdir(work_dir)[<NUM_LIT:0>]) if len(os.listdir(work_dir)) == <NUM_LIT:1> else '<STR_LIT>'<EOL>job.fileStore.readGlobalFile(bam_id, os.path.join(work_dir, '<STR_LIT>'))<EOL>output_prefix = '<STR_LIT>'<EOL>parameters = ['<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>', str(job.cores),<EOL>'<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>',<EOL>os.path.join(ref_folder, ref_prefix),<EOL>output_prefix]<EOL>if paired:<EOL><INDENT>parameters = ['<STR_LIT>'] + parameters<EOL><DEDENT>dockerCall(job=job, tool='<STR_LIT>',<EOL>parameters=parameters, workDir=work_dir)<EOL>gene_id = job.fileStore.writeGlobalFile(os.path.join(work_dir, output_prefix + '<STR_LIT>'))<EOL>isoform_id = job.fileStore.writeGlobalFile(os.path.join(work_dir, output_prefix + '<STR_LIT>'))<EOL>return gene_id, isoform_id<EOL>
RNA quantification with RSEM

:param JobFunctionWrappingJob job: Passed automatically by Toil
:param str bam_id: FileStoreID of transcriptome bam for quantification
:param str rsem_ref_url: URL of RSEM reference (tarball)
:param bool paired: If True, uses parameters for paired end data
:return: FileStoreIDs for RSEM's gene and isoform output
:rtype: str