||
#! /bin/bash #purpose: statistic analysis of mapping reads #sev env bam_dir="" cd $bam_dir #bam文件所在位置 ls *.sorted.dedup.bam > bam.list #samtools flagstat for i in $(cat bam.list) do printf $i >> bam.mappedreads samtools flagstat $i | sed -n '5p' >> bam.mappedreads done #samtools idxstats for i in $(cat bam.list) do export total_reads=$(samtools idxstats $bam_dir/$i |awk -F '\t' '{s+=$3}END{print s}') echo $i number_of_reads $total_reads done
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-28 00:10
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社