I am implementing a website in Python with Django framework and using django-plotly-dash to display data. I am trying to use dash_bio's IGV feature to display some chromosome data, but when I attempt to call the functionality, I receive the following errors and the callback that returns 'dashbio.igv' is unable to execute.
The errors displayed in the console:
HTML code receiving the Dash app with the dashbio.igv call: line 20 is where the dash object is returned and dashbio.igv goes.
{% plotly_app name=igv_app_name %}
This is the python file that returns the dashbio.igv in callback:
from dash import html, dcc
from dash.dependencies import Input, Output
import dash_bio as dashbio
import pandas as pd
import io
import plotly.express as px
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.views.generic import DetailView
from django_plotly_dash import DjangoDash
from django.contrib import messages
from .models import vcf_job
class IgvView(DetailView):
template_name = "rdr/igv.html"
model = vcf_job
context_object_name = "igv"
def get(self, request):
igv_app_name = 'igv_app'
igv_app = DjangoDash(igv_app_name)
HOSTED_GENOME_DICT = [
{'value': 'mm10', 'label': 'Mouse (GRCm38/mm10)'},
{'value': 'rn6', 'label': 'Rat (RGCS 6.0/rn6)'},
{'value': 'gorGor4', 'label': 'Gorilla (gorGor4.1/gorGor4)'},
{'value': 'panTro4', 'label': 'Chimp (SAC 2.1.4/panTro4)'},
{'value': 'panPan2', 'label': 'Bonobo (MPI-EVA panpan1.1/panPan2)'},
{'value': 'canFam3', 'label': 'Dog (Broad CanFam3.1/canFam3)'},
{'value': 'ce11', 'label': 'C. elegans (ce11)'}
]
igv_app.layout = html.Div(
children=[
dcc.Loading(id='default-igv-container'),
html.Hr(),
html.P('Select the genome to display below.'),
dcc.Dropdown(
id='default-igv-genome-select',
options=HOSTED_GENOME_DICT,
value='ce11',
style={
'height': '100% !important',
}
)
]
)
# Return the IGV component with the selected genome.
@igv_app.callback(
Output('default-igv-container', 'children'),
Input('default-igv-genome-select', 'value')
)
def return_igv(genome):
return html.Div([
# BUG
# following call is what causes the errors
dashbio.Igv(
id='default-igv',
genome=genome,
minimumBases=100,
)
])
context = {}
context["igv_app_name"] = igv_app_name
return render(request,self.template_name, context)