[ERROR] - Cannot open file when I run through a shell script, Runs normally from the compiler

1,301 views
Skip to first unread message

ana...@uic.edu

unread,
Apr 2, 2015, 2:34:58 PM4/2/15
to pear-...@googlegroups.com
Hi,

I have around 150 PE reads and because running PEAR on them singularly would be a pain,  I am trying to run it through a batch.
I have 2 text files (R1.txt and R2.txt). The first text file lists the names of the all the forward reads and the second text file lists all the reverse reads (corresponding to the forwards reads).
When I run PEAR directly from the compiler, it recognizes the fastq files and merges it the usual way, but when i run it using a shell script, i get the same error "[ERROR] - Cannot open file XXXXXXX_R2.fastq".

I shall highly appreciate if anyone can help me with this.

Thanks & Regards
anaqib2

Tomas Flouri

unread,
Apr 2, 2015, 3:32:05 PM4/2/15
to ana...@uic.edu, pear-...@googlegroups.com
Hi anaqib2,

it depends how your shell script is written and how you execute it. If your shell script starts with the line

#!/bin/bash

or in case you execute  it as

sh script.sh

then a new shell is created, and the new process is executed as if you were in your $HOME. Therefore, your files will not be found in case you use relative paths for addressing them. One solution is to change the relative paths to your files to absolute within the script.
Hope this helps,

Tomas
--
You received this message because you are subscribed to the Google Groups "pear-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pear-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages