# Alignments track

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": { "color": { "field": "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
  ([BamAdapter](https://jbrowse.org/jb2/docs/config/bamadapter), [CramAdapter](https://jbrowse.org/jb2/docs/config/cramadapter))
- **`color`, `height`, `featureHeight`, `filter` and the coverage band's
  `scales.y`** are
  [`LinearAlignmentsDisplay`](https://jbrowse.org/jb2/docs/config/linearalignmentsdisplay) slots. Reads
  draw gray with mismatches marked until
  [`color`](https://jbrowse.org/jb2/docs/config/linearalignmentsdisplay/#slot-color) names a field —
  `strand`, `pairOrientation`, `insertSize` or `tags.XX` — and
  [`baseColor`](https://jbrowse.org/jb2/docs/config/linearalignmentsdisplay/#slot-basecolor) draws
  modifications or base quality over them; the
  [cookbook](https://jbrowse.org/jb2/docs/cookbook#alignments-tracks) has the coloring, grouping and
  flag-filter recipe
- **[`unit`](https://jbrowse.org/jb2/docs/config/linearalignmentsdisplay/#slot-unit) says what one row
  stands for**, a read or a chain of a read with its mate and split segments;
  [`facet`](https://jbrowse.org/jb2/docs/config/linearalignmentsdisplay/#slot-facet) stacks one
  labelled section per value of a read field (`pairOrientation`, `tags.HP`); and
  [`arcColor`](https://jbrowse.org/jb2/docs/config/linearalignmentsdisplay/#slot-arccolor) picks the
  pair field the read-connection arcs paint when it is not the reads'

[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

- **User guide:** [Alignments track](https://jbrowse.org/jb2/docs/user_guides/alignments_track)
- **User guide:** [Structural variant visualization](https://jbrowse.org/jb2/docs/user_guides/sv_visualization)
- **Config guide:** [Grouping and lane order](https://jbrowse.org/jb2/docs/config_guides/grouping_and_ordering)
