def sum_counts(fname, R1=False):
    """Collect the sum of all reads for all samples from a summary count file (e.g. from collect_counts)"""
    count = 0
    with open(fname, 'r') as infh:
        for line in infh:
            l = line.split()
            if R1:
                if l[2] == "R1":
                    count += float(l[3])
            else:
                count += float(l[3])
    return count