Skip to content

Commit

Permalink
[skip ci] Add some docs for configuring defaultSession
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Apr 19, 2023
1 parent ebb9cdf commit 48be652
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 3 deletions.
114 changes: 114 additions & 0 deletions website/docs/config_guides/default_session.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
title: Default session
id: default_session
---

In JBrowse, a session refers to the particular state of the application e.g. the
views that are open, the tracks that are open, etc.

You can configure a "default session" in the config.json that can be used as the
default application state that is loaded for all your users.

The session is a representation of the 'internal state' of the app, so it can be
hard to programmatically write, but you can manually use the app, get to a state
you want it to be in, and then select "File->Export session". This will give you
a session.json file, and then you can copy the "session" from this file into the
"defaultSession" in your config.json

Example session (reduced for example purposes)

```json
{
"session": {
"id": "eXr4hv4VX",
"name": "Session",
"views": [
{
"id": "eXr4hv4VX-view",
"type": "LinearGenomeView",
"offsetPx": 14500,
"bpPerPx": 1.7,
"displayedRegions": [
{
"refName": "ctgA",
"start": 0,
"end": 50001,
"reversed": false,
"assemblyName": "volvox"
}
]
}
]
}
}
```

Then copy the above into your config.json in the "defaultSession", for example:

```json
{
"assemblies": [
{
"name": "volvox",
"aliases": ["vvx"],
"sequence": {
"type": "ReferenceSequenceTrack",
"trackId": "volvox_refseq",
"adapter": {
"type": "TwoBitAdapter",
"twoBitLocation": {
"uri": "volvox.2bit"
}
}
}
}
],
"defaultSession": {
"id": "eXr4hv4VX",
"name": "Session",
"views": [
{
"id": "eXr4hv4VX-view",
"type": "LinearGenomeView",
"offsetPx": 14500,
"bpPerPx": 1.7,
"displayedRegions": [
{
"refName": "ctgA",
"start": 0,
"end": 50001,
"reversed": false,
"assemblyName": "volvox"
}
]
}
]
},
"tracks": [
{
"type": "VariantTrack",
"trackId": "variants",
"name": "variants",
"assemblyNames": ["volvox"],
"adapter": {
"type": "VcfTabixAdapter",
"vcfGzLocation": {
"uri": "volvox.dup.vcf.gz"
},
"index": {
"location": {
"uri": "volvox.dup.vcf.gz.tbi"
}
}
}
}
]
}
```

:::info

Note: if you want to programmatically configure sessions using the URL, see
https://jbrowse.org/jb2/docs/urlparams/

:::
12 changes: 9 additions & 3 deletions website/docs/config_guides/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ config.json) and is structured as follows

The most important thing to configure are your assemblies and your tracks.

:::info Note On jbrowse desktop, a "session" refers to a config.json with a
.jbrowse file extension :::
:::info

:::info Note On embedded e.g. with @jbrowse/react-linaer-genome-view, it does
Note: On jbrowse desktop, a "session" refers to a config.json with a .jbrowse
file extension

:::

:::info

Note: with embedded components e.g. @jbrowse/react-linaer-genome-view, it does
not accept a config file but rather an object at runtime with the config loaded.

To fetch a config.json object on the fly in @jbrowse/react-linear-genome-view,
Expand Down

0 comments on commit 48be652

Please sign in to comment.