# 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`.

Example `AlignmentsTrack` config:

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

## Adapter options

The `uri` shorthand above resolves the index for you (`<uri>.bai` for a BAM,
`<uri>.crai` for a CRAM), so most tracks need nothing else. Add `"csi": true`
alongside `uri` for a CSI-indexed BAM. See
[the `uri` shorthand](https://jbrowse.org/jb2-staging/docs/config_guides/file_types#the-uri-shorthand) for when
to spell out the location slots, and when CSI is required.

CRAM decodes against the reference sequence; both adapters take their
`sequenceAdapter` from the enclosing assembly automatically.

See the [](https://jbrowse.org/jb2-staging/docs/config/bamadapter) and [](https://jbrowse.org/jb2-staging/docs/config/cramadapter) config docs
for all options.

## Display options

Display settings (`colorBy`, `height`, `featureHeight`, `filterBy`, and the
coverage `autoscale`/`minScore`/`maxScore`) are slots on the
`LinearAlignmentsDisplay`. By default every read is drawn the same gray with its
mismatches marked;
[`colorBy`](https://jbrowse.org/jb2-staging/docs/config/linearalignmentsdisplay/#slot-colorby) colors the reads
by strand, pair orientation, insert size, a tag, and so on. Set one with the
track's
[`displayDefaults` shorthand](https://jbrowse.org/jb2-staging/docs/config_guides/tracks/#configuring-displays):

```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 }
}
```

See the
[LinearAlignmentsDisplay config docs](https://jbrowse.org/jb2-staging/docs/config/linearalignmentsdisplay) for
the full list of slots. To open a track in a particular state from a link or
embedded view, see
[applying display settings](https://jbrowse.org/jb2-staging/docs/tutorials/display_settings).

## See also

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

