Weeks-UNC/Superfold

ZeroDivisionError in PyCircleCompareSF.py

cawbem opened this issue · 5 comments

Hello,
I've got the following error when I run Superfold either on my own .map files or on the sample input file 16S.1m7.map.txt.
Do you know where it could come from, please?
Many thanks in advance,
Beatrice

% python Superfold.py 16S.1m7.map.txt
results_16S.1m7.map.txt_867e
log file location: results_16S.1m7.map.txt_867e/log_results_16S.1m7.map.txt_867e.txt

starting Partition function calculation...
starting Fold...
drawing figures...
135 297
Traceback (most recent call last):
File "Superfold.py", line 1427, in
main()
File "Superfold.py", line 269, in main
lines = makeCircle(x,x,tmpZeros,tmpSHAPE,{'i':[],'j':[],'correl':[]},[],offset=i)
File "/Users/Bea/tools/Superfold/PyCircleCompareSF.py", line 614, in makeCircle
sens = bpCorrect/float(len(correct)+len(missing))
ZeroDivisionError: float division by zero

The line numbers of your error do not match the published code. Try recloning Superfold from Github and see if that solves your issue.

Sorry for the wrong line numbers. They were due to the fact that I've added several print lines in Superfold.py and PyCircleCompareSF.py, in order to track some variable content. With a freshly cloned version of Superfold, I basically get the same error, except from the line numbers, but I think I've managed to find out what was going wrong.

What should have put me on alert in the first place is the fact that I had to comment the runCheck() function call for the code to run, otherwise it was just stuck at this step without doing anything. After some tests, it appears that even if the RNAStructure "Fold" program is available in my PATH variable, when called from within the Superfold.py script, it's not the "Fold" program that is launched, but the unix "fold" command (with a lowercase "f"), for a reason I can't explain to myself (is it because I'm working on a Mac computer?).

So I add to put the complete path to the RNAStructure "Fold" program each time it was called in Superfold.py (lines 377, 390, 401, and 409), like this: "foldCMD = "/Users/Bea/installations/RNAstructure/exe/Fold [...]", and after that Superfold ran successfully with the sample data:
python ../Superfold.py 16S.1m7.map.txt
results_16S.1m7.map.txt_867e
log file location: results_16S.1m7.map.txt_867e/log_results_16S.1m7.map.txt_867e.txt

starting Partition function calculation...
starting Fold...
drawing figures...
27 556
27 886
916 1413

Just to double check with you, could you please tell me if the following output files are the ones that are expected:

  • in the results_16S.1m7.map.txt_867e directory:
    -rw-r--r-- 1 Bea staff 57337 Feb 8 09:32 arcPlot_16S.1m7.map.txt_867e.pdf
    -rw-r--r-- 1 Bea staff 99309 Feb 8 09:32 log_results_16S.1m7.map.txt_867e.txt
    -rw-r--r-- 1 Bea staff 49366 Feb 8 09:31 merged_16S.1m7.map.txt_867e.ct
    -rw-r--r-- 1 Bea staff 20339 Feb 8 09:31 merged_16S.1m7.map.txt_867e.dp
    drwxr-xr-x 14 Bea staff 448 Feb 8 09:32 regions
    -rw-r--r-- 1 Bea staff 119469 Feb 8 09:32 regions_16S.1m7.map.txt_867e.ps
    -rw-r--r-- 1 Bea staff 70057 Feb 8 09:32 shannonShape_16S.1m7.map.txt_867e.pdf
    -rw-r--r-- 1 Bea staff 27443 Feb 8 09:31 shannon_16S.1m7.map.txt_867e.txt

  • and in the results_16S.1m7.map.txt_867e/regions sub-directory:
    -rw-r--r-- 1 Bea staff 16998 Feb 8 09:32 region_16S.1m7.map.txt_867e_0027_0556.ct
    -rw-r--r-- 1 Bea staff 75801 Feb 8 09:32 region_16S.1m7.map.txt_867e_0027_0556.eps
    -rw-r--r--@ 1 Bea staff 34794 Feb 8 09:32 region_16S.1m7.map.txt_867e_0027_0556.ps
    -rw-r--r-- 1 Bea staff 47595 Feb 8 09:32 region_16S.1m7.map.txt_867e_0027_0556.xrna
    -rw-r--r-- 1 Bea staff 27558 Feb 8 09:32 region_16S.1m7.map.txt_867e_0027_0886.ct
    -rw-r--r-- 1 Bea staff 123493 Feb 8 09:32 region_16S.1m7.map.txt_867e_0027_0886.eps
    -rw-r--r--@ 1 Bea staff 51516 Feb 8 09:32 region_16S.1m7.map.txt_867e_0027_0886.ps
    -rw-r--r-- 1 Bea staff 77194 Feb 8 09:32 region_16S.1m7.map.txt_867e_0027_0886.xrna
    -rw-r--r-- 1 Bea staff 15976 Feb 8 09:32 region_16S.1m7.map.txt_867e_0916_1413.ct
    -rw-r--r-- 1 Bea staff 71757 Feb 8 09:32 region_16S.1m7.map.txt_867e_0916_1413.eps
    -rw-r--r--@ 1 Bea staff 33159 Feb 8 09:32 region_16S.1m7.map.txt_867e_0916_1413.ps
    -rw-r--r-- 1 Bea staff 44605 Feb 8 09:32 region_16S.1m7.map.txt_867e_0916_1413.xrna

Thanks again for your help!
Beatrice

Just in case, the size of my log_results_16S.1m7.map.txt_867e.txt file will probably differ from yours, because of my print commands... (I forgot to remove them, sorry)

Looking at your results files it appears Superfold is running as it should.

As for your issue with the path of Fold, it may have something to do with the fact that your are running Superfold on a mac. Most people (including us) run Superfold remotely on a linux based server system. So all of the testing and design has been focused on that scenario. We will look into running Superfold locally and see if we can amend the issue in future updates.

As for now, your solution is a good one and should work for you going forward.

Ok, nice, many thanks for your reply!