-
Notifications
You must be signed in to change notification settings - Fork 1
/
biscuitblaster_v2_tcga_ucec.sh
executable file
·64 lines (50 loc) · 2.24 KB
/
biscuitblaster_v2_tcga_ucec.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
set -euxo pipefail
#This script is intended to generate a job script that can be submitted to a PBS manager
#To generate the job scripts
#1) Modify any of the paths/function calls/etc below to meet the analysis needs/tool used
#2) bash your_generator.sh
#Submit to the queue
#Note if the number of jobs is large, you will receive an e-mail for start/stop/fail for each job
#3) Example submission loop
#for i in {0..9}; do; qsub pbs.starscript.$i; sleep 1; done
#Build up a space sep'd array of sample/file prefix
declare -a SAMPLE=(TCGA_UCEC_NA1CI TCGA_UCEC_A1CI)
#set a tmpdir for parallel
tmpdir=`pwd`
#Adjust the length of the array to iterate over to match the number of samples/files to analyze
for i in {0..1}; do
cat > pbs.biscuitscript.$i << EOF
#PBS -l walltime=120:00:00
#PBS -l mem=200gb
#PBS -l nodes=1:ppn=40
#PBS -M ben.johnson@vai.org
#PBS -m abe
#PBS -N align
#Change to WGBS directory
cd /secondary/projects/triche/ben_projects/biscuit_manuscript/analysis/biscuit_tcga_ucec
#these are directional libs
#Launch biscuit
biscuit align -R '@RG\tLB:hg38\tID:WGBS_${SAMPLE[i]}\tPL:Illumina\tPU:hiseq2000\tSM:${SAMPLE[i]}' \
-@ 40 -b 1 \
/secondary/projects/triche/ben_projects/references/human/hg38/indexes/biscuit_gencode/hg38_PA \
${SAMPLE[i]}.pe1.fq.gz ${SAMPLE[i]}.pe2.fq.gz | \
samblaster --addMateTags | parallel --tmpdir ${tmpdir} --pipe --tee {} ::: 'samblaster -a -e -u ${SAMPLE[i]}.clipped.fastq -d ${SAMPLE[i]}.disc.hg38.sam -s ${SAMPLE[i]}.split.hg38.sam -o /dev/null' \
'samtools view -hb | samtools sort -@ 8 -m 5G -o ${SAMPLE[i]}.sorted.markdup.withdisc_split_clip.hg38.bam -O BAM -'
#you can collect the split and discordant bams out of smoove too
#sort and convert to bams
samtools sort -o ${SAMPLE[i]}.disc.hg38.bam -O BAM ${SAMPLE[i]}.disc.hg38.sam
#index
samtools index ${SAMPLE[i]}.disc.hg38.bam
#sort and convert to bams
samtools sort -o ${SAMPLE[i]}.split.hg38.bam -O BAM ${SAMPLE[i]}.split.hg38.sam
#index
samtools index ${SAMPLE[i]}.split.hg38.bam
#compress
pigz -p 40 ${SAMPLE[i]}.clipped.fastq
#index the full bam
samtools index ${SAMPLE[i]}.sorted.markdup.withdisc_split_clip.hg38.bam
#clean up the sams...
if [[ -f ${SAMPLE[i]}.disc.hg38.bam ]] && [[ -f ${SAMPLE[i]}.split.hg38.bam ]]; then rm ${SAMPLE[i]}*.sam; fi
EOF
done