donovan-h-parks / CompareM

A toolbox for comparative genomics.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kmer_usage error

slhogle opened this issue · comments

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'```

Same error here. CompareM v. 0.0.23, macOS 10.13.3

Same here on CentOS!

Same error on Ubuntu 16.04.2 LTS with CompareM v. 0.0.23

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

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.

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?

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

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

Addressed in forthcoming Py3 release.

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'

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

I am using macos