-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunDemux10xATAC.pbs
executable file
·70 lines (58 loc) · 2.84 KB
/
runDemux10xATAC.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
#!/bin/bash
#PBS -q condo
#PBS -N django_10xDemuxATAC
#PBS -l nodes=1:ppn=16
#PBS -l walltime=8:00:00
#PBS -V
#PBS -m abe
#PBS -A epigen-group
# -v pass parameters: flowcell_id, run_dir
############################################################
## update status to job submitted @VM
############################################################
cmd="source activate django;python \$(which updateRunStatus.py) -s '1' -f $flowcell_id"
ssh zhc268@epigenomics.sdsc.edu $cmd
############################################################
## run bcl2fastq @TSCC
############################################################
## delete last demux info
[[ -d ${run_dir}/${flowcell_id} ]] && rm -r ${run_dir}/${flowcell_id} # delete existing folder
[[ -f ${run_dir}/__${flowcell_id}.mro ]] && rm ${run_dir}/__${flowcell_id}.mro # delete existing folder
## prepare variables & directories
out_dir_sys=${run_dir}/${flowcell_id}/outs/fastq_path/
out_dir=${run_dir}/Data/Fastqs/
mkdir -p ${out_dir}
## prepair reads_cnt_file
reads_cnt_file="${out_dir}/reads_cnt.tsv"
>$reads_cnt_file
## samplesheet
samplesheet="${out_dir}/SampleSheet_I1.csv"
libs=$(awk -v FS=',' '(NR>1){print $2}' $samplesheet)
## run mkfastq
cd $run_dir
export PATH=/projects/ps-epigen/software/cellranger-atac-1.2.0/:$PATH
[[ -f ${out_dir}/extraPars.txt ]] && extraParsVal=$(cat ${out_dir}/extraPars.txt)
echo -e "cellranger-atac mkfastq --run=$run_dir --localcores=16 --csv $samplesheet --qc $extraParsVal #--use-bases-mask Y50,I8n*,Y16,Y50"
cellranger-atac mkfastq --run=$run_dir --localcores=16 --csv $samplesheet --qc $extraParsVal #--use-bases-mask Y50,I8n*,Y16,Y50
## transfer/link data
ln -sf ${out_dir_sys}/Stats $out_dir
ln -sf ${out_dir_sys}/Stats $out_dir
for i in $libs
do
#cp -r ${out_dir_sys}/$flowcell_id/${i} /projects/ps-epigen/seqdata/
ln -sf ${out_dir_sys}/${flowcell_id}/${i} /projects/ps-epigen/seqdata/
cat /projects/ps-epigen/seqdata/${i}/${i}*R3*fastq.gz > /projects/ps-epigen/seqdata/${i}_R2.fastq.gz & sleep 1
cat /projects/ps-epigen/seqdata/${i}/${i}*R1*fastq.gz > /projects/ps-epigen/seqdata/${i}_R1.fastq.gz & sleep 1
wait
nreads=$(zcat /projects/ps-epigen/seqdata/${i}_R1.fastq.gz | wc -l ) && echo -e "$i\t$[nreads/4]" >> $reads_cnt_file & sleep 1
done
wait
############################################################
# update status to finish or warning @ VM
############################################################
cmd="source activate django; python \$(which updateReadsNumberPerRun.py) -f $flowcell_id -i $reads_cnt_file; python \$(which updateRunReads.py) -f $flowcell_id"
job1=$(ssh zhc268@epigenomics.sdsc.edu $cmd)
############################################################
# run 10x pipeline
############################################################
#qsub -t 0-1 -v samples=${HOME}/runlogs/run_2019-01-22_10xatac_modifiedPeakPar.txt $(which run10xPipeline.pbs)