Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pandas update breaks mirtop stats #78

Open
jonahcullen opened this issue Apr 25, 2023 · 0 comments
Open

Pandas update breaks mirtop stats #78

jonahcullen opened this issue Apr 25, 2023 · 0 comments

Comments

@jonahcullen
Copy link

Expected behavior and actual behavior.

Expected behavior is to run mirtop stats following mirtop gff. With the April 2023 update of pandas to v2.0.0, the append method of a DataFrame has been removed.

Traceback (most recent call last):
  File "/opt/conda/envs/small/bin/mirtop", line 10, in <module>
    sys.exit(main())
  File "/opt/conda/envs/small/lib/python3.10/site-packages/mirtop/command_line.py", line 34, in main
    stats(kwargs["args"])
  File "/opt/conda/envs/small/lib/python3.10/site-packages/mirtop/gff/stats.py", line 38, in stats
    out.append(_calc_stats(fn))
  File "/opt/conda/envs/small/lib/python3.10/site-packages/mirtop/gff/stats.py", line 82, in _calc_stats
    df = _summary(lines)
  File "/opt/conda/envs/small/lib/python3.10/site-packages/mirtop/gff/stats.py", line 130, in _summary
    df_sum = _add_missing(df_sum)
  File "/opt/conda/envs/small/lib/python3.10/site-packages/mirtop/gff/stats.py", line 111, in _add_missing
    df = df.append(df2, ignore_index = True)
  File "/opt/conda/envs/small/lib/python3.10/site-packages/pandas/core/generic.py", line 5989, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'append'. Did you mean: '_append'?

You can see the issue in the _add_missing function

def _add_missing(df):
    # ref_miRNA_mean
    category = "ref_miRNA_mean"
    if sum(df['category']==category) == 0:
        df2 = {'category': category, 'sample': df['sample'].iat[0], 'counts': 0}
        df = df.append(df2, ignore_index = True)
    category = "isomiR_sum"
    if sum(df['category']==category) == 0:
        df2 = {'category': category, 'sample': df['sample'].iat[0], 'counts': 0}
        df = df.append(df2, ignore_index = True)

I have not checked if it occurs elsewhere.

Steps to reproduce the problem.

Installing mirtop as described with conda will use the latest pandas (v2.0.1) and cause the above error.

Specifications like the version of the project, operating system, or hardware.

As a temporary workaround, specifying the pandas version fixes the issue

mamba create -n mirtop -c conda-forge -c bioconda mirtop=0.4.25 pandas=1.5.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant