This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Tophat2 shows error during running

Hi friends

I installed Tophat2 with all dependencies (bowtie2, Boost, Samtools) but when I want to run tophat, it shows this error:

File "/home/tophat-2.0.14/bin/tophat", line 1003
    except getopt.error, msg:                       ^
SyntaxError: invalid syntax

My python version is 3.4 , how can I fix this problem?

Thanks

rna-seq python tophat

What Devon said. Tophat is not Python 3 clean, so Python 2 is required.

Hi Whoknows, did Devon's suggestion work for you?

Yes, tophat has problem with python 2, I had to reinstall linux with python2

Please accept his answer if that's the case, so this question would be marked as solved by the system.

Yes it was because python 3 in changed to python 2

Click the green check mark you see on the left panel of his answer, near the number of votes.

2 answers

Try installing python2.

Here is a quick solution without installing/re-installing different versions of python:

# Create a new environment for python 2.7
>conda create -n py2 python=2.7 anaconda
#To activate this environment, use:
> source activate py2

>conda install -c bioconda tophat

>tophat2 --help  ### should work now
#To deactivate this environment, use:
> source deactivate py2

Use the formatting bar (especially the 101010 code button) to format your post please. I've done it for you this time. Thank you.

Log in to answer this question.