def _tumor_normal_stats(rec, somatic_info, vcf_rec):
    """Retrieve depth and frequency of tumor and normal samples.
    """
    out = {"normal": {"alt": None, "depth": None, "freq": None},
           "tumor": {"alt": 0, "depth": 0, "freq": None}}
    if hasattr(vcf_rec, "samples"):
        samples = [(s, {}) for s in vcf_rec.samples]
        for fkey in ["AD", "AO", "RO", "AF", "DP"]:
            try:
                for i, v in enumerate(rec.format(fkey)):
                    samples[i][1][fkey] = v
            except KeyError:
                pass
    # Handle INFO only inputs
    elif len(rec.samples) == 0:
        samples = [(somatic_info.tumor_name, None)]
    else:
        samples = rec.samples.items()
    for name, sample in samples:
        alt, depth, freq = sample_alt_and_depth(rec, sample)
        if depth is not None and freq is not None:
            if name == somatic_info.normal_name:
                key = "normal"
            elif name == somatic_info.tumor_name:
                key = "tumor"
            out[key]["freq"] = freq
            out[key]["depth"] = depth
            out[key]["alt"] = alt
    return out
Retrieve depth and frequency of tumor and normal samples.