Having issues with formatting a script for job submission on LSF

  Kiến thức lập trình

Please help me as I am relatively new to using the bash shell. I have a simple script that I want to submit as a job on the LSF my institution’s computing cluster uses using the bsub command like this:

bsub -R rusage[mem=8G] -R span[hosts=1] -n 1 -q short -W 2:00 -o log.N1.kallisto_calc.out -e log.N1.kallisto_calc.err -J kallisto_calc_test kallisto_stats=$(zcat N1_pear_merged.fastq.gz | awk 'BEGIN {t=0.0; sq=0.0; n=0;}; NR%4==2 {n++; L=length($0); t+=L; sq+=L*L;} END {m=t/n; printf("total %d avg_length %f std_dev %fn",n,m,sqrt(sq/n-m*m));}') && echo -e N10't'$kallisto_stats >> kallisto_stats2.txt

However, when I do this, the script does not run. When I check the status using bjobs, it says “RUN” under the status but it doesn’t finish and doesn’t even make log files.

When I run it in this format it runs with no problems:

#BSUB -R rusage[mem=8G]
#BSUB -R span[hosts=1]
#BSUB -n 1
#BSUB -q short
#BSUB -W 2:00
#BSUB -o log.N1.kallisto_calc.out
#BSUB -e log.N1.kallisto_calc.err
#BSUB -J kallisto_calc_test

kallisto_stats=$(zcat N1_pear_merged.fastq.gz | awk 'BEGIN {t=0.0; sq=0.0; n=0;}; NR%4==2 {n++; L=length($0); t+=L; sq+=L*L;} END {m=t/n; printf("total %d avg_length %f std_dev %fn",n,m,sqrt(sq/n-m*m));}') && echo -e N10't'$kallisto_stats >> kallisto_stats2.txt

This has never happened to me before, can anyone tell me what is going wrong here? If it helps, the cluster runs Linux Red Hat 8.

I tried putting the command in quotes and it did not help. The script should read the “N1_pear_merged.fastq.gz ” file and make a new file called “kallisto_stats.txt” with a line of text like this:

total 100 avg_length 223.410000 std_dev 47.398121

New contributor

appletree7 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT