YingZhou001 / Immuannot

Immuological gene typing and annotation for genome assembly
MIT License
31 stars 5 forks source link

UnboundLocalError: local variable 's1' referenced before assignment #6

Closed zoebjamal closed 5 months ago

zoebjamal commented 5 months ago

Hello,

First of all, thank you for creating this tool! It is a great resource. I am trying to use it to annotate the immunological genes for some de novo human assemblies.

When running the example you supplied in the README, I noticed that the output only includes the C4 gene types. I checked the screen output and noticed that there is an UnboundLocalError alert while processing the IPD HLA/KIR genes. Here is the program output

########################################
##Welcome###############################
########################################

Starting time: 06/20/24-10:27:00
#####parameters:########################
CONTIG(-c)           : example/test.fa.gz
REFDIR(-r)           : Data-2024Feb02
OUTPREF(-o)          : test-run
THREAD(-t)           : 64
OVERLAP(--overlap)   : 0.9
DIFF(--diff)         : 0.03

#### processing IPD HLA/Kir genes#############
[M::mm_idx_gen::0.052*1.03] collected minimizers
[M::mm_idx_gen::0.071*14.07] sorted minimizers
[M::main::0.071*14.07] loaded/built the index for 2 target sequence(s)
[M::mm_mapopt_update::0.075*13.39] mid_occ = 53
[M::mm_idx_stat] kmer size: 19; skip: 19; is_hpc: 0; #seq: 2
[M::mm_idx_stat::0.077*13.08] distinct minimizers: 146857 (93.38% are singletons); average occurrences: 1.164; average spacing: 10.010; total length: 1711284
[M::worker_pipeline::22.970*55.45] mapped 22667 sequences
[M::main] Version: 2.22-r1101
[M::main] CMD: minimap2 -t 64 -cx asm5 --cs --end-bonus=10 example/test.fa.gz Data-2024Feb02/gen.fa.gz
[M::main] Real time: 22.984 sec; CPU: 1273.739 sec; Peak RSS: 33.233 GB
<msg> loading paf records
<msg> loading contig seq
<msg> searching template:
Traceback (most recent call last):
  File "scripts.pub.v3/searchTemplate.py", line 426, in <module>
    out = searchTemplatePGPC(pafDA, ctgname, qctgseqs)
  File "scripts.pub.v3/searchTemplate.py", line 305, in searchTemplatePGPC
    if s1 :
UnboundLocalError: local variable 's1' referenced before assignment
[M::mm_idx_gen::0.002*1.58] collected minimizers
[M::mm_idx_gen::0.008*7.21] sorted minimizers
[M::main::0.008*7.20] loaded/built the index for 0 target sequence(s)
[M::mm_mapopt_update::0.008*7.14] mid_occ = 10
[M::mm_idx_stat] kmer size: 15; skip: 10; is_hpc: 0; #seq: 0
[M::mm_idx_stat::0.008*7.09] distinct minimizers: 0 (-nan% are singletons); average occurrences: -nan; average spacing: -nan; total length: 0
[M::main] Version: 2.22-r1101
[M::main] CMD: minimap2 -t 64 -c --cs --end-bonus=10 test-run/cds.fa.gz test-run/tmp.ipd.cds.fa.gz
[M::main] Real time: 0.010 sec; CPU: 0.055 sec; Peak RSS: 0.003 GB

#### processing C4 genes###############
[M::mm_idx_gen::0.073*1.02] collected minimizers
[M::mm_idx_gen::0.094*9.70] sorted minimizers
[M::main::0.094*9.69] loaded/built the index for 2 target sequence(s)
[M::mm_mapopt_update::0.106*8.76] mid_occ = 96
[M::mm_idx_stat] kmer size: 15; skip: 5; is_hpc: 0; #seq: 2
[M::mm_idx_stat::0.116*8.09] distinct minimizers: 469659 (91.56% are singletons); average occurrences: 1.243; average spacing: 2.933; total length: 1711284
[M::worker_pipeline::0.183*5.53] mapped 1 sequences
[M::main] Version: 2.22-r1101
[M::main] CMD: minimap2 -t 64 -C5 --cs -cx splice:hq example/test.fa.gz Data-2024Feb02/C4.exon.fa.gz
[M::main] Real time: 0.189 sec; CPU: 1.017 sec; Peak RSS: 0.082 GB

#### combine IPD and C4 ###############
Ending time: 06/20/24-10:27:34, Wallclock time :34 seconds
####done####

Have you seen this error occur before? Do you have any recommendations to fix it?

Thanks!

YingZhou001 commented 5 months ago

Thanks for reporting! I believe it is good now. I just updated the "searchTemplate.py" file.

zoebjamal commented 5 months ago

Awesome, thanks!