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

UnboundLocalError when decomposing multiallelic variants #84

Open
Schmytzi opened this issue Jan 3, 2025 · 2 comments
Open

UnboundLocalError when decomposing multiallelic variants #84

Schmytzi opened this issue Jan 3, 2025 · 2 comments

Comments

@Schmytzi
Copy link

Schmytzi commented Jan 3, 2025

Describe the bug
Stranger crashes with an UnboundLocalError when encountering a multiallelic variant where the first sample does not have allele 1.

To Reproduce
Run

stranger --trgt broken_repeat.vcf --repeats-file variant_catalog_grch38.json

broken_repeat.vcf is attached here:
broken_repeat.zip

The variant catalog is the following: https://github.com/Clinical-Genomics/stranger/raw/main/stranger/resources/stranger_repeat_catalog_grch38.json

Expected behavior
Stranger should correctly decompose and annotate the variant (or in this case: emit a warning about the unknown repeat)

System:

Additional context
The crash does not occur if you switch the individuals' genotypes. Then stranger works correctly.

@fellen31
Copy link
Contributor

I believe this might be the same issue?

2025-02-12 17:36:13 compute-0-5.local stranger.cli[41] INFO Running stranger version 0.9.2
2025-02-12 17:36:13 compute-0-5.local stranger.cli[41] INFO Parsing repeats file variant_catalog_grch38.json
2025-02-12 17:36:13 compute-0-5.local stranger.cli[41] INFO Vcf is zipped
Traceback (most recent call last):
  File "/usr/local/bin/stranger", line 10, in <module>
    sys.exit(base_command())
             ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/stranger/cli.py", line 189, in cli
    variant_infos = decompose_var(variant_info)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/stranger/utils.py", line 442, in decompose_var
    variant_component_value = individual_value.split(",")[variant_component]
                                                          ^^^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'variant_component' where it is not associated with a value

Command:

stranger \
    --trgt \
    assuringredbird_repeats.vcf.gz \
    --repeats-file variant_catalog_grch38.json | gzip --no-name > assuringredbird_stranger.vcf.gz

Files:

/home/proj/development/rare-disease/felix/stranger_fix/19d4d2b09070dbca893414da07ce1c/assuringredbird_repeats.vcf.gz
/home/proj/development/rare-disease/felix/stranger_fix/19d4d2b09070dbca893414da07ce1c/assuringredbird_stranger.vcf.gz
/home/proj/development/rare-disease/felix/stranger_fix/19d4d2b09070dbca893414da07ce1c/variant_catalog_grch38.json

@Schmytzi
Copy link
Author

Yes, I think that's the one I got.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants