WGS和宏基因组混样测序-判断和host基因组的乘深和覆盖度--20200105

WGS和宏基因组混样测序-判断和host基因组的乘深和覆盖度

数据准备

在前期已经做好map到host基因组的步骤以后 (使用了hisat2)得到的 ID.hisat2.bam文件

第一步:sort

因为我们下一步要用的samtools depth的功能需要sorted的bam文件,操作如下:
samtools sort ID.hisat2.bam ID.hisat2.sorted.bam

第二步:判断depth

简单粗暴,操作如下:
samtools depth ID.hisat2.sorted.bam > ID_depth_result

第三步:求average depth

average_depth=$(awk ‘{sum+=$3}END{print sum/NR}’ ID_depth_result);echo ${average_depth}

第四步:求average coverage

name=“ID”;satisfied=$(awk '{if(KaTeX parse error: Expected 'EOF', got '}' at position 20: …erage1){sum+=1}}̲' average1={average_depth} ID_depth_result);all=$(wc -l ID_depth_result|awk ‘{print $1}’);echo ${statisfied};echo ${all}

再用statisfiel/all 就是我们需要的average coverage啦

猜你喜欢

转载自blog.csdn.net/EffeAuuuu/article/details/103983360