This is a test version of Biostars. For the public version, visit https://www.biostars.org.
TopHat installation error

I'm new to ubuntu and i am trying to install tophat-2.1.1.Linux_x86_64 in an ubuntu 16.04 LTS system.

I unpacked the binary version to the home directory, and because ~/bin is in my $PATH I did:

cd 
tar xvfz tophat-2.1.1.Linux_x86_64.tar.gz
cd ~/bin
ln -s ~/tophat-2.1.1.Linux_x86_64/tophat2

And I got the following error when type tophat2:

File "/home/tania/tophat-2.1.1.Linux_x86_64/tophat", line 1003
    except getopt.error, msg:
                       ^
SyntaxError: invalid syntax

What am I doing wrong?

tophat

Try tophat2 -h. (or -help) It is expecting you to provide some input.

it gives the same error

The investigate @Wouter's suggestion below.

Looks like a wrong python version issue

to use tophat Python version 2.6 or higher is required, and mine is Python 3.5.2, so it isn't cause of that

Oh and stop using tophat for new projects, it's deprecated

2 answers

You're using python3, which won't work for tophat2 (or bowtie2). Anyway, there's no reason to ever use tophat2 for new analyses. Use STAR or BBmap.

edit the first line in your_tophat_directory/tophat from:

#!/usr/bin/env python

to:

#!/usr/bin/env python2

It worked for me.

Thanks, this worked for me. I know tophat hasn't been updated since 2016, but some pipelines still use it.

This assumes that version 2 of python is installed on your machine and is aliased as python2. In my case a version was present (check with: which -a python) but aliased as python2.7. Hence I had to modify the line to:

 #!/usr/bin/env python2.7

It helps if you understand what you are doing.

Log in to answer this question.