balabanmetin / apples

distance based phylogenetic placement
GNU General Public License v3.0
24 stars 5 forks source link

Apples operands could not be broadcast together with shapes #9

Closed HollyKArnold closed 3 years ago

HollyKArnold commented 3 years ago

Hello,

I'm hoping to run apples on a dataset that we currently have. However, I'm getting this error:

~/src/apples/run_apples.py -s silvaTreeOneline.aln -q testQueryAlign.fasta -t minimum_evo_backbone.nwk 
/usr/bin/env: python3: No such file or directory
[arnoldho@darwin test]$ python ~/src/apples/run_apples.py -s silvaTreeOneline.aln -q testQueryAlign.fasta -t minimum_evo_backbone.nwk 
Traceback (most recent call last):
  File "/home/micro/arnoldho/src/apples/run_apples.py", line 3, in <module>
    from apples.PoolQueryWorker import PoolQueryWorker
  File "/raid1/home/micro/arnoldho/src/apples/apples/PoolQueryWorker.py", line 3, in <module>
    from apples.OLS import OLS
  File "/raid1/home/micro/arnoldho/src/apples/apples/OLS.py", line 1, in <module>
    from apples.Algorithm import Algorithm
  File "/raid1/home/micro/arnoldho/src/apples/apples/Algorithm.py", line 2, in <module>
    from abc import ABC, abstractmethod
ImportError: cannot import name ABC
[arnoldho@darwin test]$ souce activate apples
-bash: souce: command not found
[arnoldho@darwin test]$ source activate apples
(apples) [arnoldho@darwin test]$ python ~/src/apples/run_apples.py -s silvaTreeOneline.aln -q testQueryAlign.fasta -t minimum_evo_backbone.nwk 
FastTree Version 2.1.11 SSE3
Alignment: standard input
Nucleotide distances: Jukes-Cantor Joins: balanced Support: none
Start at tree from /tmp/tmpbd44gqfd (no NNI) (no SPR)
Total branch-length 313.843 after 11.90 secnces   
Total time: 16.80 seconds Unique: 13866/13866 Bad splits: 3738/13863 Worst delta-Len 0.056
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/micro/arnoldho/.conda/envs/apples/lib/python3.5/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/home/micro/arnoldho/.conda/envs/apples/lib/python3.5/multiprocessing/pool.py", line 47, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "/raid1/home/micro/arnoldho/src/apples/apples/PoolQueryWorker.py", line 32, in runquery
    obs_dist = cls.reference.get_obs_dist(query_seq, query_name)
  File "/raid1/home/micro/arnoldho/src/apples/apples/Reference.py", line 84, in get_obs_dist
    dist = self.dist_function(query_seq, consensus_seq)
  File "/raid1/home/micro/arnoldho/src/apples/apples/distance.py", line 92, in jc69
    nondash = np.logical_and(a2 != b'-', b2 != b'-')
ValueError: operands could not be broadcast together with shapes (5403,) (5402,) 
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/micro/arnoldho/src/apples/run_apples.py", line 97, in <module>
    results = pool.starmap(queryworker.runquery, queries)
  File "/home/micro/arnoldho/.conda/envs/apples/lib/python3.5/multiprocessing/pool.py", line 274, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/home/micro/arnoldho/.conda/envs/apples/lib/python3.5/multiprocessing/pool.py", line 644, in get
    raise self._value
ValueError: operands could not be broadcast together with shapes (5403,) (5402,) 

Any insight into how to solve this issue would be particularly helpful. I've attached the input files that I'm using. testQueryAlign.fasta.zip minimum_evo_backbone.nwk.zip silvaTreeOneline.aln.zip

balabanmetin commented 3 years ago

Hi! I solved the issue by opening the backbone alignment (silvaTreeOneline.aln) with vim, saving the file without editing (just :wq ). It seems like the last line in the backbone alignment does not have a trailing EOF, which is a case I wasn't handling.

HollyKArnold commented 3 years ago

Thanks for the response -- That worked!!