6419 |
23 Sep 21 |
nicklas |
#!/bin/awk -f |
6419 |
23 Sep 21 |
nicklas |
2 |
|
6419 |
23 Sep 21 |
nicklas |
# Nicklas Nordborg, September 2021 |
6419 |
23 Sep 21 |
nicklas |
# Calculates average read length in FASTQ files |
6419 |
23 Sep 21 |
nicklas |
5 |
# |
6419 |
23 Sep 21 |
nicklas |
BEGIN { |
6419 |
23 Sep 21 |
nicklas |
mean=0; |
6419 |
23 Sep 21 |
nicklas |
n=0; |
6419 |
23 Sep 21 |
nicklas |
9 |
} |
6419 |
23 Sep 21 |
nicklas |
10 |
|
6419 |
23 Sep 21 |
nicklas |
11 |
{ |
6419 |
23 Sep 21 |
nicklas |
if (NR%4==2) { |
6419 |
23 Sep 21 |
nicklas |
n++; |
6419 |
23 Sep 21 |
nicklas |
mean+=length |
6419 |
23 Sep 21 |
nicklas |
15 |
} |
6419 |
23 Sep 21 |
nicklas |
16 |
} |
6419 |
23 Sep 21 |
nicklas |
17 |
|
6419 |
23 Sep 21 |
nicklas |
END { |
6419 |
23 Sep 21 |
nicklas |
mean/=n; |
6419 |
23 Sep 21 |
nicklas |
printf("%ld\t%g\n",n,mean); |
6419 |
23 Sep 21 |
nicklas |
21 |
} |