-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathliRNAseq_pipeline_2_general.sh
58 lines (43 loc) · 2.02 KB
/
liRNAseq_pipeline_2_general.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
#!/bin/bash
# Run where the fastq.bz2 files are
# usage: /groups/cbdm_lab/dp133/scripts/liRNAseq_pipeline_2.sh [dir_where_fastq.bz2_files_are] [prefix]
module load seq/fastx/0.0.13
module load seq/tophat/2.0.10
module load seq/bowtie/2.1.0
module load seq/samtools/0.1.19
#module load seq/htseq/0.6.1
module load seq/BEDtools/2.23.0
module load stats/R/3.2.1
echo "Working directory : " $1
cd $1 # working directory where the fastq.bz2 files are
prefix=$2
echo "Merging L1 and L2 for R1..."
cat *L00*_R1.fastq.bz2 > R1.fastq.bz2
echo "Merging L1 and L2 for R2..."
cat *L00*_R2.fastq.bz2 > R2.fastq.bz2
echo "Bunzipping R1..."
#gzip -dfv R1.fastq.gz
bunzip2 -kv R1.fastq.bz2
echo "Bunzip R2..."
#gzip -dfv R2.fastq.gz
bunzip2 -kv R2.fastq.bz2
echo "Trimming barcode R2:5-12, UMI R2:1-4 and R1:1-30..."
mkdir lecseq
cd lecseq
fastx_trimmer -Q 33 -f 5 -l 12 -i ../*R2.fastq -o bc.fastq
fastx_trimmer -Q 33 -f 1 -l 4 -i ../*R2.fastq -o umi.fastq
fastx_trimmer -Q 33 -f 1 -l 30 -i ../*R1.fastq -o R1.fastq
echo "Merging bc, umi and R1 into one file..."
/groups/immdiv-bioinfo/evergrande/copy_work/yael/liRNAseq_newdpzpipeline/merge_fastq.pl bc.fastq umi.fastq bcumi.fastq
/groups/immdiv-bioinfo/evergrande/copy_work/yael/liRNAseq_newdpzpipeline/merge_fastq.pl bcumi.fastq R1.fastq bcumiR1.fastq
#rm bc.fastq umi.fastq R1.fastq R2.fastq bcumi.fastq
echo "Filtering..."
fastq_quality_filter -v -Q 33 -q 20 -p 80 -i bcumiR1.fastq -o bcumiR1.filtered.fastq
#rm bcumiR1.fastq
echo " Moving barcode to header: make sure UMI is on 5th position in the ID..."
/groups/immdiv-bioinfo/evergrande/copy_work/yael/liRNAseq_newdpzpipeline/add_umi_to_id.pl S bcumiR1.filtered.fastq bcumiR1.filtered.bcumitoid.fq 1 8 9 4
echo "Trimming out bc and umi files..."
fastx_trimmer -Q 33 -f 13 -i bcumiR1.filtered.bcumitoid.fq -o $prefix.fq
# Comments: MapAndCountUMIs_human.sh (human) or MapAndCountUMIs_mouse.sh (mouse) *****Variable[1]
echo "Map and correct for UMIs..."
/groups/immdiv-bioinfo/evergrande/copy_work/yael/liRNAseq_newdpzpipeline/*****Variable[1] $prefix.fq $prefix