[Bioperl-guts-l] [14453] bioperl-live/trunk/Bio/SeqIO/entrezgene.pm: get rid of annoying ' pseudohashes' error; tests now pass on perl 5.8.8, perl 5.10
Christopher John Fields
cjfields at dev.open-bio.org
Mon Jan 21 18:57:48 EST 2008
Revision: 14453
Author: cjfields
Date: 2008-01-21 18:57:48 -0500 (Mon, 21 Jan 2008)
Log Message:
-----------
get rid of annoying 'pseudohashes' error; tests now pass on perl 5.8.8, perl 5.10
Modified Paths:
--------------
bioperl-live/trunk/Bio/SeqIO/entrezgene.pm
Modified: bioperl-live/trunk/Bio/SeqIO/entrezgene.pm
===================================================================
--- bioperl-live/trunk/Bio/SeqIO/entrezgene.pm 2008-01-21 22:41:33 UTC (rev 14452)
+++ bioperl-live/trunk/Bio/SeqIO/entrezgene.pm 2008-01-21 23:57:48 UTC (rev 14453)
@@ -104,7 +104,7 @@
#use Bio::Ontology::Ontology; Relationships.... later
use Bio::Ontology::Term;
use Bio::Annotation::OntologyTerm;
-#use Data::Dumper;
+use Data::Dumper;
use base qw(Bio::SeqIO);
@@ -443,9 +443,11 @@
my (%cann, at feat, at uncaptured, at comments, at sfann);
if ((ref($prod) eq 'HASH') && (exists($prod->{comment}))) {
$prod=$prod->{comment};
- }
- if (ref($prod) eq 'ARRAY') { @comments=@{$prod}; }
- else {push @comments,$prod;}
+ } elsif (ref($prod) eq 'ARRAY') {
+ @comments=@{$prod};
+ } else {
+ push @comments,$prod;
+ }
for my $i (0..$#comments) {#Each comments is a
my ($desc,$nfeat,$add, at ann, at comm);
my $comm=$comments[$i];
@@ -488,7 +490,7 @@
else {
push @comm,$comm;
}
- foreach my $ccomm (@comm) {
+ for my $ccomm (@comm) {
next unless ($ccomm);
if (exists($ccomm->{source})) {
my ($uncapt,$allann,$anchor) = _process_src($ccomm->{source});
@@ -506,51 +508,51 @@
else {
push @loc,$ccomm;
}
- foreach my $loc (@loc) {
- if ((exists($loc->{text}))&&($loc->{text}=~/Location/i)){
- my ($l1,$rest)=split(/-/,$loc->{text});
- $l1=~s/\D//g;
- $rest=~s/^\s//;
- my ($l2,$scorestr)=split(/\s/,$rest,2);
- my ($scoresrc,$score)=split(/:/,$scorestr);
- $score=~s/\D//g;
- my (%tags,$tag);
- unless ($l1) {
- next;
- }
- $nfeat=Bio::SeqFeature::Generic->new(-start=>$l1,
- -end=>$l2,
- -strand=>$tags{strand},
- -source=>$loc->{type},
- -seq_id=>$desc,
- -primary=>$heading,
- -score=>$score,
- -tag => {score_src=>$scoresrc});
- my $sfeatann=Bio::Annotation::Collection->new();
- foreach my $sfann (@sfann) {
- $sfeatann->add_Annotation('dblink',$sfann);
- }
- undef @sfann;
- $nfeat->annotation($sfeatann);#Thus the annotation will be available both in the seq and seqfeat?
- push @feat,$nfeat;
- delete $loc->{text};
- delete $loc->{type};
- }
- elsif (exists($loc->{label})) {
- my $simann=Bio::Annotation::SimpleValue->new(-value=>$loc->{text},-tagname=>$loc->{label});
- delete $loc->{text};
- delete $loc->{label};
- push @{$cann{'simple'}},$simann;
- push @uncaptured,$loc;
- }
- elsif (exists($loc->{text})) {
- my $simann=Bio::Annotation::SimpleValue->new(-value=>$loc->{text},-tagname=>$heading);
- delete $loc->{text};
- push @{$cann{'simple'}},$simann;
- push @uncaptured,$loc;
- }
-
- }
+ foreach my $loc (@loc) {
+ if ((exists($loc->{text}))&&($loc->{text}=~/Location/i)){
+ my ($l1,$rest)=split(/-/,$loc->{text});
+ $l1=~s/\D//g;
+ $rest=~s/^\s//;
+ my ($l2,$scorestr)=split(/\s/,$rest,2);
+ my ($scoresrc,$score)=split(/:/,$scorestr);
+ $score=~s/\D//g;
+ my (%tags,$tag);
+ unless ($l1) {
+ next;
+ }
+ $nfeat=Bio::SeqFeature::Generic->new(-start=>$l1,
+ -end=>$l2,
+ -strand=>$tags{strand},
+ -source=>$loc->{type},
+ -seq_id=>$desc,
+ -primary=>$heading,
+ -score=>$score,
+ -tag => {score_src=>$scoresrc});
+ my $sfeatann=Bio::Annotation::Collection->new();
+ foreach my $sfann (@sfann) {
+ $sfeatann->add_Annotation('dblink',$sfann);
+ }
+ undef @sfann;
+ $nfeat->annotation($sfeatann);#Thus the annotation will be available both in the seq and seqfeat?
+ push @feat,$nfeat;
+ delete $loc->{text};
+ delete $loc->{type};
+ }
+ elsif (exists($loc->{label})) {
+ my $simann=Bio::Annotation::SimpleValue->new(-value=>$loc->{text},-tagname=>$loc->{label});
+ delete $loc->{text};
+ delete $loc->{label};
+ push @{$cann{'simple'}},$simann;
+ push @uncaptured,$loc;
+ }
+ elsif (exists($loc->{text})) {
+ my $simann=Bio::Annotation::SimpleValue->new(-value=>$loc->{text},-tagname=>$heading);
+ delete $loc->{text};
+ push @{$cann{'simple'}},$simann;
+ push @uncaptured,$loc;
+ }
+
+ }
}#Bit clumsy but that's what we get from the low level parser
}
}
More information about the Bioperl-guts-l
mailing list