marschall-lab / panacus

Panacus is a tool for computing statistics for GFA-formatted pangenome graphs
MIT License
85 stars 5 forks source link

AttributeError: 'DataFrame' object has no attribute 'cumulative' #2

Closed subwaystation closed 1 year ago

subwaystation commented 1 year ago

Hi @danydoerr,

I tried to visualize my pangenome-growth output with your Python script, however, I ran into the following problem:

python3 ~/software/panacus/git/master/scripts/visualize_growth.py chrM.hprc-v1.0-pggb.og.pangenome-growth_r100.txt
Traceback (most recent call last):
  File "/home/ubuntu/software/panacus/git/master/scripts/visualize_growth.py", line 66, in <module>
    plot(df, path.basename(args.growth_stats.name), out)
  File "/home/ubuntu/software/panacus/git/master/scripts/visualize_growth.py", line 35, in plot
    plt.bar(x=xticks, height=df.cumulative)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 5989, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'cumulative'

chrM.hprc-v1.0-pggb.og.pangenome-growth_r100.txt

Thanks for any tips!

subwaystation commented 1 year ago

Both the script and the binary are from today's master.

danydoerr commented 1 year ago

Please use the "ng" branch. It's close to being released. We will probably push to main some time next week. Also, if you call visualize_growth.py, make sure to pipe the output into a file, e.g. "> growth.pdf".

subwaystation commented 1 year ago

I gave it another try using the ng branch and now the following command is just stuck and I have to type q to end it. Control + C did have no effect:

python3 ~/software/panacus/git/master/scripts/visualize_growth.py chrM.hprc-v1.0-pggb.og.histgrowth.tsv > chrM.hprc-v1.0-pggb.og.histgrowth.tsv.pdf

I did the following to generate the file:

panacus histgrowth -c bps chrM.hprc-v1.0-pggb.gfa > chrM.hprc-v1.0-pggb.og.histgrowth.tsv

Would I need to use another subcommand?

subwaystation commented 1 year ago

You also removed the possibility to run several iterations of growth. Was this your intention?

danydoerr commented 1 year ago

I gave it another try using the ng branch and now the following command is just stuck and I have to type q to end it. Control + C did have no effect:


python3 ~/software/panacus/git/master/scripts/visualize_growth.py chrM.hprc-v1.0-pggb.og.histgrowth.tsv > chrM.hprc-v1.0-pggb.og.histgrowth.tsv.pdf

Are you running the latest version?


I did the following to generate the file:

panacus histgrowth -c bps chrM.hprc-v1.0-pggb.gfa > chrM.hprc-v1.0-pggb.og.histgrowth.tsv



Would I need to use another subcommand?

That's the right command!

danydoerr commented 1 year ago

You also removed the possibility to run several iterations of growth. Was this your intention?

Yes. We compute the growth curve exactly, so no need to sample. And we are faster doing so :)

subwaystation commented 1 year ago

I gave it another try using the ng branch and now the following command is just stuck and I have to type q to end it. Control + C did have no effect:

python3 ~/software/panacus/git/master/scripts/visualize_growth.py chrM.hprc-v1.0-pggb.og.histgrowth.tsv > chrM.hprc-v1.0-pggb.og.histgrowth.tsv.pdf

Are you running the latest version?


I did the following to generate the file:

panacus histgrowth -c bps chrM.hprc-v1.0-pggb.gfa > chrM.hprc-v1.0-pggb.og.histgrowth.tsv


Would I need to use another subcommand?

That's the right command!

I am using

commit 96776f697b989643056e107d9fba52d10c422653 (HEAD -> ng, origin/ng)
Author: lucaparmigiani <luca.parmigiani@studenti.univr.it>
Date:   Wed May 10 11:45:17 2023 +0200

    intersection and coverage with rug integers
danydoerr commented 1 year ago

I gave it another try using the ng branch and now the following command is just stuck and I have to type q to end it. Control + C did have no effect:

python3 ~/software/panacus/git/master/scripts/visualize_growth.py chrM.hprc-v1.0-pggb.og.histgrowth.tsv > chrM.hprc-v1.0-pggb.og.histgrowth.tsv.pdf

Are you running the latest version?


I did the following to generate the file:

panacus histgrowth -c bps chrM.hprc-v1.0-pggb.gfa > chrM.hprc-v1.0-pggb.og.histgrowth.tsv


Would I need to use another subcommand?

That's the right command!

I am using

commit 96776f697b989643056e107d9fba52d10c422653 (HEAD -> ng, origin/ng)
Author: lucaparmigiani <luca.parmigiani@studenti.univr.it>
Date:   Wed May 10 11:45:17 2023 +0200

    intersection and coverage with rug integers

Yeah, this is not the latest version. It's no on d77b72d. Please update.

danydoerr commented 1 year ago

I gave it another try using the ng branch and now the following command is just stuck and I have to type q to end it. Control + C did have no effect:

python3 ~/software/panacus/git/master/scripts/visualize_growth.py chrM.hprc-v1.0-pggb.og.histgrowth.tsv > chrM.hprc-v1.0-pggb.og.histgrowth.tsv.pdf

Are you running the latest version?


I did the following to generate the file:

panacus histgrowth -c bps chrM.hprc-v1.0-pggb.gfa > chrM.hprc-v1.0-pggb.og.histgrowth.tsv


Would I need to use another subcommand?

That's the right command!

I am using

commit 96776f697b989643056e107d9fba52d10c422653 (HEAD -> ng, origin/ng)
Author: lucaparmigiani <luca.parmigiani@studenti.univr.it>
Date:   Wed May 10 11:45:17 2023 +0200

    intersection and coverage with rug integers

Yeah, this is not the latest version. It's no on d77b72d. Please update.

No need to re-run panacus, just re-run the visualization script.

subwaystation commented 1 year ago

Alright, I am here

commit d77b72d7bbe2837f831e0cc0445c57fcfab8996f (HEAD -> ng, origin/ng)
Author: Dany Doerr <daniel.doerr@hhu.de>
Date:   Wed May 10 14:21:38 2023 +0200

    improve visualization

And I ran

panacus histgrowth -c bps chrM.hprc-v1.0-pggb.gfa > chrM.hprc-v1.0-pggb.og.histgrowth.tsv
python3 ~/software/panacus/git/master/scripts/visualize_growth.py chrM.hprc-v1.0-pggb.og.histgrowth.tsv > chrM.hprc-v1.0-pggb.og.histgrowth.tsv.pdf

Which gives me Input file "chrM.hprc-v1.0-pggb.og.histgrowth.tsv" has wrong header. It doesn't seem to be generated by panacus, exiting.

subwaystation commented 1 year ago

Doing all steps from scratch inclusively a fresh clone on my local machine, it worked. Thanks!

subwaystation commented 1 year ago

Edit: There was indeed a bug within the header of the TSV. It worked only works when you execute via ./target/release/panacus, but fails when using a symlink running directly panacus. A fix is incoming I was told ;)

danydoerr commented 1 year ago

Fixed version is now committed.