TopHat error: IOError [errno 2] No such file or directory: '-o'
2
0
Entering edit mode
5.0 years ago
lishen0709 • 0

Hello everyone.

I'm now running tophat in our server. First, I just simply tried "tophat -p 8 -G <gtf_file> <ref_genome> <fa1><fa2>" and it worked. Then I wrote a for loop scripts but It reported error:

[2019-04-03 10:49:16] Beginning TopHat run (v2.1.0)

-----------------------------------------------

[2019-04-03 10:49:16] Checking for Bowtie

                  Bowtie version:        2.2.9.0

[2019-04-03 10:49:16] Checking for Bowtie index files (genome)..

[2019-04-03 10:49:16] Checking for reference FASTA file

Warning: Could not find FASTA file mouse/bowtie2_index_mouse/mouse_ref.fa

[2019-04-03 10:49:16] Reconstituting reference FASTA file from Bowtie index

Executing: /opt/sw/packages/gcc-4.8/bowtie2/2.2.9/bin/bowtie2-inspect 
mouse/bowtie2_index_mouse/mouse_ref > ./tophat_out/tmp/mouse_ref.fa

[2019-04-03 10:51:05] Generating SAM header for mouse/bowtie2_index_mouse/mouse_ref

Traceback (most recent call last):

File "/opt/sw/packages/gcc-4.8.3/mvapich2-2.1/boost-1.59.0/tophat2/2.1.0/bin/tophat", line 4095, in <module>

sys.exit(main())

File "/opt/sw/packages/gcc-4.8.3/mvapich2-2.1/boost-1.59.0/tophat2/2.1.0/bin/tophat", line 3949, in main
    params.read_params = check_reads_format(params, reads_list)

File "/opt/sw/packages/gcc-4.8.3/mvapich2-2.1/boost-1.59.0/tophat2/2.1.0/bin/tophat", line 1844, in check_reads_format
    zf = ZReader(f_name, params)

File "/opt/sw/packages/gcc-4.8.3/mvapich2-2.1/boost-1.59.0/tophat2/2.1.0/bin/tophat", line 1797, in __init__
    self.file=open(filename)

IOError: [Errno 2] No such file or directory: '-o'

My for loop code is shown as below:

for name1 in R1/*_R1_001.fastq.trimmed_val.fq; 
do 
name2="R2/$(basename "$name1" _R1_001.fastq.trimmed_val.fq)_R2_001.fastq.trimmed_val.fq"; 

if [ ! -f "$name2" ]; then printf 'Missing "%s"\n' "$name2"; 
continue; 
fi;
tophat -p 8 mouse/bowtie2_index_mouse/mouse_ref -o tophat_out/ -G mouse/ensembl_gtf/Mus_musculus.GRCm38.95.chr_patch_hapl_scaff.gtf $name1 $name2; 
done

It looks like the directory path problem but I have changed the path several times it still report this error. I wonder if anyone could help me about this?

Thank you!

RNA-Seq rna-seq alignment software error • 2.8k views
ADD COMMENT
2
Entering edit mode

You should probably not be using tophat! See this tweet from Lior Pachter one of the inventors of tophat. Use HISAT or STAR instead.

ADD REPLY
0
Entering edit mode

Does the tophat_out directory already exist before you run the program?

ADD REPLY
0
Entering edit mode

Can you share one file name belonging to the same sample from R1 and R2 directory?

ADD REPLY
2
Entering edit mode
5.0 years ago

Its probably safer to list your options like -o and -G before you give the path to the genome Notice how in your first working example, -G is before you specified the path to the genome.

Usage: tophat [options]* <genome_index_base> <reads1_1[,...,readsn_1]&gt; [reads1_2,...readsn_2]<="" p="">

https://ccb.jhu.edu/software/tophat/manual.shtml

I think the software thinks it's looking for a fastq file called -o when you put that right after the path to your genome.

ADD COMMENT
0
Entering edit mode
2.7 years ago
alexaminar • 0

Most likely, the problem is that you're using a relative file path to open the file.

An absolute path is a path that starts with your computer's root directory, for example 'C:\Python\scripts..' if you're on Windows.

A relative path is a python path that does not start with your computer's root directory, and is instead relative to something called the working directory. You can view Python's current working directory by calling os.getcwd().

Use an absolute path to open the file:

file = open(r'C:\path\to\your\file.ext')
ADD COMMENT

Login before adding your answer.

Traffic: 1709 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