tanghaibao / jcvi

Python library to facilitate genome assembly, annotation, and comparative genomics
BSD 2-Clause "Simplified" License
711 stars 185 forks source link

jcvi.compara.catalog ortholog: ValueError: invalid literal for int() with base 10: 'CCT #288

Closed scotty323 closed 3 years ago

scotty323 commented 3 years ago

Dear Professor Hai Bao Tang,

I encounter a problem like this. Both Brachypodium distachyon protein and CDS do not work in this case. So hopefully you could give some clue?

Many thanks!

Tao


python -m jcvi.compara.catalog ortholog --dbtype prot --no_strip_names osa bdi /home/tao/miniconda3/lib/python3.7/site-packages/jcvi/graphics/base.py:229: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. In future versions, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = copy.copy(mpl.cm.get_cmap("Reds")) reds.set_bad("white") /home/tao/miniconda3/lib/python3.7/site-packages/jcvi/graphics/base.py:230: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. In future versions, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = copy.copy(mpl.cm.get_cmap("Reds")) reds.set_under("white") /home/tao/miniconda3/lib/python3.7/site-packages/jcvi/graphics/base.py:233: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. In future versions, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = copy.copy(mpl.cm.get_cmap("Blues_r")) blues_r.set_bad("white") /home/tao/miniconda3/lib/python3.7/site-packages/jcvi/graphics/base.py:234: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. In future versions, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = copy.copy(mpl.cm.get_cmap("Blues_r")) blues_r.set_under("white") 12:51:27 [base] Set text.usetex=False. Font styles may be inconsistent. 12:51:27 [cbook] File bdi.prj exists. Computation skipped. 12:51:27 [base] lastal -u 0 -P 88 -i3G -f BlastTab bdi osa.pep >./osa.bdi.last 12:51:34 [synteny] Assuming --qbed=osa.bed --sbed=bdi.bed 12:51:34 [base] Load file osa.bed 12:51:35 [base] Load file bdi.bed Traceback (most recent call last): File "/home/tao/miniconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/home/tao/miniconda3/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/compara/catalog.py", line 949, in main() File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/compara/catalog.py", line 80, in main p.dispatch(globals()) File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/apps/base.py", line 111, in dispatch globalsaction File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/compara/catalog.py", line 699, in ortholog blastfilter_main(dargs) File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/compara/blastfilter.py", line 328, in main blastfilter_main(blastfile, p, opts) File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/compara/blastfilter.py", line 40, in blastfilter_main qbed, sbed, qorder, sorder, is_self = check_beds(blast_file, p, opts) File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/compara/synteny.py", line 506, in check_beds sbed = Bed(opts.sbed, sorted=sorted) File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/formats/bed.py", line 148, in init b = BedLine(line) File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/formats/bed.py", line 51, in init self.start = int(args[1]) + 1 ValueError: invalid literal for int() with base 10: 'CCT'

scotty323 commented 3 years ago

I found the clue, sorry: it's in the bed file. so I removed these lines. solved.

Chr1 75054083 75060359 Bradi1g78926 . . Chr1 75060658 75061065 Bradi1g78976 . . Chr1 75061071 75064134 Bradi1g79026 . . Chr1_centromere_containing_Bradi1g41430 22866 23261 Bradi41430s00100 . . Chr1_centromere_containing_Bradi1g41430 24784 29531 Bradi41430s00200 . . Chr2 962 1849 Bradi2g00052 . . Chr2 2763 4016 Bradi2g00105 . . Chr2 6534 10276 Bradi2g00156 . .

scotty323 commented 3 years ago

BUT, after I removed these lines in bdi.bed, the problem still exists.

python -m jcvi.compara.catalog ortholog --dbtype prot --no_strip_names osa bdi /home/tao/miniconda3/lib/python3.7/site-packages/jcvi/graphics/base.py:229: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. In future versions, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = copy.copy(mpl.cm.get_cmap("Reds")) reds.set_bad("white") /home/tao/miniconda3/lib/python3.7/site-packages/jcvi/graphics/base.py:230: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. In future versions, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = copy.copy(mpl.cm.get_cmap("Reds")) reds.set_under("white") /home/tao/miniconda3/lib/python3.7/site-packages/jcvi/graphics/base.py:233: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. In future versions, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = copy.copy(mpl.cm.get_cmap("Blues_r")) blues_r.set_bad("white") /home/tao/miniconda3/lib/python3.7/site-packages/jcvi/graphics/base.py:234: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. In future versions, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = copy.copy(mpl.cm.get_cmap("Blues_r")) blues_r.set_under("white") 13:25:58 [base] Set text.usetex=False. Font styles may be inconsistent. 13:25:58 [cbook] File bdi.prj exists. Computation skipped. 13:25:58 [base] lastal -u 0 -P 88 -i3G -f BlastTab bdi osa.pep >./osa.bdi.last 13:26:04 [synteny] Assuming --qbed=osa.bed --sbed=bdi.bed 13:26:04 [base] Load file osa.bed 13:26:04 [base] Load file bdi.bed Traceback (most recent call last): File "/home/tao/miniconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/home/tao/miniconda3/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/compara/catalog.py", line 949, in main() File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/compara/catalog.py", line 80, in main p.dispatch(globals()) File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/apps/base.py", line 111, in dispatch globalsaction File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/compara/catalog.py", line 699, in ortholog blastfilter_main(dargs) File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/compara/blastfilter.py", line 328, in main blastfilter_main(blastfile, p, opts) File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/compara/blastfilter.py", line 40, in blastfilter_main qbed, sbed, qorder, sorder, is_self = check_beds(blast_file, p, opts) File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/compara/synteny.py", line 506, in check_beds sbed = Bed(opts.sbed, sorted=sorted) File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/formats/bed.py", line 148, in init b = BedLine(line) File "/home/tao/miniconda3/lib/python3.7/site-packages/jcvi/formats/bed.py", line 51, in init self.start = int(args[1]) + 1 ValueError: invalid literal for int() with base 10: 'CCT'

tanghaibao commented 3 years ago

@scotty323

You are right about potential issues in bdi.bed. Specifically, the 2nd column should only contain start locations of a gene, which should be an integer, somehow you have CCT, leading to the parsing error.

$ cut -f2 bdi.bed | grep CCT

So check to see if bdi.bed is valid and fix the line that contains the error.

Haibao

scotty323 commented 3 years ago

Thank you! Indeed! after manually checking all the first column in bed file, and removed all suspicious lines. It worked well!

zgliu2000 commented 3 months ago

Dear Professor Hai Bao Tang,

I encounter a problem like this Traceback (most recent call last): File "/ngsproject/zgliu/miniforge-pypy3/envs/jcvi/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/ngsproject/zgliu/miniforge-pypy3/envs/jcvi/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/ngsproject/zgliu/miniforge-pypy3/envs/jcvi/lib/python3.10/site-packages/jcvi/compara/catalog.py", line 978, in main() File "/ngsproject/zgliu/miniforge-pypy3/envs/jcvi/lib/python3.10/site-packages/jcvi/compara/catalog.py", line 78, in main p.dispatch(globals()) File "/ngsproject/zgliu/miniforge-pypy3/envs/jcvi/lib/python3.10/site-packages/jcvi/apps/base.py", line 140, in dispatch globalsaction File "/ngsproject/zgliu/miniforge-pypy3/envs/jcvi/lib/python3.10/site-packages/jcvi/compara/catalog.py", line 719, in ortholog blastfilter_main(dargs) File "/ngsproject/zgliu/miniforge-pypy3/envs/jcvi/lib/python3.10/site-packages/jcvi/compara/blastfilter.py", line 322, in main blastfilter_main(blastfile, p, opts) File "/ngsproject/zgliu/miniforge-pypy3/envs/jcvi/lib/python3.10/site-packages/jcvi/compara/blastfilter.py", line 38, in blastfilter_main qbed, sbed, qorder, sorder, is_self = check_beds(blast_file, p, opts) File "/ngsproject/zgliu/miniforge-pypy3/envs/jcvi/lib/python3.10/site-packages/jcvi/compara/synteny.py", line 405, in check_beds qbed = Bed(opts.qbed, sorted=sorted) File "/ngsproject/zgliu/miniforge-pypy3/envs/jcvi/lib/python3.10/site-packages/jcvi/formats/bed.py", line 156, in init b = BedLine(line) File "/ngsproject/zgliu/miniforge-pypy3/envs/jcvi/lib/python3.10/site-packages/jcvi/formats/bed.py", line 59, in init self.start = int(args[1]) + 1 IndexError: list index out of range hopefully you could give some clue? Many thanks!

Tao