2
$\begingroup$

Hi I am using Salmon quantitation for multiple fastq paired files using following code

salmon_index="human_salmon_index"
fastq_dir="fastq/"
for dir in "${fastq_dir}"/SRR*
do
r1_file=$(find "$dir" -name "*_1.fastq")
r2_file=$(find "$dir" -name "*_2.fastq")
samp=$(basename "$dir")
echo "Processing sample ${samp}"
salmon quant -i "$salmon_index" -l A -1 "$r1_file" -2 "$r2_file" -p 10 -o "salmon_out/${samp}_quant"
done

and getting this error after it iterates over all files and start initial processing steps.

Processing sample SRR27756943_2.fastq
Version Info: This is the most recent version of salmon.
### salmon (selective-alignment-based) v1.10.0

Exception : [
The following errors were detected with the read files

======================================================

ERROR: file [] does not appear to exist!

Any solution?

$\endgroup$

1 Answer 1

0
$\begingroup$

Are you sure the find operations return exactly one file each? The error seems to state that there were no files found for some run. Or it could also be that you have a file that matched your glob pattern that's not a dir, so the find operation fails.

Try this:

salmon_index="human_salmon_index"
fastq_dir=fastq
for dir in ${fastq_dir}/SRR*/
do
r1_file=$(find $dir -name "*_1.fastq")
r2_file=$(find $dir -name "*_2.fastq")
samp=$(basename $dir)
echo "Processing sample ${samp}"
echo salmon quant -i "$salmon_index" -l A -1 "$r1_file" -2 "$r2_file" -p 10 -o "salmon_out/${samp}_quant" | tee salmon_commands.cmd
done

Verify the contents of salmon_commands.cmd then use bash or parallel to run the actual commands.

$\endgroup$
2
  • $\begingroup$ Hi, I tried but getting this error find: ‘fastq//SRR*/’: No such file or directory find: ‘fastq//SRR*/’: No such file or directory Processing sample SRR* salmon quant -i ref_salmon/ -l A -1 -2 -p 10 -o salmon_out/SRR*_quant $\endgroup$
    – S_Malik
    Commented Feb 17 at 9:53
  • $\begingroup$ Try without the quotes. I've made the required changes. $\endgroup$
    – Ram RS
    Commented Feb 19 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.