-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_htseq_icgc_exon.sh
executable file
·37 lines (30 loc) · 1.18 KB
/
run_htseq_icgc_exon.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
set -e
anno=PATH_TO_ANNOTATION/gencode.v19.annotation.hs37d5_chr.gtf
outdir=OUTDIR
mkdir -p $outdir
mem=40gb
if [ ! -z "$1" ]
then
file=$1
filebase=$(basename $file)
donefile="${outdir}/${filebase%bam}count.done"
logfile="${outdir}/${filebase%bam}count.log"
outfile="${outdir}/${filebase%bam}count.txt"
if [ -f ${file%bam}done -a ! -f $donefile ]
then
cd $(pwd); umask 077; samtools view -F 4 $file | htseq-count -m intersection-nonempty --stranded=no --idattr exon_id -r pos - $anno > $outfile && touch $donefile
fi
else
for file in $(ls -1 $(pwd)/alignments_ICGC_2015-04-19/*.bam)
do
filebase=$(basename $file)
donefile="${outdir}/${filebase%bam}count.done"
logfile="${outdir}/${filebase%bam}count.log"
outfile="${outdir}/${filebase%bam}count.txt"
if [ -f ${file%bam}done -a ! -f $donefile ]
then
echo "umask 077; samtools view -F 4 $file | htseq-count -m intersection-nonempty --stranded=no --idattr exon_id -r pos - $anno > $outfile && touch $donefile" | qsub -l nodes=1:ppn=1,mem=$mem,vmem=$mem,pmem=$mem,walltime=24:00:00 -N icgc_htseq -j oe -o $logfile
fi
done
fi