def test_transcript_start_codon(): """ test_transcript_start_codon : Check that fields Transcript (for transcript named CTNNBIP1-004) matches known values. """ CTNNBIP1_004_transcript = ensembl_grch38.transcript_by_id( CTNNBIP1_004_transcript_id) assert Locus.__eq__(CTNNBIP1_004_locus, CTNNBIP1_004_transcript), \ "Expected locus %s but got %s" % ( CTNNBIP1_004_locus, Locus.__str__(CTNNBIP1_004_transcript)) start_offsets = CTNNBIP1_004_transcript.start_codon_spliced_offsets assert len(start_offsets) == 3, \ "Wrong length for start codon: %d (%s)" % ( len(start_offsets), start_offsets) assert all(isinstance(i, int) for i in start_offsets), \ "Wrong type %s for beginning start codon offset" % ( [type(i) for i in start_offsets],) expected_start_codon_offset = len(CTNNBIP1_004_UTR5) start_codon_offset = min(start_offsets) assert start_codon_offset == expected_start_codon_offset, \ "Incorrect start codon offset, expected %d but got %d" % ( expected_start_codon_offset, start_codon_offset)
def test_transcript_exons(): """ test_transcript_exons : Ensure that properties of CTTNBIP1-004's Exon objects match known values. """ transcript = ensembl_grch38.transcript_by_id(CTNNBIP1_004_transcript_id) exons = transcript.exons assert isinstance(exons, list), \ "Expected list of Exon objects, got %s : %s" % (exons, type(exons)) # CTTNBIP1-004 has 5 exons assert len(exons) == len(CTTNNIP1_004_exon_lengths), \ "Expected %d exons but got %d" % ( len(CTTNNIP1_004_exon_lengths), len(exons)) for i, exon in enumerate(exons): expected_id = CTTNNIP1_004_exon_ids[i] assert exon.id == expected_id, \ "Expected exon #%d of %s to have ID %s but got %s" % ( i + 1, transcript, expected_id, exon.id) expected_length = CTTNNIP1_004_exon_lengths[i] assert len(exon) == expected_length, \ "Expected exon #%d of %s (%s) to have length %d but got %d" % ( i + 1, transcript, exon, expected_length, len(exon))
def test_transcript_cds_CTNNIP1_004(): transcript = ensembl_grch38.transcript_by_id(CTNNBIP1_004_transcript_id) cds = transcript.coding_sequence expected_cds_length = len(CTNNBIP1_004_CDS) eq_(len(cds), expected_cds_length, "Expected CDS length %d, got %d" % (expected_cds_length, len(cds))) eq_(cds, CTNNBIP1_004_CDS)
def test_transcript_sequence_ensembl_grch38(): # extremely short TRD gene seq = ensembl_grch38.transcript_sequence("ENST00000448914") expected = "ACTGGGGGATACG" eq_(seq, expected) # now try via a Transcript object eq_(ensembl_grch38.transcript_by_id("ENST00000448914").sequence, expected)
def test_transcript_utr3_sequence_CTNNIP1_004(): transcript = ensembl_grch38.transcript_by_id(CTNNBIP1_004_transcript_id) utr3 = transcript.three_prime_utr_sequence expected_utr3_length = len(CTNNBIP1_004_UTR3) eq_( len(utr3), expected_utr3_length, "Expected 3' UTR length %d, got %d" % (expected_utr3_length, len(utr3))) eq_(utr3, CTNNBIP1_004_UTR3)
def test_transcript_utr5_sequence_CTNNIP1_004(): transcript = ensembl_grch38.transcript_by_id(CTNNBIP1_004_transcript_id) utr5 = transcript.five_prime_utr_sequence expected_utr5_length = len(CTNNBIP1_004_UTR5) eq_( len(utr5), expected_utr5_length, "Expected 5' UTR length %d, got %d" % (expected_utr5_length, len(utr5))) eq_(utr5, CTNNBIP1_004_UTR5)
def test_transcript_cds_CTNNIP1_004(): transcript = ensembl_grch38.transcript_by_id(CTNNBIP1_004_transcript_id) cds = transcript.coding_sequence expected_cds_length = len(CTNNBIP1_004_CDS) eq_( len(cds), expected_cds_length, "Expected CDS length %d, got %d" % (expected_cds_length, len(cds))) eq_(cds, CTNNBIP1_004_CDS)
def test_transcript_utr3_sequence_CTNNIP1_004(): transcript = ensembl_grch38.transcript_by_id(CTNNBIP1_004_transcript_id) utr3 = transcript.three_prime_utr_sequence expected_utr3_length = len(CTNNBIP1_004_UTR3) eq_(len(utr3), expected_utr3_length, "Expected 3' UTR length %d, got %d" % ( expected_utr3_length, len(utr3))) eq_(utr3, CTNNBIP1_004_UTR3)
def test_transcript_utr5_sequence_CTNNIP1_004(): transcript = ensembl_grch38.transcript_by_id(CTNNBIP1_004_transcript_id) utr5 = transcript.five_prime_utr_sequence expected_utr5_length = len(CTNNBIP1_004_UTR5) eq_(len(utr5), expected_utr5_length, "Expected 5' UTR length %d, got %d" % ( expected_utr5_length, len(utr5))) eq_(utr5, CTNNBIP1_004_UTR5)