![Forrest logo](/images/logo.png)
samtools:tldr:daa86
samtools: Convert a SAM input file to BAM stream and save to file.
$ samtools view -S -b ${input-sam} > ${output-bam}
try on your machine
This command is a command-line instruction using the samtools
software. samtools
is a widely-used bioinformatics tool for manipulating and working with files in the Sequence Alignment/Map (SAM/BAM) format commonly used in genomics.
The command is as follows:
samtools
: This is the name of the command-line tool itself.view
: This sub-command is used to view contents of a SAM/BAM file.-S
: This option specifies that the input file is in SAM format.-b
: This option specifies that the output should be in BAM format, which is a binary version of the SAM format with better compression and indexing capabilities.${input-sam}
: This is a placeholder variable representing the path or name of the input SAM file. It is expected to be replaced with the actual file name or path when executing the command.>
: This is a redirect operator used to redirect the output of the command to a file instead of the standard output stream.${output-bam}
: This is a placeholder variable representing the path or name of the output BAM file. It is expected to be replaced with the desired file name or path when executing the command.
In summary, this command takes an input SAM file (${input-sam}
), converts it into the BAM format, and saves the resulting binary BAM file to a specified output file (${output-bam}
). The >
operator is used to redirect the output to the specified file.
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.