Alignment: Practical session
#!/bin/bash #move and create directory cd ~/mda12 mkdir -p mapping # index reference time bwa index resources/ref/human_g1k_v37.chr20.fasta time samtools faidx resources/ref/human_g1k_v37.chr20.fasta # align pair 1 time bwa aln -t 1 -l 40 -k 2 resources/ref/human_g1k_v37.chr20.fasta\ resources/data/test_1.fq >\ mapping/test_1.sai # align pair 2 time bwa aln -t 1 -l 40 -k 2 resources/ref/human_g1k_v37.chr20.fasta\ resources/data/test_2.fq >\ mapping/test_2.sai # merge Paired-End in SAM time bwa sampe -n 1\ resources/ref/human_g1k_v37.chr20.fasta mapping/test_1.sai mapping/test_2.sai\ resources/data/test_1.fq resources/data/test_2.fq >\ mapping/test.sam # SAM to BAM conversion time samtools view -bS mapping/test.sam -o mapping/test.bam # basic stats all reads time samtools flagstat mapping/test.bam | tee mapping/flagstat_all.txt # sort and index BAM time samtools sort mapping/test.bam mapping/test_sorted time samtools index mapping/test_sorted.bam # filter alignment time samtools view -S -h -F 4 -q 10 mapping/test.sam | grep -v "XA:Z:" > mapping/test_mapped.sam # SAM to BAM conversion time samtools view -bS mapping/test_mapped.sam -o mapping/test_mapped.bam # basic stats mapped reads time samtools flagstat mapping/test_mapped.bam | tee mapping/flagstat_mapped.txt # sort and index BAM time samtools sort mapping/test_mapped.bam mapping/test_mapped_sorted time samtools index mapping/test_mapped_sorted.bam # bamQC /home/biouser.23-10-2012/mda12/qualimap/qualimap # IGV igv