def tors_chi(universe, seg, i):
    """chi nucleic acid dihedral

     The dihedral is computed based on position atoms for resid `i`.

    Parameters
    ----------
    universe : Universe
         :class:`~MDAnalysis.core.universe.Universe` containing the trajectory
    seg : str
        segment id for base
    i : int
        resid of the first base

    Returns
    -------
    chi : float
        torsion angle in degrees


    .. versionadded:: 0.7.6
    """
    c = universe.select_atoms(" atom {0!s} {1!s} O4' ".format(seg, i),
        " atom {0!s} {1!s} C1' ".format(seg, i), ' atom {0!s} {1!s} N9 '.
        format(seg, i), ' atom {0!s} {1!s} C4  '.format(seg, i))
    if len(c) < 4:
        c = universe.select_atoms(" atom {0!s} {1!s} O4' ".format(seg, i),
            " atom {0!s} {1!s} C1' ".format(seg, i),
            ' atom {0!s} {1!s} N1 '.format(seg, i),
            ' atom {0!s} {1!s} C2  '.format(seg, i))
    chi = c.dihedral.value() % 360
    return chi
