Manual page from samtools-1.16
released on 18 August 2022

NAME

samtools samples – prints the samples from an alignment file

SYNOPSIS

samtools samples [options] (<input>|stdin)

samtools samples [options] -X f1.bam f2.bam ... f1.bam.bai f2.bam.bai ...

DESCRIPTION

Print the sample names found in the read-groups and the path to the reference genome from alignment files. The output of this tool can be used to create an input for any popular workflow manager. The input is a list of SAM/BAM/CRAM files, or the path to those files can be provided via stdin. The output is tab-delimited containing the sample name as the first column, the path to the alignment file as the second column, the path to the reference genome as a third optional column and a single character flag (Y/N) indicating whether the alignment file is indexed or not as a fourth optional column. If no reference is found for an alignment, a dot (.) will be used in the reference path column. If no sample is available in any read-group header, a dot (.) will be used as the sample name. If a BAM file contains more than one sample, one line will be printed for each sample.

OPTIONS

-?

print help and exit

-h

print a header

-i

test if the file is indexed. Add an extra column to the output with a single character value (Y/N).

-T TAG

provide the sample tag name from the @RG line [SM].

-o FILE

output file [stdout].

-f FILE

load an indexed fasta file in the collection of references. Can be used multiple times. Add an extra column with the path to the reference file.

-F FILE

read a file containing the paths to indexed fasta files. One path per line.

-X

use a custom index file.

EXAMPLES

AUTHOR

Written by Pierre Lindenbaum from Institut du Thorax U1087, Nantes, France.

Samtools website: <http://www.htslib.org/>