测序reads数两个例子
#singel end
folder_path="/path_to/donor2"
output_file="/path_to/donor2_nanopore_coverage_2.txt"
# 遍历文件夹中的所有fastq文件
for fastq_file in ${folder_path}/*.fastq; do
# 使用SAMtools命令计算reads数量
read_count=$(expr $(cat ${fastq_file} | wc -l) / 4)
# 打印每个文件的reads数量
echo "${fastq_file}: ${read_count} reads" >>$output_file
done
#pair end
folder_path="/path_to/short_reads/donor1"
output_file="/path_to/short_reads/donor1_short_reads_coverage.txt"
for i in 1 2 3 4 5 6 7 8
do
read_count1=$(zcat "${folder_path}/s${i}_R1_val_1.fq.gz" | grep -c '^+$')
read_count2=$(zcat "${folder_path}/s${i}_R2_val_2.fq.gz" | grep -c '^+$')
read_count=$(expr($read_count1+$read_count2))
echo "s${i}: ${read_count} reads" >>$output_file
done