def select_per_gene_stats(cxn, iteration):
    """Get data for the per gene summary report."""
    return cxn.execute(
        """SELECT ref_name, taxon_name,
                LENGTH(ref_seq)      AS query_len,
                SUM(LENGTH(seq)) / 3 AS target_len
             FROM stitched
             JOIN reference_genes USING (ref_name)
            WHERE contig_name IS NOT NULL
              AND iteration = ?
         GROUP BY ref_name, taxon_name;
        """,
        (iteration,))