vanheeringen-lab / gimmemotifs

Suite of motif tools, including a motif prediction pipeline for ChIP-seq experiments. See full GimmeMotifs documentation for detailed installation instructions and usage examples.
https://gimmemotifs.readthedocs.io/en/master
MIT License
109 stars 33 forks source link

AttributeError: 'Genome' object has no attribute 'props' #121

Closed Fnyasimi closed 3 years ago

Fnyasimi commented 4 years ago

Describe the bug I get this error when I try to do Motif enrichment statistics. I downloaded the dm6 genome using genomepy. I dont understand what is causing the problem.

A quick question regarding this can I get the statistics without using the genome? I am interested in replicating the gimme roc command which was depreciated. Previously it was done like this;

gimme roc lola.pfm ENCFF742LVH.fa ENCFF742LVH.bg > lola_gimme_metrics.txt What is the equivalent of the same?

To Reproduce My current try which ran into the error is; gimme motifs ENCFF742LVH.fa lola-motif -b ENCFF742LVH.bg -p lola.pfm --known -g dm6

Expected behavior I expected to get the gimme.roc.report.txt in the results dir

Error logs

2020-06-09 14:39:15,007 - INFO - skipping de novo
2020-06-09 14:39:15,007 - INFO - creating motif scan tables
2020-06-09 14:39:15,239 - INFO - using 10000 sequences
2020-06-09 14:39:15,239 - INFO - Creating index for genomic GC frequencies.
Traceback (most recent call last):
  File "/home/festo/miniconda3/bin/gimme", line 11, in <module>
    cli(sys.argv[1:])
  File "/home/festo/miniconda3/lib/python3.7/site-packages/gimmemotifs/cli.py", line 625, in cli
    args.func(args)
  File "/home/festo/miniconda3/lib/python3.7/site-packages/gimmemotifs/commands/motifs.py", line 174, in motifs
    gcnorm=True,
  File "/home/festo/miniconda3/lib/python3.7/site-packages/gimmemotifs/scanner.py", line 306, in scan_to_file
    gcnorm=gcnorm,
  File "/home/festo/miniconda3/lib/python3.7/site-packages/gimmemotifs/scanner.py", line 199, in command_scan
    genome=genome, fname=bgfile, size=fa.median_length(), gc=gcnorm
  File "/home/festo/miniconda3/lib/python3.7/site-packages/gimmemotifs/scanner.py", line 747, in set_background
    tmp.name, genome, number=nseq, length=size, bins=gc_bins
  File "/home/festo/miniconda3/lib/python3.7/site-packages/gimmemotifs/background.py", line 387, in gc_bin_bedfile
    create_gc_bin_index(genome, fname, min_bin_size=min_bin_size)
  File "/home/festo/miniconda3/lib/python3.7/site-packages/gimmemotifs/background.py", line 326, in create_gc_bin_index
    sizes = g.props["sizes"]["sizes"]
AttributeError: 'Genome' object has no attribute 'props'

Installation information (please complete the following information):

simonvh commented 4 years ago

This is a bug due to version mismatches between gimmemotifs and genomepy. Actually, a new version of gimmemotifs was released today which hopefully also fixes this bug. Can you try this:

conda create -n gimme gimmemotifs=0.14.4

This should create an environment with the correct version.

Regarding your other question: you're correct that this is the equivalent command. It should create a file called gimme.roc.report.txt in your output directory (when it runs correctly). The reason for the change is two-fold. 1) I wanted a more streamlined experience where the typical analysis could be run with one command. 2) The fact that a genome is required is because it is used to set motif-specific thresholds for scanning. In practice this results in better thresholds than the previous approach (which set too lenient thresholds for short motifs and too strict thresholds for long motifs). I probably should allow an analysis without a genome , however, this necessitates some code changes which I haven't found the time for.

Fnyasimi commented 4 years ago

Thank you the module below is depreciated in sklearn 0.23.1. Thought it will be useful for future releases.

Traceback (most recent call last):
  File "/home/festo/miniconda3/bin/gimme", line 8, in <module>
    from gimmemotifs.cli import cli
  File "/home/festo/miniconda3/lib/python3.7/site-packages/gimmemotifs/cli.py", line 11, in <module>
    from gimmemotifs import commands, __version__
  File "/home/festo/miniconda3/lib/python3.7/site-packages/gimmemotifs/commands/__init__.py", line 15, in <module>
    "{0}.{1}".format(__name__, cmdname), globals(), locals(), [cmdname], level
  File "/home/festo/miniconda3/lib/python3.7/site-packages/gimmemotifs/commands/maelstrom.py", line 9, in <module>
    from gimmemotifs.maelstrom import run_maelstrom
  File "/home/festo/miniconda3/lib/python3.7/site-packages/gimmemotifs/maelstrom.py", line 37, in <module>
    from gimmemotifs.moap import moap, Moap, scan_to_table
  File "/home/festo/miniconda3/lib/python3.7/site-packages/gimmemotifs/moap.py", line 41, in <module>
    from lightning.classification import CDClassifier
  File "/home/festo/miniconda3/lib/python3.7/site-packages/lightning/classification.py", line 1, in <module>
    from .impl.adagrad import AdaGradClassifier
  File "/home/festo/miniconda3/lib/python3.7/site-packages/lightning/impl/adagrad.py", line 8, in <module>
    from sklearn.externals.six.moves import xrange
ModuleNotFoundError: No module named 'sklearn.externals.six'
simonvh commented 4 years ago

Thanks for the notification. I'm indeed removing this dependency in the current development version. However, this is why I specified scikit-learn=0.22.2.post1 for the current gimmemotifs bioconda package. Not sure how sklearn 0.23 can be installed :/.

Fnyasimi commented 4 years ago

The sklearn 0.23.1 can be installed from the conda-forge channel conda install scikit-learn==0.23.1 -c conda-forge

Fnyasimi commented 4 years ago

I was wondering if the meme version used by the tool can be upgraded to v5.1.1?

simonvh commented 4 years ago

Sorry for the delay in answering! The new build (gimmemotifs-0.14.4 py37h516909a_1) should install meme v5.1.1.

Can I ask how you installed / upgraded GimmeMotifs? It seems that some of the depencies are not correctly installed or upgraded. Sometimes with conda the best way to this is to create a fresh new environment:

conda create -n gimme gimmemotifs=0.14.4
Fnyasimi commented 4 years ago

I used that command and it comes wit meme v5.0.5

simonvh commented 3 years ago

Dependencies should be fixed with the latest release.