Forrest logo
back to the samtools tool

samtools:tldr:14572

samtools: Merge multiple files.
$ samtools merge ${output} ${input1 input2 …}
try on your machine

This command uses the samtools tool to merge multiple input files into a single output file. Here is a breakdown of the command:

  • "samtools" is the command-line tool for manipulating SAM/BAM files, which are commonly used in bioinformatics for storing DNA sequence alignments.
  • "merge" is the specific command in samtools to merge multiple files together.
  • "${output}" is a placeholder for the name of the output file that will be created. You need to provide the actual name or path of the output file in your command.
  • "${input1 input2 …}" is a placeholder for the names of the input files that you want to merge. You need to provide one or more input file names or paths separated by spaces in your command.

For example, if you have two input files named "file1.bam" and "file2.bam" that you want to merge into a single output file named "merged.bam", the command would be:

samtools merge merged.bam file1.bam file2.bam

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the samtools tool