JBrowseConfig API

class JBrowseConfig(view='LGV', conf=None)

Creates JBrowse configuration objects. Currently supporting configuration objects for the React JBrowse Linear Genome View and React JBrowse Circular Genome View https://jbrowse.org/storybook/lgv/main https://jbrowse.org/storybook/cgv/main/

add_df_track(track_data, name, **kwargs)

Adds track from a pandas DataFrame. If the score column is present, it will create a Quantitative track else it will create a Feature track.

Requires DataFrame to have columns named ‘refName’, ‘start’, ‘end’, and ‘name’

Requires refName and name columns to be of type str and start, end, and score to be int

e.g: add_df_track(df, “track_name”)

Parameters
  • df – panda DataFrame with the track data.

  • name (str) – name for the track.

  • track_id (str) – (optional) trackId for the track

  • overwrite (str) – flag wether or not to overwrite existing track.

Raises
  • Exception – if assembly has not been configured.

  • TypeError – if track data is invalid

  • TypeError – if view is not LGV

  • TypeError – if track with that trackId already exists list of tracks

add_text_search_adapter(ix_path, ixx_path, meta_path, adapter_id=None)

Adds an aggregate trix text search adapter. Currently not available for Circular Genome View

e.g: add_text_search_adapter(“url/file.ix”, url/file.ixx”, “url/meta.json”)

Parameters
  • ix_path (str) – path to ix file

  • ixx_path (str) – path to ixx file

  • meta_path (str) – path to meta.json file

  • adapter_id (str) – optional adapter_id

Raises
  • Exception – if assembly has not been configured

  • TypeError – if adapter with same adapter id is already configured

  • TypeError – local files are not supported

  • TypeError – if view is CGV

add_track(data, **kwargs)

Adds a track subconfiguration to the list of tracks in the config.

if an index is not provided, it will assume an index file with the same name can be found in the directory of the track data

e.g: add_track(“url.bam”) assumes “url.bam.bai” also exists

Parameters
  • data (str) – track file or url (currently only supporting url)

  • name (str) – (optional) name for the track (defaults to data filename)

  • track_id (str) – (optional) trackId for the track

  • index (str) – (optional) index file for the track

  • track_type (str) – (optional) track type

  • overwrite (boolean) – (optional) defaults to False

Raises
  • Exception – if assembly has not been configured

  • TypeError – if track data is not provided

  • TypeError – if track type is not supported

get_config()

Returns the configuration object of the JBrowseConfig instance. This object can then be passed to launch or create_component to launch or create a Dash JBrowse component

e.g: create(“LGV”, genome=”hg19”).get_config()

Returns

returns configuration object

Return type

obj

set_assembly(assembly_data, **kwargs)

Sets the assembly.

Assumes assembly_data.fai exists for fasta assembly data that is not bgzipped.

Assumes assembly_data.fai and assembly_data.gzi exist for bgzipped assembly data.

e.g set_assembly(“url/assembly.fasta.gz”, overwrite=True) assumes “url/assembly.fasta.gz.fai” and “url/assembly.fasta.gz.gzi” also exist

For configuring assemblies check out our config docs https://jbrowse.org/jb2/docs/config_guide/#assembly-config

Parameters
  • assembly_data (str) – path to the sequence data

  • name (str) – (optional) name for the assembly, defaults to name generated from assembly_data file name

  • aliases (list) – (optional) list of aliases for the assembly

  • refname_aliases (obj) – (optional) config for refname aliases.

  • overwrite (str) – flag wether or not to overwrite existing assembly, default to False.

Raises
  • TypeError – if assembly_data is a local file

  • TypeError – adapter used for file type is not supported or recognized

set_default_session(tracks_ids, display_assembly=True)

Sets the default session given a list of track ids

e.g: set_default_session([‘track_id’, ‘track_id2’])

Parameters
  • tracks_ids – list[str] list of track ids to display

  • display_assembly (boolean) – display the assembly reference sequence track. Defaults to True

Raises

Exception – if assembly has not been configured

set_location(location)

Sets initial location for when the browser first loads.

e.g: set_location(“chr1:1..90”)

Parameters

location (str) – location, syntax ‘refName:start-end’

Raises

TypeError – if view is CGV, location not supported in CGV

set_theme(primary, secondary=None, tertiary=None, quaternary=None)

Sets the theme in the configuration. Accepts up to 4 hexadecimal colors.

e.g: set_theme(“#311b92”, “#0097a7”, “#f57c00”, “#d50000”)

Parameters
  • primary (str) – primary color of custom palette

  • secondary (str) – (optional) secondary color

  • tertiary (str) – (optional) tertiary color

  • quaternary (str) – (optional) quaternary color