Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
wresch committed Jul 7, 2015
2 parents 3de6ebc + b1a0663 commit e43463b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 33 deletions.
2 changes: 1 addition & 1 deletion pbs2slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def fix_env_vars(input):
repl = {
"PBS_O_WORKDIR": "SLURM_SUBMIT_DIR",
"PBS_JOBID" : "SLURM_JOBID",
"PBS_ARRAYID" : "SLURM_ARRAY_TASK_ID"}
"PBS_ARRAY_INDEX" : "SLURM_ARRAY_TASK_ID"}
output = input
for pbs, slurm in repl.items():
output = output.replace(pbs, slurm)
Expand Down
46 changes: 14 additions & 32 deletions pbs2slurm_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,19 @@ def test_pbs_jobid():


def test_pbs_arrayid():
desc = "Change <tt>PBS_ARRAYID</tt> to <tt>SLURM_ARRAY_TASK_ID</tt>"
desc = "Change <tt>PBS_ARRAY_INDEX</tt> to <tt>SLURM_ARRAY_TASK_ID</tt>"
input = """#! /bin/bash
set -e
set -o pipefail
module load fastqc
cd /data/$USER/test_data
module load bowtie/1.1.1 samtools/1.2
gunzip -c sample${PBS_ARRAYID}.fastq.gz \\
gunzip -c sample${PBS_ARRAY_INDEX}.fastq.gz \\
| bowtie --sam --best --strata --all -m1 -n2 \\
--threads=10 /path/to/genome/index - \\
| samtools view -Sb -F4 - \\
> sample${PBS_ARRAYID}.bam
> sample${PBS_ARRAY_INDEX}.bam
"""
expected = """#! /bin/bash
set -e
Expand Down Expand Up @@ -395,7 +395,7 @@ def test_email_modes_abe():
check(input, expected, p2s.convert_batch_script(input), desc)

def test_email_modes_aben():
desc = "If <tt>#PBS -m<tt> contains n in addition to other options, n has precedence since it's our Slurm default"
desc = "If <tt>#PBS -m</tt> contains n in addition to other options, n has precedence since it's Slurm's default"
input = """#! /bin/bash
#PBS -m aben
Expand Down Expand Up @@ -893,14 +893,14 @@ def test_script2():
cd ${PBS_O_WORKDIR}
# non redundant
slopBed -i H3K27me3.bed -g mm9.genome -r 126 -s -l 0 \\
| intersectBed -a stdin -b refseq_tss.bed -wa -wb \\
slopBed -i K27me3.bed -g mm9.genome -r 126 -s -l 0 \\
| intersectBed -a stdin -b refseqTss.bed -wa -wb\\
| awk '$2 != c {print; c = $2}' \\
| cut -f10 \\
| sort -S1G \\
| uniq -c \\
| sed -r 's/^ +//;s/ /|/' \\
> count_data/H3K27me3.nr.ncount
> count_data/K27me3.nr.ncount
"""
expected = """#! /bin/bash
#SBATCH --job-name="H3K27me3"
Expand All @@ -909,14 +909,14 @@ def test_script2():
cd ${SLURM_SUBMIT_DIR}
# non redundant
slopBed -i H3K27me3.bed -g mm9.genome -r 126 -s -l 0 \\
| intersectBed -a stdin -b refseq_tss.bed -wa -wb \\
slopBed -i K27me3.bed -g mm9.genome -r 126 -s -l 0 \\
| intersectBed -a stdin -b refseqTss.bed -wa -wb\\
| awk '$2 != c {print; c = $2}' \\
| cut -f10 \\
| sort -S1G \\
| uniq -c \\
| sed -r 's/^ +//;s/ /|/' \\
> count_data/H3K27me3.nr.ncount
> count_data/K27me3.nr.ncount
"""
check(input, expected, p2s.convert_batch_script(input), desc)

Expand All @@ -929,21 +929,12 @@ def test_script3():
# Request 4 hours of walltime
#PBS -l walltime=4:00:00
#PBS -l pmem=1gb
# Request that regular output and terminal output go
# Request that stdout and stderr go
# to the same file
#PBS -j oe
#
# The following is the body of the script. By default,
# PBS scripts execute in your home directory, not the
# directory from which they were submitted. The
# following line places you in the directory from
# which the job was submitted.
#
# ======== BODY ========
cd $PBS_O_WORKDIR
#
# Now we want to run the program "hello" from
# $PBS_O_WORKDIR.
#
echo "Job started on `hostname` at `date`"
./hello
echo "Job Ended at `date`"
Expand All @@ -956,21 +947,12 @@ def test_script3():
# Request 4 hours of walltime
#SBATCH --time=4:00:00
# Request that regular output and terminal output go
# Request that stdout and stderr go
# to the same file
#
# The following is the body of the script. By default,
# PBS scripts execute in your home directory, not the
# directory from which they were submitted. The
# following line places you in the directory from
# which the job was submitted.
#
# ======== BODY ========
cd $SLURM_SUBMIT_DIR
#
# Now we want to run the program "hello" from
# $SLURM_SUBMIT_DIR.
#
echo "Job started on `hostname` at `date`"
./hello
echo "Job Ended at `date`"
Expand Down

0 comments on commit e43463b

Please sign in to comment.