Skip to content

Instantly share code, notes, and snippets.

@brwnj
Last active December 20, 2015 19:49
Show Gist options
  • Save brwnj/6186232 to your computer and use it in GitHub Desktop.
Save brwnj/6186232 to your computer and use it in GitHub Desktop.
lsf examples

#Job Array

#!/usr/bin/env bash
#BSUB -J align[1-63]
#BSUB -e align.%J.%I.err
#BSUB -o align.%J.%I.out
#BSUB -q normal
#BSUB -R "select[mem>16] rusage[mem=16] span[hosts=1]"
#BSUB -n 12
#BSUB -P pillai_kabos_polya

<<DOC
directives, respectively:
jobname with job array size
stderr with unique name incorporating job id and index id
stdout ''
queue
resource reservations; span is important when using more than one cpu
cpus
for tracking usage

Trim the UMI from the FASTQ, align trimmed reads using Novoalign suppressing 
all reads that align more than once, then remove UMI duplicates from the
alignment.
DOC

# catch unset variables, non-zero exits in pipes and calls, enable x-trace.
set -o nounset -o pipefail -o errexit -x

source $HOME/projects/polya/bin/config.sh

SAMPLES=(MP51 MP52 MP53 MP54 MP55 MP56 MP57 MP58 MP59 MP60              #10
        MP61 MP62 MP63 PK61 PK62 PK63 PK64 PK65 PK66 PK67               #20
        PK68 PK69 PK70 PK71 PK72 PK73 PK74 PK75 PK76 PK77               #30
        PK78 PK79 PK80 PK81 PK82 PK83 PK84 PK85 PK86 PK87               #40
        PK88 PK89 PK90 PK91 PK92 MP70 MP71 MP72 MP73 MP74               #50
        MP75 PK93 PK94 PK95 PK96 PK97 PK98 PK99 PK100 PK101             #60
        PK102 PK103 PK104)

# LSB_JOBINDEX is job array position
sample=${SAMPLES[$(($LSB_JOBINDEX - 1))]}

unprocessed_fastq=$DATA/$sample.fq.gz
fastq=$DATA/$sample.umi.fq.gz

save script to job_array.sh; then

bsub < ~/job_array.sh

#Single job

#!/usr/bin/env bash
#BSUB -J jobname
#BSUB -e jobname.%J.err
#BSUB -o jobname.%J.out
#BSUB -q normal
#BSUB -R "select[mem>4] rusage[mem=4] span[hosts=1]"
#BSUB -n 1
#BSUB -P the_investigator

<<DOC

DOC

set -o nounset -o pipefail -o errexit -x

save to single_job.sh, then

bsub < ~/single_job.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment