Gene Expression Analysis


convert-sam-for-rsem [options] <input.sam/input.bam/input.cram> output_file_name


This program converts the SAM/BAM file generated by user's aligner into a BAM file which RSEM can process. However, users should make sure their aligners use 'reference_name.idx.fa' generated by rsem-prepare-reference as their references and output header sections. This program will create a temporary directory called 'output_file_name.bam.temp' to store the intermediate files. The directory will be deleted automatically after the conversion. After the conversion, this program will call rsem-sam-validator to validate the resulting BAM file.

Note: You do not need to run this script if rsem-sam-validator reports that your SAM/BAM file is valid.

Note: This program does not check the correctness of input file. You should make sure the input is a valid SAM/BAM format file.


  • input.sam/input.bam: The SAM or BAM file generated by user's aligner. We require this file contains the header section. If input is a SAM file, it must end with suffix 'sam' (case insensitive). If input is a BAM file, it must end with suffix 'bam' (case insensitive).
  • output_file_name: The output name for the converted file. convert-sam-for-rsem will output a BAM with the name 'output_file_name.bam'.


  • -T/--temporary-directory convert-sam-for-rsem will call sort command and this is the -T/--temporary-directory option of sort command.
  • -h/--help: Show help information.


Suppose input is set to 'input.sam' and output file name is "output"

convert-sam-for-rsem input.sam output

We will get a file called 'output.bam' as output.

Share your experience or ask a question