2016-Mouse-MHB

From ZhangLabWiki
Jump to navigation Jump to search
  1. bam merge
samtools merge -o output.bam $1 $2 $3
# bam split by CHR
for i in {1..19} X Y M
do
samtools view -b -q 20 Mouse.MHB.Alice.MergeBam.sort.bam chr$i > Mouse.MHB.Alice.chr$i.bam &
done
# bam to coverage
for i in `ls *bam`
do
bedtools genomecov -ibam $i -bg > merge.$i.bedcov
done
# Obtain D>=30 and Len>80 regions
for i in {1..19} X Y M
do
cd /home/shg047/oasis/mouse/RD
awk '$4>80{ print $1"\t"$2"\t"$3}' merge.chr$i.bam.gencov.bed | bedtools merge -d 80 -i - > merge.chr$i.bamRD90.bed
awk '$3-$2>90 {print $1"\t"$2"\t"$3"\t"$3-$2+1}' merge.chr$i.bamRD90.bed > merge.chr$i.bam.RD90_80up.bed
done