Retrieve total reads in a fastq file from grabix index.

def total_reads_from_grabix(in_file):
    """Retrieve total reads in a fastq file from grabix index.
    """
    gbi_file = _get_grabix_index(in_file)
    if gbi_file:
        with open(gbi_file) as in_handle:
            next(in_handle)  # throw away
            num_lines = int(next(in_handle).strip())
        assert num_lines % 4 == 0, "Expected lines to be multiple of 4"
        return num_lines // 4
    else:
        return 0