andersen-lab / Freyja

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

raise TypeError(f"{cls.__name__}.name must be a hashable type") #188

Closed bsalehe closed 6 months ago

bsalehe commented 8 months ago

Hi there,

I am trying to run freyja dash command however I am getting this error. The command is as follow: freyja dash aggregate_demixed.tsv metadata2.csv dasboard-title.txt introContent.txt --output results/dash.html

I am getting the following python error: "TypeError: Series.name must be a hashable type"

/opt/miniconda3/envs/wastewater/lib/python3.10/site-packages/freyja/utils.py:500: FutureWarning: The behavior of array concatenation with empty entries is deprecated. In a future version, this will no longer exclude empty items when determining the result dtype. To retain the old behavior, exclude the empty entries before the concat operation. df_ab_lin = pd.concat([ Traceback (most recent call last): File "/opt/miniconda3/envs/wastewater/bin/freyja", line 10, in sys.exit(cli()) File "/opt/miniconda3/envs/wastewater/lib/python3.10/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) File "/opt/miniconda3/envs/wastewater/lib/python3.10/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/opt/miniconda3/envs/wastewater/lib/python3.10/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/opt/miniconda3/envs/wastewater/lib/python3.10/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "/opt/miniconda3/envs/wastewater/lib/python3.10/site-packages/click/core.py", line 783, in invoke return __callback(args, **kwargs) File "/opt/miniconda3/envs/wastewater/lib/python3.10/site-packages/freyja/_cli.py", line 467, in dash make_dashboard(agg_df, meta_df, thresh, titleText, introText, File "/opt/miniconda3/envs/wastewater/lib/python3.10/site-packages/freyja/utils.py", line 597, in make_dashboard df_ab_lin, df_ab_sum, dates_to_keep = get_abundance(agg_df, meta_df, File "/opt/miniconda3/envs/wastewater/lib/python3.10/site-packages/freyja/utils.py", line 502, in get_abundance pd.Series(agg_df.loc[sampLabel, 'linDict'][0], File "/opt/miniconda3/envs/wastewater/lib/python3.10/site-packages/pandas/core/series.py", line 425, in init name = ibase.maybe_extract_name(name, data, type(self)) File "/opt/miniconda3/envs/wastewater/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 7618, in maybe_extract_name raise TypeError(f"{cls.name}.name must be a hashable type") TypeError: Series.name must be a hashable type

I am wondering because I previously ran successfully the same command. I just changed the data column in the metadata file. I am not sure what went wrong at this time. Your help is extremely appreciated. Attached demix and metadata file.

metadata2.csv aggregate_demixed.txt

Thanks

joshuailevy commented 6 months ago

Hi @bsalehe,

Sorry for the excessively long delay, I seem to have missed this when you first submitted it. So it looks like your metadata file has duplicate entries for SRR18539293.variants.tsv, which have different dates. The dash function wasn't smart enough to know what to do here, so it just threw a (rather unhelpful) error. Now adding in a duplicate checking clause that will provide a more useful user response in this case.

Best, Josh