Category

Sam/Bam Manipulation


Usage

samtools view -o [OUTPUT SAM] [-h|-H] [INPUT BAM]


Manual

-b
Output in the BAM format.
-C
Output in the CRAM format (requires -T).
-1
Enable fast BAM compression (implies -b).
-u
Output uncompressed BAM. This option saves time spent on compression/decompression and is thus preferred when the output is piped to another samtools command.
-h
Include the header in the output.
-H
Output the header only.
-c
Instead of printing the alignments, only count them and print the total number. All filter options, such as -f, -F, and -q, are taken into account.
-?
Output long help and exit immediately.
-o FILE
Output to FILE [stdout].
-U FILE
Write alignments that are not selected by the various filter options to FILE. When this option is used, all alignments (or all alignments intersecting the regions specified) are written to either the output file or this file, but never both.
-t FILE
A tab-delimited FILE. Each line must contain the reference name in the first column and the length of the reference in the second column, with one line for each distinct reference. Any additional fields beyond the second column are ignored. This file also defines the order of the reference sequences in sorting. If you run: `samtools faidx ', the resulting index file .fai can be used as this FILE.
-T FILE
A FASTA format reference FILE, optionally compressed by bgzip and ideally indexed by samtools faidx. If an index is not present, one will be generated for you.
-L FILE
Only output alignments overlapping the input BED FILE [null].
-r STR
Only output alignments in read group STR [null].
-R FILE
Output alignments in read groups listed in FILE [null].
-q INT
Skip alignments with MAPQ smaller than INT [0].
-l STR
Only output alignments in library STR [null].
-m INT
Only output alignments with number of CIGAR bases consuming query sequence ≥ INT [0]
-f INT
Only output alignments with all bits set in INT present in the FLAG field. INT can be specified in hex by beginning with `0x' (i.e. /^0x[0-9A-F]+/) or in octal by beginning with `0' (i.e. /^0[0-7]+/) [0].
-F INT
Do not output alignments with any bits set in INT present in the FLAG field. INT can be specified in hex by beginning with `0x' (i.e. /^0x[0-9A-F]+/) or in octal by beginning with `0' (i.e. /^0[0-7]+/) [0].
-x STR
Read tag to exclude from output (repeatable) [null]
-B
Collapse the backward CIGAR operation.
-s FLOAT
Integer part is used to seed the random number generator [0]. Part after the decimal point sets the fraction of templates/pairs to subsample [no subsampling].
-@ INT
Number of BAM compression threads to use in addition to main thread [0].
-S
Ignored for compatibility with previous samtools versions. Previously this option was required if input was in SAM format, but now the correct format is automatically detected by examining the first few characters of input.

Protocols using this tool

Identifying RNA editing sites using RNA sequencing data alonePROcap preprocessing (with two replicates)

Share your experience or ask a question