SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
gene names from Ensembl papori Bioinformatics 7 01-22-2013 11:38 AM
gene ontology ssing Bioinformatics 1 02-22-2012 04:24 AM
gene ontology over-representation of differentially expressed genes damiankao Bioinformatics 10 10-20-2011 01:57 PM
window cutoff for nearest gene (gene ontology) repinementer Bioinformatics 1 11-22-2010 04:40 PM
High throughput Gene Ontology enrichment API ieuanclay Bioinformatics 3 08-23-2010 06:23 AM

Reply
 
Thread Tools
Old 07-13-2012, 10:02 AM   #1
owen05nju
Junior Member
 
Location: Minnesota

Join Date: Jan 2012
Posts: 1
Cool Pull out gene ontology annotation from Ensembl

Hi,

I was working on some scripts that uses Ensembl perl API to pull out newest gene build and associated annotations. However, I went into trouble when trying to retrieve gene ontology annotations associated to genes. I know you can easily have this done using BioMart in Ensembl (external references in attributes), but seems tricky to me to achieve this by perl API. Anyone got any ideas? Thanks in advance.

Bin
owen05nju is offline   Reply With Quote
Old 08-01-2012, 04:40 AM   #2
flxlex
Moderator
 
Location: Oslo, Norway

Join Date: Nov 2008
Posts: 415
Default

Here is a quick copy and paste from an old script that may help or at least get you started:

Code:
#  GET THE GENE ADAPTOR FOR THIS DATABASE
my $ga = $dba->get_GeneAdaptor() ; 

#  GET THE ONTOLOGY ADAPTOR FOR THIS DATABASE
#my $go = $dba->get_OntologyAdaptor() ; 

#  GET THE TRANSLATION ADAPTOR FOR THIS DATABASE
my $tra = $dba->get_TranslationAdaptor() ; 

# Get all genes
my @genes = @{$ga->fetch_all_by_biotype('protein_coding') };

# Loop through genes
my %seen;	# prevent duplicates

foreach my $gene (@genes) {
	my $header = ">".$gene->stable_id();	# ensembl ID

	my @db_links=( $gene->get_all_DBLinks() );
    my $db_entries = shift @db_links;
    foreach my $dbe ( @{$db_entries} ) {
    	my $out="$header\t".$dbe->display_id()." ".$dbe->description."\n" if $dbe->dbname() eq "GO";
    	if ($out){
	    	$seen{$out}=1;
	        print $out;
        }
    }
	
}
flxlex is offline   Reply With Quote
Reply

Tags
api, ensembl, gene ontology, perl

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 05:29 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO