def get_tstv(conn, metadata, args):
    ts_cmd = "SELECT count(1) \
           FROM  variants \
           WHERE type = \'snp\' \
           AND   sub_type = \'ts\'"
    tv_cmd = "SELECT count(1) \
          FROM  variants v \
          WHERE type = \'snp\' \
          AND   sub_type = \'tv\'"
    # get the number of transitions
    res = conn.execute(sql.text(ts_cmd))
    ts = res.fetchone()[0]
    # get the number of transversions
    res = conn.execute(sql.text(tv_cmd))
    tv = res.fetchone()[0]
    # report the transitions, transversions, and the ts/tv ratio
    print "ts" + '\t' + \
          "tv" + '\t' + "ts/tv"
    print str(ts) + '\t' + \
        str(tv) + '\t' + \
        str(tstv(ts, tv))
Report the transition / transversion ratio.
dataset/ETHPy150Open arq5x/gemini/gemini/gemini_stats.py/get_tstv