Access Gene and Transcript data
mainPyEnsembl provides a hierarchy of objects to navigate genomic features:
- Gene: Accessed via
genome.gene_by_id(gene_id=...)orgenome.genes_by_name(gene_name). AGeneobject contains information about its location and associated transcripts. - Transcript: Accessed via the
.transcriptsattribute of aGeneobject. - Protein: Transcripts provide access to protein information via
.protein_idand.protein_sequence.
# Example navigation
gene = genome.gene_by_id(gene_id='FBgn0011747')
transcript = gene.transcripts[0]
print(transcript.protein_id)
print(transcript.protein_sequence)