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

Cannot combine dicts #9

Closed
pdimens opened this issue Oct 11, 2023 · 4 comments
Closed

Cannot combine dicts #9

pdimens opened this issue Oct 11, 2023 · 4 comments

Comments

@pdimens
Copy link

pdimens commented Oct 11, 2023

Hello again, I'm getting an error running naibr regarding combining dicts:

Traceback (most recent call last):
  File "/home/pd348/miniconda3/envs/harpy/bin/naibr", line 10, in <module>
    sys.exit(main())
  File "/home/pd348/miniconda3/envs/harpy/lib/python3.9/site-packages/naibr/__main__.py", line 391, in main
    return run(file_configs)
  File "/home/pd348/miniconda3/envs/harpy/lib/python3.9/site-packages/naibr/__main__.py", line 350, in run
    novel_adjacencies = run_naibr_on_chromosomes(chromosomes, configs)
  File "/home/pd348/miniconda3/envs/harpy/lib/python3.9/site-packages/naibr/__main__.py", line 147, in run_naibr_on_chromosomes
    linkedreads_by_barcode.combine(linkedreads_by_barcode_chrom)
  File "/home/pd348/miniconda3/envs/harpy/lib/python3.9/site-packages/naibr/__main__.py", line 294, in combine
    raise TypeError(f"Can only combine with other UnionDicts or defaultdicts ({type(other)})")
TypeError: Can only combine with other UnionDicts or defaultdicts (<class 'NoneType'>)

While itself not super informative, I think this may be due to one of the chromosomes having no candidates identified. Here's what I think may be a relevant excerpt from the log:

2023-10-11 13:19:26,225 - INFO: No candidates from Y

If I'm understanding what's happening, I think naibr assumes there will always be candidates for each chromosome and therefore doesn't have a condition to skip an empty dict?

Otherwise, the entire log is:

========= NAIBR =========
version: 0.5
-------- CONFIGS --------
FILES
  bam_file = Variants/naibr-pop/input/ZS10-221221-15x_1M.bam
  candidates = None
  blacklist = None
  outdir = Variants/naibr-pop/ZS10-221221-15x_1M
  prefix = ZS10-221221-15x_1M
PARAMETERS
  d =           150,000
  min_mapq =         30
  k =                 3
  min_sv =        1,000
  sd_mult =           2
  min_len =         806
  max_len =     200,000
  min_reads =         2
  min_discs =         2
  threads =           8
  DEBUG =         False
-------------------------
2023-10-11 13:19:26,173 - INFO: Found 7 chromosomes with data in BAM
2023-10-11 13:19:26,198 - INFO: running on 8 threads
2023-10-11 13:19:26,200 - INFO: Getting candidates for chromosome 2L
2023-10-11 13:19:26,200 - INFO: Getting candidates for chromosome 3L
2023-10-11 13:19:26,200 - INFO: Getting candidates for chromosome 2R
2023-10-11 13:19:26,200 - INFO: Getting candidates for chromosome 3R
2023-10-11 13:19:26,200 - INFO: Getting candidates for chromosome 4
2023-10-11 13:19:26,201 - INFO: Getting candidates for chromosome Y
2023-10-11 13:19:26,201 - INFO: Getting candidates for chromosome X
2023-10-11 13:19:26,222 - INFO: Done reading chromosome Y: coverage = 0.040X
2023-10-11 13:19:26,222 - INFO: Y: total pairs: 676, discordant: 4 (0.59%), concordant: 650 (96.15%)
2023-10-11 13:19:26,222 - INFO: For chromsome Y - found 16 positions with discordant reads.
2023-10-11 13:19:26,225 - INFO: Got candidate noval adjacencies from data: 0.0023 s
2023-10-11 13:19:26,225 - INFO: No candidates from Y
2023-10-11 13:19:26,282 - INFO: Done reading chromosome 4: coverage = 0.661X
2023-10-11 13:19:26,282 - INFO: 4: total pairs: 4,024, discordant: 18 (0.45%), concordant: 3,903 (96.99%)
2023-10-11 13:19:26,283 - INFO: For chromsome 4 - found 22 positions with discordant reads.
2023-10-11 13:19:26,332 - INFO: Got candidate noval adjacencies from data: 0.0490 s
2023-10-11 13:19:26,332 - INFO: Ranking 1 candidates from 4
2023-10-11 13:19:26,345 - WARNING: Low coverage (0.661X < 10X), the threshold value might not be accurate.
2023-10-11 13:19:27,370 - INFO: Done reading chromosome 2L: coverage = 0.584X
2023-10-11 13:19:27,370 - INFO: 2L: total pairs: 63,738, discordant: 222 (0.35%), concordant: 61,747 (96.88%)
2023-10-11 13:19:27,385 - INFO: For chromsome 2L - found 158 positions with discordant reads.
2023-10-11 13:19:27,531 - INFO: Done reading chromosome 3L: coverage = 0.551X
2023-10-11 13:19:27,532 - INFO: 3L: total pairs: 71,753, discordant: 181 (0.25%), concordant: 69,533 (96.91%)
2023-10-11 13:19:27,550 - INFO: For chromsome 3L - found 260 positions with discordant reads.
2023-10-11 13:19:27,591 - INFO: Done reading chromosome 2R: coverage = 0.548X
2023-10-11 13:19:27,592 - INFO: 2R: total pairs: 64,178, discordant: 203 (0.32%), concordant: 62,092 (96.75%)
2023-10-11 13:19:27,608 - INFO: For chromsome 2R - found 216 positions with discordant reads.
2023-10-11 13:19:27,612 - INFO: Done reading chromosome X: coverage = 0.546X
2023-10-11 13:19:27,612 - INFO: X: total pairs: 59,856, discordant: 113 (0.19%), concordant: 57,864 (96.67%)
2023-10-11 13:19:27,630 - INFO: For chromsome X - found 257 positions with discordant reads.
2023-10-11 13:19:27,695 - INFO: Done reading chromosome 3R: coverage = 0.568X
2023-10-11 13:19:27,696 - INFO: 3R: total pairs: 84,246, discordant: 142 (0.17%), concordant: 81,742 (97.03%)
2023-10-11 13:19:27,714 - INFO: For chromsome 3R - found 243 positions with discordant reads.
2023-10-11 13:19:28,001 - INFO: Got candidate noval adjacencies from data: 0.6163 s
2023-10-11 13:19:28,002 - INFO: Ranking 5 candidates from 2L
2023-10-11 13:19:28,170 - INFO: Got candidate noval adjacencies from data: 0.5402 s
2023-10-11 13:19:28,170 - INFO: Ranking 17 candidates from X
2023-10-11 13:19:28,187 - INFO: Got candidate noval adjacencies from data: 0.5795 s
2023-10-11 13:19:28,187 - INFO: Ranking 11 candidates from 2R
2023-10-11 13:19:28,200 - INFO: Got candidate noval adjacencies from data: 0.6499 s
2023-10-11 13:19:28,200 - INFO: Ranking 11 candidates from 3L
2023-10-11 13:19:28,353 - WARNING: Low coverage (0.584X < 10X), the threshold value might not be accurate.
2023-10-11 13:19:28,354 - INFO: Found 5 SVs on 2L of which 5 (100.0%) passed the threshold
2023-10-11 13:19:28,476 - INFO: Got candidate noval adjacencies from data: 0.7614 s
2023-10-11 13:19:28,476 - INFO: Ranking 17 candidates from 3R
2023-10-11 13:19:28,690 - WARNING: Low coverage (0.548X < 10X), the threshold value might not be accurate.
2023-10-11 13:19:28,690 - INFO: Found 8 SVs on 2R of which 8 (100.0%) passed the threshold
2023-10-11 13:19:28,786 - WARNING: Low coverage (0.551X < 10X), the threshold value might not be accurate.
2023-10-11 13:19:28,786 - INFO: Found 9 SVs on 3L of which 9 (100.0%) passed the threshold
2023-10-11 13:19:29,165 - WARNING: Low coverage (0.546X < 10X), the threshold value might not be accurate.
2023-10-11 13:19:29,166 - INFO: Found 10 SVs on X of which 10 (100.0%) passed the threshold
2023-10-11 13:19:29,502 - WARNING: Low coverage (0.568X < 10X), the threshold value might not be accurate.
2023-10-11 13:19:29,502 - INFO: Found 13 SVs on 3R of which 13 (100.0%) passed the threshold
@pontushojer
Copy link
Owner

Hello @pdimens,

I this using NAIBR installed from bioconda (naibr-plus)?

You had a similar issue (#7) which raised the same error for which I implemented a fix (#8). Just want to make sure this is a different issue.

@pdimens
Copy link
Author

pdimens commented Oct 13, 2023

Oh wow, I forgot about experiencing that before! 🤦 . Yes, I'm using the install from bioconda. Has that release not been updated?

@pontushojer
Copy link
Owner

Oh wow, I forgot about experiencing that before! 🤦 . Yes, I'm using the install from bioconda. Has that release not been updated?

Haha, easy to forget these things ;) Good that its not a new bug at least.

I have not yet made a new release with the fix implemented, I will see about doing this shortly.

@pontushojer
Copy link
Owner

New release made and published on bioconda (bioconda/bioconda-recipes#43661)

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