-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun10xPipeline.pbs
executable file
·75 lines (58 loc) · 2.5 KB
/
run10xPipeline.pbs
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
65
66
67
68
69
70
71
72
#!/bin/bash
#PBS -q home-epigen
#PBS -N django_10xPipeline
#PBS -l nodes=1:ppn=16
#PBS -l walltime=24:00:00
#PBS -l mem=96gb
#PBS -o /home/zhc268/logs/run_10xMkpipeline.out
#PBS -e /home/zhc268/logs/run_10xMkpipeline.err
#PBS -V
#PBS -m abe
#PBS -A epigen-group
# -v pass parameters: samples
export PATH=/projects/ps-epigen/software/cellranger-atac-1.2.0/:$PATH
WORKDIR="/oasis/tscc/scratch/$(whoami)/outputs_TA/"
FASTQDIR="/projects/ps-epigen/seqdata/"
# select libs
samplenames=(`cat $samples`)
INPREFIX=${samplenames[${PBS_ARRAYID}*3]} #index start from 0
SAMPLE=${samplenames[${PBS_ARRAYID}*3+1]}
GENOME=${samplenames[${PBS_ARRAYID}*3+2]}
cd $WORKDIR
# determine genomes
case $GENOME in
mm10)
genome_dir="/projects/ps-epigen/GENOME/mm10/refdata-cellranger-atac-mm10-1.2.0";;
hg38)
genome_dir="/projects/ps-epigen/GENOME/hg38/refdata-cellranger-atac-GRCh38-1.2.0";;
hg19)
genome_dir="/projects/ps-epigen/GENOME/hg38/refdata-cellranger-atac-hg19-1.2.0";;
*)
echo "wrong genome input: $GENOME"
exit 0;;
esac
# prepaire fastqs
fastqs=$(echo $SAMPLE| awk -v FS=',' -v d="${FASTQDIR}" '{ for(i=1;i<=NF-1;i++) {printf "%s,", d$i};print d$NF;}')
#fastqs="${FASTQDIR}/${INPREFIX}"
#echo $fastqs
# [[ ! -d $fastqs ]] && { echo "$fastqs not found"; exit 0; }
# runPipeline
mkdir -p /projects/ps-epigen/outputs/10xATAC/$INPREFIX
[[ -f /projects/ps-epigen/outputs/10xATAC/${INPREFIX}/.inqueue ]] && rm /projects/ps-epigen/outputs/10xATAC/${INPREFIX}/.inqueue
[[ -f /projects/ps-epigen/outputs/10xATAC/${INPREFIX}/.inprocess ]] && rm /projects/ps-epigen/outputs/10xATAC/${INPREFIX}/.inprocess
cmd="source activate django; python \$(which updateSingleCellStatus.py) -seqid $INPREFIX -status InProcess;"
job1=$(ssh zhc268@epigenomics.sdsc.edu $cmd)
cellranger-atac count --id=$INPREFIX --fastqs=$fastqs --sample $SAMPLE --reference=$genome_dir --localcores=16 --mempercore=5
wait
# transfer results
rsync -azru ${WORKDIR}${INPREFIX} /projects/ps-epigen/outputs/10xATAC/
wait
mkdir -p /projects/ps-epigen/outputs/10xATAC/${INPREFIX}/outs/fastqs
for l in $(echo $fastqs|sed 's/,/ /g');do
echo "ln -s $l /projects/ps-epigen/outputs/10xATAC/${INPREFIX}/outs/fastqs/"
done|bash
## addtional check
#[[ -z $(find ${OUTDIR}/qc/rep1 -name "*_qc.txt") ]] && { echo "pipeline interrupted"; exit 0; }
# update status to finish or warning @ VM
cmd="source activate django; python \$(which updateSingleCellStatus.py) -seqid $INPREFIX -tenx_status Yes;"
job1=$(ssh zhc268@epigenomics.sdsc.edu $cmd)