Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some docs for configuring defaultSession #3654

Merged
merged 1 commit into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions website/docs/config_guides/default_session.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
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",
"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-linear-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