Merge_metaphlan_tables.py

Issue #13 new
bobbie shaban created an issue

HI,

Your wiki says you can use the merge tables script as such,
mkdir output
$ utils/merge_metaphlan_tables.py profiled_samples/*.txt > output/merged_abundance_table.txt

But I get the error below. I can get it to work if I merge all the out files to a single file, but then it won't be specific for each sample

$  python27 merge_metaphlan_tables.py *.out > all.out.tables
usage: merge_metaphlan_tables.py [-h] --in INPUT_FILE --out OUTPUT_FILE
                                 [-m {single,complete,average,weighted,centroid,median,ward}]
                                 [-d {euclidean,minkowski,cityblock,seuclidean,sqeuclidean,cosine,correlation,hamming,jaccard,chebyshev,canberra,braycurtis,mahalanobis,yule,matching,dice,kulsinski,rogerstanimoto,russellrao,sokalmichener,sokalsneath,wminkowski,ward}]
                                 [-f {euclidean,minkowski,cityblock,seuclidean,sqeuclidean,cosine,correlation,hamming,jaccard,chebyshev,canberra,braycurtis,mahalanobis,yule,matching,dice,kulsinski,rogerstanimoto,russellrao,sokalmichener,sokalsneath,wminkowski,ward}]
                                 [-s scale norm] [-x X] [-y Y] [--minv MINV]
                                 [--maxv max value]
                                 [--tax_lev TAXONOMIC_LEVEL] [--perc PERC]
                                 [--top TOP] [--sdend_h SDEND_H]
                                 [--fdend_w FDEND_W] [--cm_h CM_H]
                                 [--cm_ticks label for ticks of the colormap]
                                 [--font_size FONT_SIZE]
                                 [--clust_line_w CLUST_LINE_W]
                                 [-c {Accent,Blues,BrBG,BuGn,BuPu,Dark2,GnBu,Greens,Greys,OrRd,Oranges,PRGn,Paired,Pastel1,Pastel2,PiYG,PuBu,PuBuGn,PuOr,PuRd,Purples,RdBu,RdGy,RdPu,RdYlBu,RdYlGn,Reds,Set1,Set2,Set3,Spectral,YlGn,YlGnBu,YlOrBr,YlOrRd,afmhot,autumn,binary,bone,brg,bwr,cool,copper,flag,gist_earth,gist_gray,gist_heat,gist_ncar,gist_rainbow,gist_stern,gist_yarg,gnuplot,gnuplot2,gray,hot,hsv,jet,ocean,pink,prism,rainbow,seismic,spectral,spring,summer,terrain,winter,bbcyr,bbcry}]
merge_metaphlan_tables.py: error: argument --in is required

Comments (3)

  1. Nicola Segata repo owner

    Hi Bobbie,
    the usage help message you reported is actually the one for metaphlan_hclust_heatmap.py. Are you sure you did not overwrite merge_metaphlan_tables.py with merge_metaphlan_tables.py? As you can see the merge_metaphlan_tables.py does not require the "--in" command:
    https://bitbucket.org/nsegata/metaphlan/src/2f1b17a1f4e9775fe1ce42c8481279a5e69f291f/utils/merge_metaphlan_tables.py?at=default
    If you re-download that script, the problem should be fixed...

    thanks
    Nicola

  2. Bobbie Bioinformatician

    Thanks Nicola,

    Sorry It was a long week last week. I was actually having problems with metaphlan_hclust_heatmap.py, the merged abundance table is created perfectly. Below is the error I was supposed to put up.

    python27 ../metaphlan2/m/plotting_scripts/metaphlan_hclust_heatmap.py -c bbcry --top 25 --minv 0.1 -s log --in output_merged_abundance_table.txt --out output_images/abundance_heatmap.png
    Traceback (most recent call last):
      File "../metaphlan2/m/plotting_scripts/metaphlan_hclust_heatmap.py", line 481, in <module>
        tax_lev = pars['tax_lev']
      File "../metaphlan2/m/plotting_scripts/metaphlan_hclust_heatmap.py", line 452, in hclust
        heatmap_panel( fig, D, minv, maxv, idx1, idx2, cm_name, scale, sample_labels, feat_labels, label_font_size, -cm_h*8.0/ysize, cm_h*0.8*8.0/ysize, flabelon, slabelon, cm_ticks, gridon, ydend_offset+sdend_h*8.0/ysize )
      File "../metaphlan2/m/plotting_scripts/metaphlan_hclust_heatmap.py", line 244, in heatmap_panel
        aspect='auto', origin='lower', cmap=cm, vmax=maxv)
      File "/usr/lib64/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/axes.py", line 9110, in matshow
        im = self.imshow(Z, **kw)
      File "/usr/lib64/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/axes.py", line 7311, in imshow
        im.autoscale_None()
      File "/usr/lib64/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/cm.py", line 333, in autoscale_None
        self.norm.autoscale_None(self._A)
      File "/usr/lib64/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/colors.py", line 1023, in autoscale_None
        self.vmax = ma.max(A)
      File "/usr/lib64/python2.7/site-packages/numpy/ma/core.py", line 5961, in max
        return obj.max(axis=axis, fill_value=fill_value, out=out)
      File "/usr/lib64/python2.7/site-packages/numpy/ma/core.py", line 5218, in max
        result = self.filled(fill_value).max(axis=axis, out=out).view(type(self))
      File "/usr/lib64/python2.7/site-packages/numpy/matrixlib/defmatrix.py", line 688, in max
        return N.ndarray.max(self, axis, out, keepdims=True)._collapse(axis)
      File "/usr/lib64/python2.7/site-packages/numpy/core/_methods.py", line 17, in _amax
        out=out, keepdims=keepdims)
    ValueError: zero-size array to reduction operation maximum which has no identity
    
  3. Log in to comment