andersen-lab / Freyja

Depth-weighted De-Mixing
BSD 2-Clause "Simplified" License
100 stars 29 forks source link

Freyja plot error #228

Open ChromatinLab opened 2 months ago

ChromatinLab commented 2 months ago

Hello everyone,

I am using 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 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

ChromatinLab commented 2 months ago

Hello, Can you please kindly look into this matter, every time I am trying to run freyja plot command this error is coming, even I tried to update freyja . But still same error is showing.

joshuailevy commented 2 months ago

Hi,

Your aggregated tsv file seems to have a slightly strange format, but it's hard to tell from what you've posted. Can you send a copy of your aggregated tsv to me at jolevy@scripps.edu?

Josh

ChromatinLab commented 2 months ago

Hello Josh,

I have sent you an email with the aggregated tsv file. Please kindly check and let me know.

Thanks

joshuailevy commented 2 months ago

Hi @ChromatinLab, I just took a look. Plot seems to work fine for me, what version of freyja are you using?

Your samples have fairly low genome coverage, and if you're using an older version of the package it might not produce the proper error message. When using the newest version of the package, if I don't adjust the --mincov parameter to a small value, I get the following error, as desired:

ERROR: No samples matching coverage requirements, so no plot will be generated. Try changing --mincov threshold.

Josh

ChromatinLab commented 2 months ago

Hi Josh, I am using Freyja v1.5.0.