The following is a Python script that can be used as template to run BDiversitree1_v3.r: #-*- coding: utf-8 -*- import glob,os FILE_TIPE="tree*" BASH_SCRIPT_NAME="executeAll.sh" bash_file=open(BASH_SCRIPT_NAME,"w") bash_output="" for TREE_FILE in glob.iglob(os.path.join(FILE_TIPE)): TREE_FILE=str(TREE_FILE) PBS_SCRIPT_NAME="script_"+TREE_FILE+".pbs" pbs_file=open(PBS_SCRIPT_NAME,"w") pbs_output="#!/bin/sh\n# SGI\n#PBS -V\n#PBS -N BURIN_"+TREE_FILE+"\n#PBS -e BURIN_"+TREE_FILE+".err\n#PBS -o BURIN_"+TREE_FILE+".out\n#PBS -q low_mem \n#PBS -l place=scatter\n#PBS -l select=1:ncpus=1:host=n008\n##PBS -l walltime=100:00:00\n# shm, sock, ssm, rdma, rdssm\nFABRIC=rdma\nCORES=$[ `cat $PBS_NODEFIL E | wc -l` ]\nNODES=$[ `uniq $PBS_NODEFILE | wc -l` ]\ncd $PBS_O_WORKDIR \n \nprintf \"Current time is: `date`\\n\";\nprintf \"Current PBS work directory is: $PBS_O_WORKDIR\\n\";\nprintf \"Current PBS queue is: $PBS_O_QUEUE\\n\"; \nprintf \"Current PBS job ID is: $PBS_JOBID\\n\";\nprintf \"Current PBS job name is: $PBS_JOBNAME\\n\";\nprintf \"PBS stdout log is: $PBS_O_WORKDIR/sgi_mpitest.err\\n\";\nprintf \"PBS stderr log is: $PBS_O_WORKDIR/sgi_mpitest.log\\n\";\nprintf \"Fabric interconnect selected is: $FABRIC\\n\";\nprintf \"This jobs will run on $CORES processors.\\n\";\n. /etc/profile.d/modules.sh\nmodule load mpt && echo \"Successfully lodaded mpt module\"\nTBEGIN=`echo \"print time();\" | perl`\nprintf \"MPI run command location is: `which mpirun`\\n\";\nprintf \"################################################\\n\";\nMPI_HOSTS=$(sort $PBS_NODEFILE | uniq -c | awk '{print $2 \" \" $1}' | tr \"\\n\" \",\" | sed 's/.$//')\n/apps/Rscr ipt BDiversitree1_v3.r "+TREE_FILE+" diet_birds.txt musse --t 1 --i 2000000 --s 1000 > STD_"+TREE_FILE+".err\nTEND=`echo \"print time();\" | perl`\nprintf \"#################################################\\n\";\nprintf \"+++ Job finished: `date`\\n\";\nprintf \"+++ Job walltime: `expr $TEND - $TBEGIN`\\n\";\nprintf \"#################################################\\n\";" bash_output+="qsub "+PBS_SCRIPT_NAME+"\n" pbs_file.write(pbs_output) pbs_file.close() bash_file.write(bash_output) bash_file.close() exit()