This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Freyja plot error

Hello everyone,

I am using freyja https://github.com/andersen-lab/Freyja tool for the analysis of my sewage mix samples.

I am running this command to plot my data ,

freyja plot [aggregated-filename-tsv] --output [plot-filename(.pdf,.png,etc.)]

But getting this error always ,

Traceback (most recent call last):
  File "/home/arc/miniconda3/lib/python3.11/site-packages/pandas/core/indexes/base.py", line 3805, in get_loc
    return self._engine.get_loc(casted_key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc
  File "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'summarized'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/arc/miniconda3/bin/freyja", line 10, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/arc/miniconda3/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arc/miniconda3/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/arc/miniconda3/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arc/miniconda3/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arc/miniconda3/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arc/miniconda3/lib/python3.11/site-packages/freyja/_cli.py", line 294, in plot
    makePlot_simple(agg_df, lineages, output, colors0)
  File "/home/arc/miniconda3/lib/python3.11/site-packages/freyja/utils.py", line 308, in makePlot_simple
    agg_df = prepSummaryDict(agg_df)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arc/miniconda3/lib/python3.11/site-packages/freyja/utils.py", line 287, in prepSummaryDict
    agg_d0.loc[:, 'summarized'] = agg_d0['summarized']\
                                  ~~~~~~^^^^^^^^^^^^^^
  File "/home/arc/miniconda3/lib/python3.11/site-packages/pandas/core/frame.py", line 4102, in __getitem__
    indexer = self.columns.get_loc(key)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arc/miniconda3/lib/python3.11/site-packages/pandas/core/indexes/base.py", line 3812, in get_loc
    raise KeyError(key) from err
KeyError: 'summarized'

This is how my aggregated tsv file looks like,

summarized      lineages        abundances      resid   coverage
INCSS001580_var.tsv     [('XBB.1.16* [Omicron (XBB.1.16.X)]', 0.551723980405419), ('Other', 0.4482759974377564)]        XDB GY.1.1 GY.8 GY.9 GY.1 GY.3 GY.7 XBB.1.16.26 FU.4 FU.1
INCSS001581_var.tsv     [('Omicron', 0.22222199999999165), ('Other', 0.00441286463845308)]      BA.2.70 B.1.177.25 B.1.618      0.22222200 0.00220643 0.00220643        0.5119160

Please help.

Thank you

freyja

0 answers

No answers yet.

Log in to answer this question.