Integron_Finder icon indicating copy to clipboard operation
Integron_Finder copied to clipboard

[BUG] Error in find_attc_max function

Open Ales-ibt opened this issue 1 year ago • 4 comments

Hello there,

Thank you for developing IntegronFinder.

I am updating to version 2.0.3 to check if some issues related to negative coordinates and other bugs we have been experimenting with are solved. Unfortunately, we noted that negative coordinates are still reported (contig_116 in the attached example.fasta.gz). However, what I'd like to report here is an error we get with contig_11 in the same attached fasta file. The error with version 2.0.2 is the following:

Traceback (most recent call last):
  File "/opt/miniconda/bin/integron_finder", line 8, in <module>
    sys.exit(main())
  File "/opt/miniconda/lib/python3.9/site-packages/integron_finder/scripts/finder.py", line 648, in main
    integron_res, summary = find_integron_in_one_replicon(replicon, config)
  File "/opt/miniconda/lib/python3.9/site-packages/integron_finder/scripts/finder.py", line 385, in find_integron_in_one_replicon
    integrons = find_integron(replicon, protein_db, integron_max, intI_file, phageI_file, config)
  File "/opt/miniconda/lib/python3.9/site-packages/integron_finder/integron.py", line 150, in find_integron
    attc_left = np.array([i_attc.pos_beg.values[0] for i_attc in attc_ac])
  File "/opt/miniconda/lib/python3.9/site-packages/integron_finder/integron.py", line 150, in <listcomp>
    attc_left = np.array([i_attc.pos_beg.values[0] for i_attc in attc_ac])
IndexError: index 0 is out of bounds for axis 0 with size 0

And in version 2.0.3 it becomes into:

Traceback (most recent call last):
  File "/usr/local/bin/integron_finder", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.12/site-packages/integron_finder/scripts/finder.py", line 651, in main
    integron_res, summary = find_integron_in_one_replicon(replicon, config)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/integron_finder/scripts/finder.py", line 366, in find_integron_in_one_replicon
    integron_max = find_attc_max(integrons, replicon, config.distance_threshold,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/integron_finder/attc.py", line 394, in find_attc_max
    to_concat = [df for df in [max_elt, df_max] if not df.empty]
                                        ^^^^^^

This is the command I am running in Linux:

$ singularity exec gempasteur-integron_finder:2.0.3.sif integron_finder --union-integrases --local-max --cpu 8 --gbk miniexample.fasta

Integron_Finder Version: integron_finder version 2.0.3 Using:

  • Python 3.12.2 (main, Feb 7 2024, 21:40:00) [GCC 12.2.0]

  • numpy 1.26.4

  • pandas 2.2.0

  • matplolib 3.8.2

  • biopython 1.83

  • Prodigal V2.6.3: February, 2016

  • INFERNAL 1.1.4 (Dec 2020)

  • HMMER 3.3.2 (Nov 2020); http://hmmer.org/

Thanks in advance!

Ales-ibt avatar May 07 '24 14:05 Ales-ibt

Hello, can you check whether the branch fix_find_attc_max solves your pb ?

jeanrjc avatar May 07 '24 14:05 jeanrjc

Hello!

Thank you for your quick response.

Using the branch fix_find_attc_max the pipeline is running Ok with contig_11, but still reporting negative coordinates for contig_116.

Ales-ibt avatar May 07 '24 15:05 Ales-ibt

@jeanrjc Could you merge that fix into master and include to new release, please? We (MGnify) are using you tool in our pipeline that @Ales-ibt is supporting. We had to build a container from that branch and implement that fix into pipeline. It would be super cool if we can replace it with proper working release.

Thank you! Best, Kate MGnify developer

KateSakharova avatar May 08 '24 09:05 KateSakharova

In addition, we are currently ignoring predictions with negative coordinates. It would be great to have that fix as well in the new release :D

Ales-ibt avatar May 08 '24 11:05 Ales-ibt

fixed in 2.0.5 version

bneron avatar Jun 06 '24 15:06 bneron