# Alignments track

**TL;DR:** point an `AlignmentsTrack` at a BAM or CRAM with the `uri` shorthand
and the index resolves automatically. Coloring, height, and filtering are slots
on the `LinearAlignmentsDisplay`, set via `displayDefaults`.

```json addtrack
{
  "type": "AlignmentsTrack",
  "trackId": "my_alignments_track",
  "name": "My Alignments",
  "assemblyNames": ["hg19"],
  "adapter": { "type": "BamAdapter", "uri": "https://yourhost/file.bam" },
  "displayDefaults": { "colorBy": { "type": "pairOrientation" }, "height": 250 }
}
```

- **The `uri` shorthand resolves the index** (`.bai` for a BAM, `.crai` for a
  CRAM); add `"csi": true` for a CSI-indexed BAM
  ([the `uri` shorthand](https://jbrowse.org/jb2/docs/config_guides/file_types#the-uri-shorthand))
- **CRAM decodes against the reference**, and both adapters take their
  `sequenceAdapter` from the enclosing assembly, so the track names none
  ([](https://jbrowse.org/jb2/docs/config/bamadapter), [](https://jbrowse.org/jb2/docs/config/cramadapter))
- **`colorBy`, `height`, `featureHeight`, `filterBy` and the coverage
  `autoscale`/`minScore`/`maxScore`** are
  [`LinearAlignmentsDisplay`](https://jbrowse.org/jb2/docs/config/linearalignmentsdisplay) slots. Reads
  draw gray with mismatches marked until
  [`colorBy`](https://jbrowse.org/jb2/docs/config/linearalignmentsdisplay/#slot-colorby) colors them by
  strand, pair orientation, insert size or a tag; the
  [cookbook](https://jbrowse.org/jb2/docs/cookbook#alignments-tracks) has the coloring, grouping and
  flag-filter recipe

[Applying display settings](https://jbrowse.org/jb2/docs/tutorials/display_settings) opens a track in a
given state from a link or an embedded view.

## See also

- [](https://jbrowse.org/jb2/docs/user_guides/alignments_track)
- [Structural variant visualization](https://jbrowse.org/jb2/docs/user_guides/sv_visualization)

