hisat SyntaxError: invalid syntax
2
0
Entering edit mode
3.1 years ago
Xiaoyun ▴ 10

Hi all,

I am really struggling with hisat2 recently and getting confused. I'm trying to run hisat2

python2 /home/yun/Downloads/hisat2-2.2.0/hisat2 -t -p 2 -x shiryn\ RNAseq\ data/reference/grch38_genome/grch38 -1 shiryn\ RNAseq\ data/trimmed\ data/ly1_paired_1.trim.fq.gz shiryn\ RNAseq\ data/trimmed\ data/ly1_paired_2.trim.fq.gz -S shiryn\ RNAseq\ data/alighed/ly1.sam

Heie is my error:

File "/home/yun/Downloads/hisat2-2.2.0/hisat2", line 31
use strict;
         ^
SyntaxError: invalid syntax

Any help is appreciated.

hisat2 running erroe • 2.4k views
ADD COMMENT
0
Entering edit mode

This was already indirectly answered in your other thread. Try typing python3 instead of python2.

ADD REPLY
1
Entering edit mode

I see the problem actually, amusing

hisat2 runs via perl

hisat2-build runs via python

ADD REPLY
0
Entering edit mode

Serves me right for trying to answer the question in general without knowing the inner workings of the program. Xiaoyun, please ignore my response.

ADD REPLY
1
Entering edit mode
3.1 years ago
GenoMax 147k

hisat2 is a wrapper script. You need to run it simply as is. Do not run it using python2.

$ hisat2 -h
HISAT2 version 2.2.0 by Daehwan Kim (infphilo@gmail.com, www.ccb.jhu.edu/people/infphilo)
Usage: 
  hisat2 [options]* -x <ht2-idx> {-1 <m1> -2 <m2> | -U <r> | --sra-acc <SRA accession number>} [-S <sam>]
ADD COMMENT
0
Entering edit mode
ADD REPLY
0
Entering edit mode

After I run the command

hisat2 -t -p 2 -x shiryn\ RNAseq\ data/reference/grch38_genome/grch38 -1 shiryn\ RNAseq\ data/trimmed\ data/ly1_paired_1.trim.fq.gz shiryn\ RNAseq\ data/trimmed\ data/ly1_paired_2.trim.fq.gz -S shiryn\ RNAseq\ data/alighed/ly1.sam

The output is

/usr/bin/env: ‘python’: No such file or directory
Extra parameter(s) specified: "data/reference/grch38_genome/grch38", "shiryn", "RNAseq", "data/trimmed", "data/ly1_paired_2.trim.fq.gz", "RNAseq", "data/alighed/ly1.sam"
Overall time: 00:00:00
Error: Encountered internal HISAT2 exception (#1)
Command: /home/yun/Downloads/hisat2-2.2.0/hisat2-align-s --wrapper basic-0 -t -p 2 -x shiryn -S shiryn RNAseq data/reference/grch38_genome/grch38 shiryn RNAseq data/trimmed data/ly1_paired_2.trim.fq.gz RNAseq data/alighed/ly1.sam 
(ERR): hisat2-align exited with value 1
ADD REPLY
0
Entering edit mode

It may be much simpler to re-install hisat2 using conda. Please use the directions here: Creating workflows with snakemake and conda (use the conda part of this tutorial). It should, I think, install all necessary dependencies in your user space.

Please do NOT use spaces in folder/file names (shiryn\ RNAseq\). While it may work it would cause strange issues with programs like what you are seeing here.

ADD REPLY
0
Entering edit mode

It have worked. Thanks for your help.

ADD REPLY
0
Entering edit mode
3.1 years ago

Don't run hisat2 through Python, it is not written in Python.

You could run it via Perl, but there should be no need to do so.

Invoke it directly as

hisat2

Edit: now I see that you also had a problem here

hisat2 /usr/bin/env: ‘python’: No such file or directory

as it turns out the two programs were written in different languages

  • hisat2 runs via perl
  • hisat2-build runs via python
ADD COMMENT
0
Entering edit mode

So how should I do? After I run the command

hisat2 -t -p 2 -x shiryn\ RNAseq\ data/reference/grch38_genome/grch38 -1 shiryn\ RNAseq\ data/trimmed\ data/ly1_paired_1.trim.fq.gz shiryn\ RNAseq\ data/trimmed\ data/ly1_paired_2.trim.fq.gz -S shiryn\ RNAseq\ data/alighed/ly1.sam

The output is

    /usr/bin/env: ‘python’: No such file or directory
Extra parameter(s) specified: "data/reference/grch38_genome/grch38", "shiryn", "RNAseq", "data/trimmed", "data/ly1_paired_2.trim.fq.gz", "RNAseq", "data/alighed/ly1.sam"
Overall time: 00:00:00
Error: Encountered internal HISAT2 exception (#1)
Command: /home/yun/Downloads/hisat2-2.2.0/hisat2-align-s --wrapper basic-0 -t -p 2 -x shiryn -S shiryn RNAseq data/reference/grch38_genome/grch38 shiryn RNAseq data/trimmed data/ly1_paired_2.trim.fq.gz RNAseq data/alighed/ly1.sam 
(ERR): hisat2-align exited with value 1

I have installed python2 and python3. But it desn't work at all.

ADD REPLY
0
Entering edit mode

Check if soft linking python2 to python works. Do you have admin or sudo privileges on your system? Please do not use spaces, dots and other special characters in folder or file names.

ADD REPLY

Login before adding your answer.

Traffic: 2357 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6