marbl / metAMOS

A metagenomic and isolate assembly and analysis pipeline built with AMOS
http://marbl.github.io/metAMOS
Other
93 stars 45 forks source link

metamos-1.5rc3 errors in postprocess step #229

Closed yxxue closed 8 years ago

yxxue commented 9 years ago

Hi, I installed metAMOS-1.5rc3 in our cluster. Although some warnings exist, I can run the run_pipeline_test.sh successfully: /usr/lib64/python2.6/site-packages/matplotlib/axes.py:7066: UserWarning: 2D hist should be nsamples x nvariables; this looks transposed warnings.warn('2D hist should be nsamples x nvariables; ' Job = [proba.asm.contig -> proba.scf.fa] completed Completed Task = postprocess.Postprocess done! pipeline took 0.78 minutes Please see results in /Home/ii/yaxinx/bin/metAMOS-1.5rc3/Test/test1/Postprocess/out metAMOS summary report is file:///Home/ii/yaxinx/bin/metAMOS-1.5rc3/Test/test1/Postprocess/out/html/summary.htm

However, I tried to run my own data, it failed at the final postprocess step: /usr/lib64/python2.6/site-packages/matplotlib/axes.py:7066: UserWarning: 2D hist should be nsamples x nvariables; this looks transposed warnings.warn('2D hist should be nsamples x nvariables; ' Oops, MetAMOS finished with errors! see text in red above for details. Traceback (most recent call last): File "/Home/ii/yaxinx/bin/metAMOS-1.5rc3/runPipeline", line 985, in verbose = 1) File "/Home/ii/yaxinx/bin/metAMOS-1.5rc3/Utilities/ruffus/task.py", line 2965, in pipeline_run raise job_errors RethrownJobError:

Exception #1
  'exceptions.IndexError(index out of bounds)' raised in ...
   Task = def postprocess.Postprocess(...):
   Job  = [proba.asm.contig -> proba.scf.fa]

Traceback (most recent call last):
  File "/Home/ii/yaxinx/bin/metAMOS-1.5rc3/Utilities/ruffus/task.py", line 625, in run_pooled_job_without_exceptions
    return_value =  job_wrapper(param, user_defined_work_func, register_cleanup, touch_files_only)
  File "/Home/ii/yaxinx/bin/metAMOS-1.5rc3/Utilities/ruffus/task.py", line 491, in job_wrapper_io_files
    ret_val = user_defined_work_func(*param)
  File "/Home/ii/yaxinx/bin/metAMOS-1.5rc3/src/postprocess.py", line 286, in Postprocess
    create_summary("%s/Abundance/out/%s.taxprof.pct.txt"%(_settings.rundir,_settings.PREFIX),"%s/Postprocess/out/%s.bnk"%(_settings.rundir,_settings.PREFIX),"%s/Postprocess/out/html/"%(_settings.rundir),"%s/Postprocess/out/%s.scf.fa"%(_settings.rundir,_settings.PREFIX),"%s"%(_settings.METAMOS_UTILS),"%s/img"%(_settings.METAMOSDIR),"%s"%(_settings.AMOS),len(_readlibs),"%s"%(_settings.taxa_level),"%s"%(_settings.DB_DIR))
  File "/Home/ii/yaxinx/bin/metAMOS-1.5rc3/Utilities/python/create_summary.py", line 234, in create_summary
    create_plots("%s/plot.tab"%(html_prefix),"%s"%("proba1"))
  File "/Home/ii/yaxinx/bin/metAMOS-1.5rc3/Utilities/python/create_plots.py", line 240, in create_plots
    ff2s += "\"%.2f\t%f\\n\" + \n"%(bins[i],n[i])
IndexError: index out of bounds

Can anyone tell me how to fix this problem? Thanks a lot.

skoren commented 9 years ago

This is most likely caused by an unsupported version of matplotlib, metAMOS has only been tested with matplotlib up to version 1.3 (http://metamos.readthedocs.org/en/v1.5rc3/content/installation.html). If you either remove matplotlib from your path or update the path to point to a compatible version of matplotlib, the issue should be fixed.

yxxue commented 9 years ago

I think it may not the problem of matplotlib.The error info is like this: File "/Home/ii/yaxinx/bin/metAMOS-1.5rc3/Utilities/python/create_plots.py", line 240, in create_plots ff2s += "\"%.2f\t%f\n\" + \n"%(bins[i],n[i]) IndexError: index out of bounds

So I configured the source code and found that this error is caused by len(bins)>len(n) in create_plots.py:

if c > 0: n, bins, patches = plt.hist(h, 20) ff2 = open("mapreads.js","w") ff2s = "var contiglens = \"cov\tfrequency\n\" + \n" i = 0 while i < len(n): try: ff2s += "\"%.2f\t%f\n\" + \n"%(bins[i],n[i]) except TypeError:

incorrect matplotlib version? skip..

           ff2s += "\"%.2f\t%f\n\" + \n"%(0.0,0.0)
           #continue
       i+=1

So I made some changes like this, this time no error occurs:

if c > 0: n, bins, patches = plt.hist(h, 20) ff2 = open("mapreads.js","w")
ff2s = "var contiglens = \"cov\tfrequency\n\" + \n" i = 0 cycle_num=0 if len(bins)>=len(n): cycle_num=len(n) else: cycle_num=len(bins) while i < cycle_num: try: ff2s += "\"%.2f\t%f\n\" + \n"%(bins[i],n[i]) except TypeError:

incorrect matplotlib version? skip..

           ff2s += "\"%.2f\t%f\n\" + \n"%(0.0,0.0)
           #continue
       i+=1
skoren commented 9 years ago

I think different matplot lib versions have different behavior for teh hist function which is why the error doesn't occur on our system. Are you able to submit your code change as a pull request? We can the incorporate it into the codebase.

skoren commented 8 years ago

Closed, only one version of matplot is supported/tested. However, your suggested code changes will be incorporated.