---
name: "samFilter"
section: "1"
platform: "linux"
package: "blasr"
version: "5.3+0-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/samFilter"
---

# samFilter(1)

filter nucleotide sequence alignments in SAM files

## NAME

samFilter - filter nucleotide sequence alignments in SAM files

## SYNOPSIS

**samFilter** *file.sam* *reference.fasta* *out.sam* \[*options*\]

## OPTIONS

- *file.sam*

  Input SAM file.

- *reference.fasta*

  Reference used to generate reads.

- *out.sam*

  Output SAM file.

- **-minAlnLength** *value*

  (50) Report alignments only if their lengths are greater than *value*.

- **-minAlignLength** *value*

  Alias of **-minAlnLength**

- **-minLength** *value*

  Alias of **-minAlnLength**

- **-minPctSimilarity** *value*

  -

  (70) Report alignments only if their percentage similairty is greater than *value .*

- **-minPctIdentity** *value*

  *Alias of* **-minPctSimilarity**

- **-minPctAccuracy** *value*

  (70) Report alignments only if their percentage accuray is greater than *value*.

- **-minAccuracy** *value*

  Alias of **-minPctAccuracy**

- **-hitPolicy** *value*

  (randombest) Specify a policy to treat multiple hits from \[all, allbest, random, randombest, leftmost\]

  - *all*

    report all alignments.

  - *allbest*

    report all equally top scoring alignments.

  - *random*

    report a random alignment.

  - *randombest*

    report a random alignment from multiple equally top scoring alignments.

  - *leftmost*

    report an alignment which has the best alignmentscore and has the smallest mapping coordinate in any reference.

- **-scoreSign** *value*

  (-1) Whether higher or lower scores are better.

  - \-1

    lower is better

  - 1

    higher is better.

- **-scoreCutoff** *value*

  (INF) Report alignments only if their scores are no worse than *value*.

- **-seed** *value*

  (1) Seed for random number generator. If seed is 0, then use current time as seed.

- **-holeNumbers** *value*

  A string of comma-delimited hole number ranges to output hits, such as '1,2,10-12'. This requires hit titles to be in SMRT read title format.

- **-smrtTitle**

  Use this option when filtering alignments generated by programs other than [**blasr**(1)](/blasr/1.md), e.g. bwa-sw or gmap. Parse read coordinates from the SMRT read title. The title is in the format */name/hole/coordinates*, where coordinates are in the format \\d+\_\\d+, and represent the interval of the read that was aligned.

- **-titleTable** *value*

  Use this experimental option when filtering alignments generated by [**blasr**(1)](/blasr/1.md) with **-titleTable** titleTableName, in which case reference titles in SAM are represented by their indices (e.g., 0, 1, 2, ...) in the title table.

- **-filterAdapterOnly** *value*

  Use this option to remove reads which can only map to adapters specified in the GFF file.

- **-v**

  Be verbose.

## NOTES

Because SAM has optional tags that have different meanings in different programs, careful usage is required in order to have proper output.  The "xs" tag in bwa-sw is used to show the suboptimal score, but in PacBio SAM ([**blasr**(1)](/blasr/1.md)) it is defined as the start in the query sequence of the alignment. When **-smrtTitle** is specified, the xs tag is ignored, but when it is not specified, the coordinates given by the xs and xe tags are used to define the interval of a read that is aligned.  The CIGAR string is relative to this interval.

## SEE ALSO

[**blasr**(1)](/blasr/1.md) [**loadPulses**(1)](/loadPulses/1.md) [**pls2fasta**(1)](/pls2fasta/1.md) [**samtoh5**(1)](/samtoh5/1.md) [**samtom4**(1)](/samtom4/1.md) [**sawriter**(1)](/sawriter/1.md) [**sdpMatcher**(1)](/sdpMatcher/1.md) [**toAfg**(1)](/toAfg/1.md)
