[ensembl-dev] gene centred info via slices
Patrick Meidl
pmeidl at cemm.oeaw.ac.at
Mon Oct 11 10:10:23 BST 2010
On Mon, Oct 11 2010, Felix Kokocinski <fsk at sanger.ac.uk> wrote:
> >>my $slice_adaptor = $registry->get_adaptor($spec, 'Core', 'slice');
> >> foreach my $slice (@{$slice_adaptor->fetch_all('toplevel')}){
> >> foreach my $gene (@{$slice->get_all_Genes}){
> >> foreach my $transcript (@{$gene->get_all_Transcripts}){
> >> foreach my $exon (@{$transcript->get_all_Exons}){
> >> ####get transcript, UTR, exon, and intron start and
> >>end in cDNA coordinates and genomic coordinates
> >> }
> >> }
> >> }
> >>}
> >
> >If you are only interested in one biotype eg. protein-coding then you
> >could modify your gene-fetch query like:
> >
> >foreach my $gene (@{$slice->get_all_Genes(undef, undef, undef,
> >undef, 'protein_coding')}){
>
> just to add to this: For specific biotypes you could also do:
> $genes = $slice->get_all_Genes_by_type($type);
probably the most important performance optimisation would be to set
argument 3 for get_all_Genes() to a true value. since you are looping
over all transcripts, you should turn off lazy-loading.
see
http://www.ensembl.org/info/docs/Pdoc/ensembl/modules/Bio/EnsEMBL/Slice.html#POD27
HTH
patrick
--
Patrick Meidl, Mag.
Bioinformatician
Ce-M-M-
Research Centre for Molecular Medicine
of the Austrian Academy of Science
Lazarettgasse 14 / AKH BT 25.3
Vienna, Austria
room 02.205
phone +43 1 40160 70016
email pmeidl at cemm.oeaw.ac.at
web http://www.cemm.at/
More information about the Dev
mailing list