iTaxoTools / MolDGui

Qt GUI for MolD
GNU General Public License v3.0
0 stars 0 forks source link

UnboundLocalError: local variable ‘end’ referenced before assignment in medianSeqLen function #2

Open Bendlexane opened 2 months ago

Bendlexane commented 2 months ago

Hi there!

Thank for mold program! I'm using the Mold GUI for macOS under Sonoma 14.5, Python Version: >3.6, Mold 1.4.

I encountered an UnboundLocalError when running MolD for DNA diagnoses of taxa. The error occurs in the medianSeqLen function, where the variable end is referenced before being assigned. This causes the program to crash.

Traceback (most recent call last): File "itaxotools/mold/gui/threading_loop.py", line 90, in loop File "itaxotools/mold/gui/model/mold.py", line 62, in main_wrapper File "itaxotools/mold/mold.py", line 423, in mainprocessing File "itaxotools/mold/mold.py", line 320, in medianSeqLen UnboundLocalError: local variable 'end' referenced before assignment

`################# PARAMETERS FROM GUI ##################

tmpfname = /Users/manueltiburtini/Desktop/Dottorato/Armeria/Armeria_peninsulare/Filogenesi/fasta_files/cpDNA_concatenated_hyp6.fas outfname = /var/folders/44/n2qj8_q51m575lsvxl417m680000gn/T/MolDt0mw6mq/20240912T152050/out.html taxalist = 'ALL,ALLVSALL' taxonrank = '1' gapsaschars = 'yes' cutoff = '100' numnucl = 5 numiter = 10000 maxlenraw = 12 maxlenrefined = 7 iref = 'NO' pdiff = 1 nmax = 5 thresh = 'moderate'`

And the full parameter dictionary:

{'Gaps_as_chars': 'yes', 'qTAXA': 'ALL,ALLVSALL', 'Taxon_rank': '1', 'INPUT_FILE': '/Users/manueltiburtini/Desktop/Dottorato/Armeria/Armeria_peninsulare/Filogenesi/fasta_files/cpDNA_concatenated_hyp6.fas', 'ORIG_FNAME': None, 'Cutoff': '100', 'NumberN': 5, 'Number_of_iterations': 10000, 'MaxLen1': 12, 'MaxLen2': 7, 'Iref': 'NO', 'Pdiff': 1, 'NMaxSeq': 5, 'Scoring': 'moderate', 'OUTPUT_FILE': '/var/folders/44/n2qj8_q51m575lsvxl417m680000gn/T/MolD_t0mw6mq_/20240912T152050/out.html'}

1.  Input a concatenated FASTA file (cpDNA_concatenated_hyp6.fas) with all the species set with | (eg. A.canescensRG|canescens).
2.  Run MolD with the above parameters.
3.  The program crashes with the traceback indicating an uninitialized variable end in the medianSeqLen function.

However, with the example files runs smootly... Are there any error with my data or it's a bug?

If you need more details or logs, feel free to ask! Thank you for looking into this issue.

Best Manuel

StefanPatman commented 2 months ago

Hello Manuel, thanks for posting!

I transferred this issue from the pyqt5 repository, which is an older attempt at creating a GUI for Mold - not the one being referenced by your issue. Sorry about causing confusion with multiple repositories being available for MolD.

This is indeed a bug! I believe I just fixed it with my latest commit, but there is also a special case that may occur in your dataset. Could you please install from source and give it a try?

If you already cloned the repository:

cd MolDGui
git pull
pip install . -f packages.html
mold-gui

Otherwise, please install from scratch:

git clone https://github.com/iTaxoTools/MolDGui.git
cd MolDGui
pip install . -f packages.html
mold-gui

If you still encounter problems after updating, could you please share a copy of your input file so that I may further look into this issue? I will forward this issue to @SashaFedosov so it can be properly addressed in the main MolD repository.

I hope this helps!