index and output bam