Hi, I am using subread v1.5.1 to align paired-end RNA-Seq data that is in .fastq.gz format. The prefixes for the filenames are:
- L-C-F4
- L-C-F6
- L-C-M5
- L-C-M6
- L-VR-F6
- L-VR-M4
- L-VR-M5
These are stored in a file Liveruniquelist.txt. As there are multiple files, I wrote a short shell script to loop through these files and execute the subread-align command.
while read p;
do
/home/merajext/Sumit/subread-1.5.1-Linux-X86_64/bin/subread-align -t 0 -T 8 -i /home/merajext/Sumit/SubreadIndex/subreadRnor6_Index -r $p_R1.fastq.gz -R $p_R2.fastq.gz -o /home/merajext/Sumit/RawData/SubreadAlignment/$p_subread.bam
done < Liveruniquelist.txt
However, for each file, the above code generates the following error:
ERROR: unable to open file '.fastq.gz'. File name might be incorrect, or you do not have the permission to read the file.
I am not sure if this error is because of read files in zipped form or something else. Kindly suggest.
2 answers
Depending on the number of samples, a loop can definitely be convenient. You can check how it performs by running the loop like
while read p;
echo $p_R1.fastq.gz
done < Liveruniquelist.txt
I think your problem will be solved by using ${p}_R1.fastq.gz, because your shell is now looking for the variable p_R1 which doesn't exist.
That's an error in your loop, not an error in subread. The error message clearly indicates that there is no file called '.fastq.gz'. Just take out the loop and manually do the command for each filename instead of using variables; that's simpler.
Log in to answer this question.