--- /dev/null
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+
+my $align_file = shift;
+my $all_gz_file = shift;
+
+if(!defined($all_gz_file)) { print STDERR "Usage: count_reads.pm [align file] [all file.gz]\n"; exit(1); }
+
+my $pf_count = 0;
+my $adapter_count = 0;
+my $align_count = 0;
+
+open(ALIGN,$align_file);
+while(<ALIGN>) {
+ chomp;
+ my(@a) = split(/ /,$_);
+ $pf_count++;
+
+ if(scalar(@a) > 3) {
+ if($_ =~ /contam/) { $adapter_count++; } else { $align_count++; }
+ }
+}
+close(ALIGN);
+
+my $all_count = `cat $all_gz_file | gzip -d | wc -l`;
+chomp $all_count; $all_count =~ s/\s//;
+
+print "#N_reads N_pf N_adapter N_align\n";
+print "$all_count\t$pf_count\t$adapter_count\t$align_count\n";