<s>
SAMtools	B-Application
is	O
a	O
set	O
of	O
utilities	O
for	O
interacting	O
with	O
and	O
post-processing	O
short	O
DNA	O
sequence	O
read	O
alignments	O
in	O
the	O
SAM	O
(	O
Sequence	O
Alignment/Map	O
)	O
,	O
BAM	O
(	O
Binary	O
Alignment/Map	O
)	O
and	O
CRAM	O
formats	O
,	O
written	O
by	O
Heng	O
Li	O
.	O
</s>
<s>
Both	O
simple	O
and	O
advanced	O
tools	O
are	O
provided	O
,	O
supporting	O
complex	O
tasks	O
like	O
variant	O
calling	O
and	O
alignment	O
viewing	O
as	O
well	O
as	O
sorting	O
,	O
indexing	O
,	O
data	O
extraction	O
and	O
format	B-General_Concept
conversion	I-General_Concept
.	O
</s>
<s>
SAMtools	B-Application
makes	O
it	O
possible	O
to	O
work	O
directly	O
with	O
a	O
compressed	O
BAM	O
file	O
,	O
without	O
having	O
to	O
uncompress	O
the	O
whole	O
file	O
.	O
</s>
<s>
Additionally	O
,	O
since	O
the	O
format	O
for	O
a	O
SAM/BAM	O
file	O
is	O
somewhat	O
complex	O
-	O
containing	O
reads	O
,	O
references	O
,	O
alignments	O
,	O
quality	O
information	O
,	O
and	O
user-specified	O
annotations	O
-	O
SAMtools	B-Application
reduces	O
the	O
effort	O
needed	O
to	O
use	O
SAM/BAM	O
files	O
by	O
hiding	O
low-level	O
details	O
.	O
</s>
<s>
As	O
third-party	O
projects	O
were	O
trying	O
to	O
use	O
code	O
from	O
SAMtools	B-Application
despite	O
it	O
not	O
being	O
designed	O
to	O
be	O
embedded	O
in	O
that	O
way	O
,	O
the	O
decision	O
was	O
taken	O
in	O
August	O
2014	O
to	O
split	O
the	O
SAMtools	B-Application
package	O
into	O
a	O
stand-alone	O
software	O
library	O
with	O
a	O
well-defined	O
API	B-General_Concept
(	O
HTSlib	O
)	O
,	O
a	O
project	O
for	O
variant	O
calling	O
and	O
manipulation	O
of	O
variant	O
data	O
(	O
BCFtools	O
)	O
,	O
and	O
the	O
stand-alone	O
SAMtools	B-Application
package	O
for	O
working	O
with	O
sequence	B-Algorithm
alignment	I-Algorithm
data	O
.	O
</s>
<s>
Like	O
many	O
Unix	B-Application
commands	O
,	O
SAMtool	O
commands	O
follow	O
a	O
stream	B-Architecture
model	O
,	O
where	O
data	O
runs	O
through	O
each	O
command	O
as	O
if	O
carried	O
on	O
a	O
conveyor	O
belt	O
.	O
</s>
<s>
If	O
not	O
specified	O
,	O
the	O
standard	B-Operating_System
streams	I-Operating_System
(	O
stdin	O
,	O
stdout	O
,	O
and	O
stderr	O
)	O
are	O
assumed	O
.	O
</s>
<s>
Data	O
sent	O
to	O
stdout	O
are	O
printed	O
to	O
the	O
screen	O
by	O
default	O
but	O
are	O
easily	O
redirected	O
to	O
another	O
file	O
using	O
the	O
normal	O
Unix	B-Application
redirectors	O
(	O
>	O
and	O
>>	O
)	O
,	O
or	O
to	O
another	O
command	O
via	O
a	O
pipe	O
( |	O
)	O
.	O
</s>
<s>
SAMtools	B-Application
provides	O
the	O
following	O
commands	O
,	O
each	O
invoked	O
as	O
""	O
.	O
</s>
<s>
An	O
index	O
of	O
the	O
input	O
file	O
is	O
required	O
for	O
extracting	O
reads	O
according	O
to	O
their	O
mapping	O
position	O
in	O
the	O
reference	O
genome	O
,	O
as	O
created	O
by	O
samtools	B-Application
index	O
.	O
</s>
<s>
These	O
headers	O
include	O
a	O
description	O
of	O
the	O
reference	O
that	O
the	O
reads	O
in	O
sample_sorted.bam	O
were	O
aligned	O
to	O
and	O
will	O
be	O
needed	O
if	O
the	O
tiny_sorted.bam	O
file	O
is	O
to	O
be	O
used	O
with	O
some	O
of	O
the	O
more	O
advanced	O
SAMtools	B-Application
commands	O
.	O
</s>
