Hi I'm using SUN Grid Engine to submit jobs, written by shell script like this:
#!/bin/bash
#$ -pe single 24
#$ -V
#$ -cwd
#$ -o $HOME/sge_jobs_output/sge_job.$JOB_ID.out -j y
#$ -S /bin/bash
#$ -l mem_free=8G
cd $HOME/scratch/bwa2/
job_number=$SGE_TASK_ID
SAM_NAME_1=`head -"$job_number" master_list_1|tail -1`
/share/bin/bwa aln hg19_index "$SAM_NAME_1".recal.fastq.gz > "$SAM_NAME_1".sai
#Do sth. here to save the output as text file. Here by output I don't mean
# .sai file, but the error report like "10000000 sequences have been processed",
#And text file name is SAM_NAME_1, which is a variable
Maybe I didn't make quite clear. As shown as the end of the script, I want to put some command so that the error report can be saved as .txt file. How can I do that? (I know we can use > .txt at prompt; but here the .txt file name is a variable, so I must put command within script)
WHat I want is similar to $HOME/sgejobsoutput/sgejob.$JOBID.out -j y; but I want name as SAMNAME instead of JOBID. Thanks!
SO actually this turned out as a bioinformatic problem. :)
Edit:
I tried: #$ -e $HOME/sge_jobs_output/sge_job.$SAM_NAME_1.txt
But it still doesn't work..$SAMNAME1 part doesn't act as variable..
Is there any other way, which does NOT rely on this SGE flag? thx
I think this isn't really bioinformatics related. but you likely want to use ${SAM_NAME_1}.recal.fastq.gz and ${SAM_NAME_1}.sai
Yeah, I know it's NOT bioinformatics-related; I post on stack overflow, but got no reply. So how should I do to save output as text file here? thanks.
Here's a fishing rod: the Advanced Bash-Scripting Guide http://www.tldp.org/LDP/abs/html/ . See Chapter 4. Introduction to Variables and Parameters.