"""
Tests for methods which return collections of transcript IDs that aren't
converting from some type of name or ID.
"""
from __future__ import absolute_import

from pyensembl import genome_for_reference_name
from nose.tools import eq_

from .common import test_ensembl_releases

grch38 = genome_for_reference_name("GRCh38")

# subset of transcript IDs for HLA-A
HLA_A_TRANSCRIPT_IDS = [
    'ENST00000396634',
    'ENST00000376809',
    'ENST00000376806',
    'ENST00000376802',
    'ENST00000496081',
    'ENST00000495183',
    'ENST00000461903',
    'ENST00000479320',
]

def test_transcript_ids_ensembl_grch38_hla_a():
    # chr6:29,945,884  is a position for HLA-A
    # based on:
    # http://useast.ensembl.org/Homo_sapiens/Gene/
    # Summary?db=core;g=ENSG00000206503;r=6:29941260-29945884
    transcript_ids = grch38.transcript_ids_at_locus(
        6, 29941260, 29945884)
    for transcript_id in HLA_A_TRANSCRIPT_IDS:
        assert transcript_id in transcript_ids, \
            "Transcript %s of HLA-A not found overlapping locus" % transcript_id

KNOWN_TRANSCRIPT_IDS = HLA_A_TRANSCRIPT_IDS + [
    'ENST00000398417',  # transcript ID of SMAD4-001
    'ENST00000334701',  # transcript ID of HSP90AA1-001
    'ENST00000599837',  # transcript ID of CTAG1A-002
]

# TODO: add release 54 after transcript IDs for older GTFs are filled in
# See https://github.com/hammerlab/pyensembl/issues/20
@test_ensembl_releases(75, grch38.release)
def test_all_transcript_ids(ensembl):
    transcript_ids = set(ensembl.transcript_ids())
    for transcript_id in KNOWN_TRANSCRIPT_IDS:
        assert transcript_id in transcript_ids, \
            "Missing transcript ID %s from %s" % (transcript_id, ensembl)

def test_transcript_id_of_protein_id_CCR2():
    # looked up CCR2-201 transcript ID ENST00000292301 mapping to protein ID
    # ENSP00000292301 on Sept. 14th 2016 from GRCh38 Ensembl release 85
    transcript_id = grch38.transcript_id_of_protein_id(
        "ENSP00000292301")
    eq_("ENST00000292301", transcript_id)

@@ -1753,17 +1753,17 @@
 :%0A    # 
-l
+L
 ooked up
@@ -1767,121 +1767,87 @@
  up 
-CCR2-201 transcript ID ENST00000292301 mapping to protein ID%0A    # ENSP00000292301 on Sept. 14th 2016 from GRCh38
+on Oct 9 2021:%0A    # CCR2-203 ENST00000445132.3 maps to ENSP00000399285.2%0A    #
  Ens
@@ -1859,18 +1859,31 @@
 release 
-85
+104, GRCh38.p13
 %0A    tra
@@ -1949,22 +1949,22 @@
 NSP00000
-292301
+399285
 %22)%0A    e
@@ -1980,14 +1980,14 @@
 0000
-292301
+445132
 %22, t

Fix failing test