def passes_filter_ucsc(segment):
    """Decide whether segment passes filters for UCSC data."""
    # Remove non-coding transcripts
    if not segment.attrs["transcript_id"].startswith("NM"):
        # Manually curated RefSeq transcript identifiers start with NM_ (coding) or NR_ (non-coding)
        # https://genome.ucsc.edu/FAQ/FAQgenes.html
        # Also:
        # https://en.wikipedia.org/wiki/RefSeq
        return False

    if segment.attrs["gene_id"].startswith("LOC"):
        # Remove poorly annotated LOC transcripts
        return False

    return True