How to use the Bioperl to parse the parse flat file of UniProtKB database in order to get the function annotation of a protein ?
now, I can only fetch out the all comment of a protein, can someone help me ? I only want to fetch out the "FUNCTION".
my code :
#!/usr/bin/perl
use warnings;
use Bio::SeqIO;
use Bio::DB::SwissProt;
open (GENE, $ARGV[0]) or die "cannot open gene file:$!";
$db_obj = Bio::DB::SwissProt->new;
my @genes;
while(<GENE>){
chomp;
push @genes, $_;
}
$stream_seq = $db_obj->get_Stream_by_acc(["@genes"]);
my $i=0;
while ( my $seq_obj = $stream_seq->next_seq )
{
my $anno_collection = $seq_obj->annotation;
for my $key ( $anno_collection->get_all_annotation_keys )
{
my @annotations = $anno_collection->get_Annotations($key);
for my $value ( @annotations )
{
if ($value->tagname eq "comment") {
print "$genes[$i]:",$value->display_text,"\n";
}
}
}
$i++;
}
result:
Q8N349:-!- FUNCTION: Odorant receptor (Potential).
-!- SUBCELLULAR LOCATION: Cell membrane; Multi-pass membrane protein.
-!- SIMILARITY: Belongs to the G-protein coupled receptor 1 family.
-!- WEB RESOURCE: Name=Human Olfactory Receptor Data Exploratorium
(HORDE);
URL="http://bip.weizmann.ac.il/cgi-bin/HORDE/showGene.pl?key=symbol&value=OR2L13";
-----------------------------------------------------------------------
Copyrighted by the UniProt Consortium, see http://www.uniprot.org/terms
Distributed under the Creative Commons Attribution-NoDerivs License
-----------------------------------------------------------------------
1 answer
As an alternative to BioPerl, you can also do this on the UniProt web site http://www.uniprot.org:
Retrieve all entries with a "FUNCTION" comment (or alternatively, any other query): http://www.uniprot.org/uniprot/?query=annotation%3A%28type%3Afunction+*%29&sort=score
Use the "Customize" link to add a column ("show") for the "General annotation" topic "Function", and potentially remove ("hide") all columns you are not interested in.
Click on "Download" and choose the tab-delimited file format. e.g. http://www.uniprot.org/uniprot/?query=annotation%3a%28type%3afunction+*%29&sort=score&limit=10&format=tab&columns=id,entry%20name,comment%28function%29
If this format suits you, remove "&limit=10" from the above URL and use the URL programmatically.
See also the UniProt FAQ about programmatic access: http://www.uniprot.org/faq/28
Log in to answer this question.
please, take a few minutes to correctly format your question.
Yes, please do. I made a start for you. You need to indent lines of code with 4 spaces and do not copy/paste tabs.