Sharing views in JBrowse 2 is not as easy as it is in JBrowse 1, but there is also more power in the ability to share views and data. In JBrowse 1, the entire state of the “core” view is always encoded in the URL: if you copy the URL from the browser’s location bar and send it to someone, they will get the same view as the original user. This has several limits though: if the user has loaded local data, no information about it would get into the URL. The same is true if the user has created a sequence search track: that information is not encoded in the URL.
JBrowse 2, on the other hand, does not encode information about the view in the URL. Sending somebody the URL copied from the web browser’s location bar will only result in an error when somebody else tries to use it. The solution is to use the “Share” button at the top-center of the JBrowse page. Doing so produces a dialog box that will give you a few options:
JBrowse uses a built-in URL shortener to give a key and a password to resolve a JBrowse view. If you turn off the shortener (by tapping the “Settings” glyph above the URL), you will get a Very Long URL that encodes everything about the JBrowse session. Whether you use the shortened URL or the long session URL, it will include every view that is open, including the assemblies and locations, the tracks that are open, how tall each of those tracks are, and any user-added (ie, “Session”) tracks.
About user added (session) tracks
As mentioned above, if there is any user added data in the shared view, information about that data (the tracks and how they are configured) is included in the shared URL. How the JBrowse that opens that share link deals with the user added data depends on where the data is located. If the data is on a publicly accessible web server, the track displays just the same as any other JBrowse track. If however, the data is on a local hard drive or some non-public server, the recipient of the share URL will have to do a little extra work, and the sender of the link will have to let the recipient know how to access the data. For example, if the data is in the form of a file on the sender’s hard drive, the sender should also send a copy of the file that is the source for the track along with the JBrowse share URL, as well as an explanation of what to do (perhaps sending a link to this document).
When the recipient of a share link clicks on a link with a session track based on local data, the track will contain an error message and a link to cause a reload once the data is supplied, like this:
To rectify this situation, the recipient will have to open the track settings by clicking on the three dots either in the track label or the available tracks list and selecting “Settings” from the popup menu. That will open the track settings panel, and near the top of the settings will be an “adapter” section with a file browser “Choose file” button and a message that it needs to be reloaded:
When the user locates the file received from the sender with the operating system’s file browser, the recipient can then click the “RELOAD” button in the track error message and the track will reload and display as expected.