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

ComputeError in motif discovery #77

Closed
Ge0rges opened this issue Oct 12, 2024 · 4 comments
Closed

ComputeError in motif discovery #77

Ge0rges opened this issue Oct 12, 2024 · 4 comments

Comments

@Ge0rges
Copy link

Ge0rges commented Oct 12, 2024

Hello,

I wanted to report this error when running motif discovery.

Traceback (most recent call last):
  File "/Accounts/gkanaan/miniconda3/nanomotif/bin/nanomotif", line 8, in <module>
    sys.exit(main())
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/nanomotif/main.py", line 563, in main
    motif_discovery(args)
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/nanomotif/main.py", line 361, in motif_discovery
    bin_consensus(args, pileup=pileup, assembly=assembly, motifs=motifs, motifs_scored=scored_all)
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/nanomotif/main.py", line 315, in bin_consensus
    output = nm.bin_consensus.within_bin_motifs_consensus(pileup.pileup, assembly, motifs, motifs_scored, bins)
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/nanomotif/bin_consensus.py", line 49, in within_bin_motifs_consensus
    bin_motifs = contig_motifs.groupby("bin", "motif", "mod_position", "mod_type") \
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/polars/dataframe/frame.py", line 8054, in with_columns
    return self.lazy().with_columns(*exprs, **named_exprs).collect(_eager=True)
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/polars/lazyframe/frame.py", line 1810, in collect
    return wrap_df(ldf.collect())
polars.exceptions.ComputeError: ComputeError: The output type of the 'apply' function cannot be determined.
The function was never called because 'skip_nulls=True' and all values are null.
Consider setting 'skip_nulls=False' or setting the 'return_dtype'.
@SorenHeidelbach
Copy link
Collaborator

SorenHeidelbach commented Oct 15, 2024

Can you provide the freeze of the enviroment you are using (pip freeze or conda list if using conda)? And possibly the output in motif.tsv in the nanomotif output folder?

Thank you!

@Ge0rges
Copy link
Author

Ge0rges commented Oct 15, 2024

Sure here they are.
conda_list.txt
motifs.txt
pip_freeze.txt

@Ge0rges
Copy link
Author

Ge0rges commented Oct 27, 2024

Setting return,dtype=pl.String fixes this, I then run into:

Traceback (most recent call last):
  File "/Accounts/gkanaan/miniconda3/nanomotif/bin/nanomotif", line 8, in <module>
    sys.exit(main())
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/nanomotif/main.py", line 563, in main
    motif_discovery(args)
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/nanomotif/main.py", line 360, in motif_discovery
    bin_consensus(args, pileup=pileup, assembly=assembly, motifs=motifs, motifs_scored=scored_all)
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/nanomotif/main.py", line 315, in bin_consensus
    output = nm.bin_consensus.merge_bin_motifs(output, bins, pileup, assembly)
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/nanomotif/bin_consensus.py", line 119, in merge_bin_motifs
    return new_bin_motifs

Because the bin_motifs dataframe was empty. Fixed by assigning new_bin_motifs = bin_motifs outside the loop.

Then again a similar error:

Traceback (most recent call last):
  File "/Accounts/gkanaan/miniconda3/nanomotif/bin/nanomotif", line 8, in <module>
    sys.exit(main())
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/nanomotif/main.py", line 563, in main
    motif_discovery(args)
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/nanomotif/main.py", line 360, in motif_discovery
    bin_consensus(args, pileup=pileup, assembly=assembly, motifs=motifs, motifs_scored=scored_all)
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/nanomotif/main.py", line 319, in bin_consensus
    output = nm.postprocess.join_motif_complements(output)
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/nanomotif/postprocess.py", line 132, in join_motif_complements
    motif_df = motif_df.with_columns([
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/polars/dataframe/frame.py", line 8054, in with_columns
    return self.lazy().with_columns(*exprs, **named_exprs).collect(_eager=True)
  File "/Accounts/gkanaan/miniconda3/nanomotif/lib/python3.9/site-packages/polars/lazyframe/frame.py", line 1810, in collect
    return wrap_df(ldf.collect())
polars.exceptions.ComputeError: ComputeError: The output type of the 'apply' function cannot be determined.
The function was never called because 'skip_nulls=True' and all values are null.
Consider setting 'skip_nulls=False' or setting the 'return_dtype'.

I specified the return_dtype=pl.String, and the program completed.

@SorenHeidelbach
Copy link
Collaborator

This should be fixed in version 0.4.16 and forwards

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

2 participants