donovan-h-parks / CompareM

A toolbox for comparative genomics.
GNU General Public License v3.0
96 stars 19 forks source link

kmer_usage error #15

Closed slhogle closed 4 years ago

slhogle commented 6 years ago

Hi,

I'm getting an exceptions.AttributeError when using comparem kmer_usage. The same error occurs when supplying a genome list text file or a directory. However, aa_usage, codon_usage, stop_usage, lgt_di, and lgt_codon all work without error.

thanks in advance for any help, shane

CompareM v0.0.23 RedHat Linux CentOS release 6.8 (Final)


[2018-01-26 08:17:10] INFO: CompareM v0.0.23
[2018-01-26 08:17:10] INFO: comparem kmer_usage -k 4 -c 1 ./prochlorococcus/MIT9202 test
[2018-01-26 08:17:10] INFO: Calculating unique kmers of size k = 4.
[2018-01-26 08:17:10] INFO: Calculating kmer usage for each genome.
<type 'exceptions.AttributeError'>%) genomes.
Traceback (most recent call last):
  File "/home/shogle/anaconda2/lib/python2.7/site-packages/biolib/parallel.py", line 189, in run
    consumer_data = consumer(produced_data, consumer_data)
  File "/home/shogle/anaconda2/lib/python2.7/site-packages/comparem/kmer_usage.py", line 108, in _consumer
    consumer_data.kmer_set.update(kmer_usage.keys())
AttributeError: 'list' object has no attribute 'keys'

[2018-01-26 08:17:11] WARNING: Exception encountered while processing data.

Unexpected error: <type 'exceptions.AttributeError'>
Traceback (most recent call last):
  File "/home/shogle/anaconda2/bin/comparem", line 375, in <module>
    parser.parse_options(args)
  File "/home/shogle/anaconda2/lib/python2.7/site-packages/comparem/main.py", line 494, in parse_options
    self.kmer_usage(options)
  File "/home/shogle/anaconda2/lib/python2.7/site-packages/comparem/main.py", line 303, in kmer_usage
    genome_kmer_usage, kmer_set = kmer_usage.run(genome_files)
  File "/home/shogle/anaconda2/lib/python2.7/site-packages/comparem/kmer_usage.py", line 156, in run
    return consumer_data.genome_kmer_usage, consumer_data.kmer_set
AttributeError: 'NoneType' object has no attribute 'genome_kmer_usage'```
c1imbe2 commented 6 years ago

Same error here. CompareM v. 0.0.23, macOS 10.13.3

sarah872 commented 6 years ago

Same here on CentOS!

johanneswerner commented 5 years ago

Same error on Ubuntu 16.04.2 LTS with CompareM v. 0.0.23

ghost commented 5 years ago

As @johanneswerner Same error on Ubuntu 16.04.2 LTS with CompareM v. 0.0.23

johanneswerner commented 5 years ago

Below is the function from the file kmer_usage.py

    def _consumer(self, produced_data, consumer_data):
        """Consume results from producer processes.

         Parameters
        ----------
        produced_data : list -> [genome_id, kmer_usage]
            Unique id of a genome followed by a dictionary
            indicating its kmer usage.
        consumer_data : namedtuple
            Set of kmers observed across all genomes (kmer_set),
            along with the kmer usage of each genome (genome_kmer_usage).

        Returns
        -------
        consumer_data
            The consumer data structure or None must be returned
        """

        if consumer_data == None:
            # setup data to be returned by consumer
            ConsumerData = namedtuple('ConsumerData', 'kmer_set genome_kmer_usage')
            consumer_data = ConsumerData(set(), dict())

        genome_id, kmer_usage = produced_data

        consumer_data.kmer_set.update(kmer_usage.keys()) # <- here it fails
        consumer_data.genome_kmer_usage[genome_id] = kmer_usage

        return consumer_data

I understand why it fails but how could this have worked in the first place? lists have per definition no key attribute.

donovan-h-parks commented 5 years ago

Hello. kmer_usage is suppose to be a dictionary based on my own documentation. :)

Is there an actual bug here (i.e., produced_data) is not in the expected format?

johanneswerner commented 5 years ago

I would assume so because several people had the same problem. I can provide example data if that would be helpful.

lalalagartija commented 4 years ago

Same problem here. Has someone found the reason for this ?

donovan-h-parks commented 4 years ago

Addressed in forthcoming Py3 release.

MdUmar-tech commented 3 years ago

Controlled exit resulting from an unrecoverable error or warning. mdumar@Mds-MacBook-Pro AAI MATRIX % cd /Users/mdumar/Desktop/Z_AAI mdumar@Mds-MacBook-Pro Z_AAI % /Users/mdumar/Desktop/Z_AAI/CompareM-0.1.2/bin/comparem aai_wf KOSTASAAI --file_ext fasta aai_output1 [2021-02-25 00:50:04] INFO: CompareM v0.1.2 [2021-02-25 00:50:04] INFO: comparem aai_wf KOSTASAAI --file_ext fasta aai_output1 [2021-02-25 00:50:04] INFO: Identifying genes within genomes: Traceback (most recent call last):0%) genomes. File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main exitcode = _main(fd, parent_sentinel) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/spawn.py", line 126, in _main self = reduction.pickle.load(from_parent) AttributeError: 'Parallel' object has no attribute '__process_manager'

MdUmar-tech commented 3 years ago

getting these kind of error, please help, it was working fine but then after uninstalling conda environment I got this error, after that even with conda environment it doesent works

MdUmar-tech commented 3 years ago

I am using macos