-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbt2_sam_15.sh
54 lines (46 loc) · 2.12 KB
/
bt2_sam_15.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
#!/bin/bash
#SBATCH --job-name=btw_sam_15
#SBATCH --mail-type=END,FAIL
#SBATCH [email protected]
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=8
#SBATCH --mem=32G
#SBATCH --time=24:00:00
#SBATCH --output=/gpfs/scratch/bem6982/bioinformatics/assn_02_ngs/logs/NGS1_%j.log
#SBATCH -p cpu_medium
### Modules
module purge
module load trimgalore/0.5.0 samtools/1.9 bedtools/2.26.0 bowtie2/2.3.4.1 python/cpu/3.7.2 fastqc/0.11.7 igenome/1.0
### bowtie2
bowtie2 -p 16 -x /gpfs/share/apps/iGenomes/Homo_sapiens/UCSC/hg38/Sequence/Bowtie2Index/genome -1 SRR7049615.sra_1_val_1.fq -2 SRR7049615.sra_2_val_2.fq -S SRR7049615.mapping.sam
### SAMTOOLS PROCESSING
samtools view -b -o SRR7049615.mapping.bam SRR7049615.mapping.sam
samtools sort -o SRR7049615.mapping.sorted.bam SRR7049615.mapping.bam
samtools index SRR7049615.mapping.sorted.bam
cp SRR7049615.mapping.sorted.bam ./outputs
cp SRR7049615.mapping.sorted.bam.bai ./outputs
### STRAND SEPERATION
samtools view -b -f 83 SRR7049615.mapping.sorted.bam > fwd1_15.bam
samtools view -b -f 163 SRR7049615.mapping.sorted.bam > fwd2_15.bam
samtools index fwd1_15.bam
samtools index fwd2_15.bam
samtools merge -f fwd_15.bam fwd1_15.bam fwd2_15.bam
samtools index fwd_15.bam
cp fwd_15.bam ./outputs
cp fwd_15.bam.bai ./outputs
samtools view -b -f 99 SRR7049615.mapping.sorted.bam > rev1_15.bam
samtools view -b -f 147 SRR7049615.mapping.sorted.bam > rev2_15.bam
samtools index rev1_15.bam
samtools index rev2_15.bam
samtools merge -f rev_15.bam rev1_15.bam rev2_15.bam
samtools index rev_15.bam
cp rev_15.bam ./outputs
cp rev_15.bam.bai ./outputs
### BEDGRAPH FILES
samtools view -b fwd_15.bam | genomeCoverageBed -ibam stdin -bg -split > ./outputs/SRR7049615-fwd.bedgraph
samtools view -b rev_15.bam | genomeCoverageBed -ibam stdin -bg -split > ./outputs/SRR7049615-rev.bedgraph
samtools view -b SRR7049615.mapping.sorted.bam | genomeCoverageBed -ibam stdin -bg -split > ./outputs/SRR7049615.bedgraph
### BED12 FILES
bamToBed -bed12 -i fwd_15.bam > ./outputs/SRR7049615-fwd.bed
bamToBed -bed12 -i rev_15.bam > ./outputs/SRR7049615-rev.bed
bamToBed -bed12 -i SRR7049615.mapping.sorted.bam > ./outputs/SRR7049615.bed