[Bioperl-l] RE:Problems to get secondary accessions from an object

stephan stephan.rosecker at ish.de
Wed Nov 16 18:00:15 EST 2005


Hilmar,

you solved my problem.

thanks a lot!

stephan


Hilmar Lapp schrieb:
> Stephan, is it necessary that you create your own annotation collection? 
> If you replace the line
> 
>     my $col  = new Bio::Annotation::Collection;
> 
> with
> 
>     my $col  = $prot->annotation;
> 
> you wouldn't lose annotation that's already present in the sequence's 
> existing annotation collection. (And you could then also remove the then 
> superfluous setter call $prot->annotation($col);)
> 
>     -hilmar
> 
> On Nov 9, 2005, at 11:51 AM, stephan wrote:
> 
>> Hi,
>>
>> I found a trace.
>> The problem is that after I add anotations to the object, the 
>> rich-features are disappeared.
>>
>> snippet:
>> #prot is the seq object
>>
>> sub setProtAnnotations($$) {
>>     my $prot = $_[0];
>>     my $col  = new Bio::Annotation::Collection;
>>     my $sv   = new Bio::Annotation::SimpleValue(-value =>              
>> &getSimpleFam( $_[1] ) );
>>     $col->add_Annotation( 'family', $sv );
>>     $sv = new Bio::Annotation::SimpleValue(-value => 
>> &getWeight(             $_[0] ) );
>>     $col->add_Annotation( 'weight', $sv );
>>     $sv = new Bio::Annotation::SimpleValue(-value => $link .          
>> $prot->accession_number() );
>>     $col->add_Annotation( 'link', $sv );
>>     $sv = new Bio::Annotation::SimpleValue(-value => &getEval( 
>> $_[1]     ) );
>>     $col->add_Annotation( 'e-val', $sv );
>>     $sv = new Bio::Annotation::SimpleValue( -value => 
>> $_[0]->seq()             );
>>     $col->add_Annotation( 'sequence', $sv );
>>     $prot->annotation($col);}
>>
>> sub getProtAnnotation($$) {
>>     my $ano = $_[0]->annotation();
>>     my @an  = $ano->get_Annotations( $_[1] );
>>     my $erg = $an[0]->value();}
>>
>> sub setProtAnnotation($$$) {
>>     my $prot = $_[0];
>>     my $ano  = $prot->annotation();
>>     my @an   = $ano->get_Annotations( $_[1] );
>>     my $erg  = $an[0]->value( $_[2] );}
>>
>> sub getEval($) {
>>     my $report =
>>     $hmm_swiss_index->fetch_report( $accarray[ $_[0] ] );
>>     my $hit  = $report->next_hit();
>>     my $hsp  = $hit->next_domain();
>>     my $eval = $hsp->evalue();}
>>
>> sub getSimpleFam($) {
>>     my $report =
>>     $hmm_swiss_index->fetch_report( $accarray[ $_[0] ] );
>>     my $hit = $report->next_hit();
>>     my $fam = $hit->name();}
>>
>>
>>
>>
>>
>> >Hi,
>> >>
>> >> I have problems to get the secondary_accessions from an seq object.
>> >>
>> >> E.G
>> >>
>> >> $inx = Bio::Index::Swissprot->new($Index_File_Name);
>> >> $prot = $inx->fetch( $accarray[ $_[0] ] );
>> >> #"$accarray[ $_[0]" is an array of accessions
>> >>
>> >> print "Description: " . $prot->description . "\n";
>> >> print "Accessions: " .$sec . "\n";
>> >> print "Species: " . $prot->species->binomial() . "\n";
>> >> print "Length: " . $prot->length . "\n";
>> >> #this looks good
>> >>
>> >> @a = $prot->get_secondary_accessions;
>> >> #@a is empty!
>> >>
>> >> Seems that $prot is not a reference to a rich:seq object or somthing
>> >> other is wrong.
>> >>
>> >> Hope that someone can help me.
>> >>
>> >> regards
>> >> stephan
>> >>
>> >>
>> >> _______________________________________________
>> >> Bioperl-l mailing list
>> >> Bioperl-l at portal.open-bio.org
>> >> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>>
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at portal.open-bio.org
>> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>>
>>



More information about the Bioperl-l mailing list