Scout: Error when creating general report

Created on 20 Feb 2020  ยท  22Comments  ยท  Source: Clinical-Genomics/scout

Traceback (most recent call last):
File "/home/hiseq.clinical/miniconda/envs/prod/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/home/hiseq.clinical/miniconda/envs/prod/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/hiseq.clinical/miniconda/envs/prod/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/hiseq.clinical/miniconda/envs/prod/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/hiseq.clinical/miniconda/envs/prod/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/home/hiseq.clinical/miniconda/envs/prod/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/hiseq.clinical/SERVER/apps/scout/git/scout/scout/server/utils.py", line 28, in decorated_function
return render_template(template_name, *context)
File "/home/hiseq.clinical/miniconda/envs/prod/lib/python3.6/site-packages/flask/templating.py", line 140, in render_template
ctx.app,
File "/home/hiseq.clinical/miniconda/envs/prod/lib/python3.6/site-packages/flask/templating.py", line 120, in _render
rv = template.render(context)
File "/home/hiseq.clinical/miniconda/envs/prod/lib/python3.6/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/home/hiseq.clinical/miniconda/envs/prod/lib/python3.6/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(
rewrite_traceback_stack(source=source))
File "/home/hiseq.clinical/miniconda/envs/prod/lib/python3.6/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "/home/hiseq.clinical/SERVER/apps/scout/git/scout/scout/server/blueprints/cases/templates/cases/case_report.html", line 1110, in top-level template code
{% for comment in variant.comments %}
File "/home/hiseq.clinical/SERVER/apps/scout/git/scout/scout/server/templates/report_base.html", line 14, in top-level template code
{% block body %}
File "/home/hiseq.clinical/SERVER/apps/scout/git/scout/scout/server/blueprints/cases/templates/cases/case_report.html", line 58, in block "body"
{{ pinned_panel() }}
File "/home/hiseq.clinical/miniconda/envs/prod/lib/python3.6/site-packages/jinja2/runtime.py", line 679, in _invoke
rv = self._func(arguments)
File "/home/hiseq.clinical/SERVER/apps/scout/git/scout/scout/server/blueprints/cases/templates/cases/case_report.html", line 300, in template
{{ sv_variant_content(pinned, loop.index) }}
File "/home/hiseq.clinical/miniconda/envs/prod/lib/python3.6/site-packages/jinja2/runtime.py", line 679, in _invoke
rv = self._func(
arguments)
File "/home/hiseq.clinical/SERVER/apps/scout/git/scout/scout/server/blueprints/cases/templates/cases/case_report.html", line 986, in template

ValueError: too many values to unpack (expected 2)

bug

Most helpful comment

To Chiara: https://i.imgur.com/XleZ71U.gifv :-)

All 22 comments

To Chiara: https://i.imgur.com/XleZ71U.gifv :-)

I can't reproduce the error with the default demo sample, must something related to the specific case(s)

And perhaps with a macro that is shared through "utils"? Renaming those into more object like hierarchies at some point will shed some light on many things.

But in theory general report should not be importing stuff from other files. All the used macros are there in the file already

Oooh, interesting!

Ok it has to do with SVs, reproduced by marking a SV as causative

๐Ÿ˜Š

I can't see your picture, but SVs and unexpectedly many values to unpack does hint at an array of gene names..

Sorry, this loop here:

image

Apparently we are unpacking just 2 items for each element of the list

But each tuple has 3.

[('GnomAD', 'NA', None), ('1000G(left)', 0.000998400035314262, None), ('1000G(right)', 0.000998400035314262, None)]

What's this None that appears now?

Sorry, was over at paper resubmission. Something brand new it seems! Will check!

from .utils import (
    add_gene_info,
    callers,
    clinsig_human,
    default_panels,
    end_position,
    evaluation,
**frequency,**
    is_affected,
    predictions,
**frequencies,**
)

...

variant_obj.update(get_variant_links(variant_obj, int(genome_build)))
    variant_obj["frequencies"] = **frequencies**(variant_obj)
    if variant_type in ["snv", "cancer"]:
        # This is to convert a summary of frequencies to a string
        variant_obj["frequency"] = **frequency**(variant_obj)

There is no way this could go wrong. โ›‘

The code was actually changed some days ago:

image

In here: https://github.com/Clinical-Genomics/scout/commit/e5468f439ee9c89fe68280ebb3cffe76611a53d7#diff-d9cb1085635fe83b6a8e3b4b9677c9d2

@moonso shall we have this link item in the frequencies or we can remove it? In this case the report will work if we leave it unchanged.

from .utils import (
    add_gene_info,
    callers,
    clinsig_human,
    default_panels,
    end_position,
    evaluation,
**frequency,**
    is_affected,
    predictions,
**frequencies,**
)

...

variant_obj.update(get_variant_links(variant_obj, int(genome_build)))
    variant_obj["frequencies"] = **frequencies**(variant_obj)
    if variant_type in ["snv", "cancer"]:
        # This is to convert a summary of frequencies to a string
        variant_obj["frequency"] = **frequency**(variant_obj)

There is no way this could go wrong. โ›‘

Where is this?

in utils ofcourse, where else? ๐Ÿ˜œ

server.blueprints.variant.utils

Note to self and others: there are other variant types that cancer, snv and sv now..

I'm very tired at the moment and I feel like whatever I touch has the potential to go wrong. I'll continue tomorrow!

Which is ofcourse the same as you linked. I am also quite tired - that adrenaline is wearing off.. ๐Ÿ˜…

Tomorrow then!

I'll just test your PR, then call it a day. After reading this it seems it should cover most of what worked before.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hassanfa picture hassanfa  ยท  4Comments

mhkc picture mhkc  ยท  3Comments

4WGH picture 4WGH  ยท  3Comments

hassanfa picture hassanfa  ยท  3Comments

KickiLagerstedt picture KickiLagerstedt  ยท  5Comments