尝试创建提交脚本到 SGE

Trying to create submit script to SGE

我正在尝试将我的工作 bash 脚本编辑为 SGE 脚本,以便将其作为作业提交到集群。

目前我有:

#!/bin/bash

# Perform fastqc on files in a specified directory.

for ((j=1; j <=17; j++))
do
   directory=/data4/una/batch"$j"/
   files=$""$directory"/*.fastq.gz"
   batch=$"batch_"$j""
   outfile=$""$batch"_submit_script.sh"

     echo "#!/bin/bash">>$outfile;
     echo "# Your job name">>$outfile;
     echo "# -N $batch">>$outfile;
     echo "# The job should be placed into the queue 'all.q'">>$outfile;
     echo "#$ -q all.q">>$outfile;
     echo "# Running in the current working directory">>$outfile;
     echo "#$ -cwd">>$outfile;
     echo "">>$outfile;
     echo "# Export some necessary environment variables">>$outfile;
     echo "#$ -S /bin/bash">>$outfile;
     echo "#$ -v PATH">>$outfile;
     echo "#$ -v LD_LIBRARY_PATH">>$outfile;
     echo "#$ -v PYTHONPATH">>$outfile;
     echo "# Finally, put your command here">>$outfile;
     echo "">>$outfile;
     echo "#$ for i in $files;">>$outfile;
     echo "#$ do;">>$outfile;
     echo "#$ fastqc -f fastq -o /data4/una/test/fastq/$i;">>$outfile;
     echo "#$done">>$outfile;
     echo "">>$outfile;

     qsub $outfile;
done

但是我收到一个错误:

Unable to read script file because of error: ERROR! invalid option argument "-f"

但是

fastqc -f fastq -o /data4/una/test/fastq/$i

是我的 bash 脚本中完全有效的一行。

想法?

谢谢!

实际上是我的循环格式不正确导致了这个错误。我根本不需要以 #$ 开头这些行,所以这些行变成:

echo "for i in $files;">>$outfile; 
echo "do">>$outfile; 
echo " fastqc -f fastq -o /data4/una/test/fastqc $i">>$outfile; 
echo "done">>$outfile; 
echo "">>$outfile; 

qsub $outfile;