sub next_seq
{ my $self = shift;
my ($desc);
my $bioSeq = $self->_sequence_factory->create(-verbose =>$self->verbose());
my $zinc = "(\"zincins\")";
my $wing = "\"Winged helix\"";
my $finger = "\"zinc finger\"";
my $xml_fragment = undef;
while(my $line = $self->_readline()){
my $where = index($line, $zinc);
my $wherefinger = index($line, $finger);
my $finishedline = $line;
my $wingwhere = index($line, $wing);
if($where > 0){
my @linearray = split /$zinc/, $line;
$finishedline = join ""zincins"", $linearray[0], $linearray[2];
}
if(index($line, "&") > 0){
my @linearray = split /&/, $line;
$finishedline = join "&", $linearray[0], $linearray[1];
}
if($wingwhere > 0){
my @linearray = split /$wing/, $line;
$finishedline = join ""Winged helix"", $linearray[0], $linearray[1];
}
$xml_fragment .= $finishedline;
last if $finishedline =~ m!</protein>!;
}
return unless $xml_fragment =~ /<protein/;
$self->_parse_xml($xml_fragment);
my $dom = $self->_dom;
my ($protein_node) = $dom->findnodes('/protein');
my @interproNodes = $protein_node->findnodes('/protein/interpro');
my @DBNodes = $protein_node->findnodes('/protein/interpro/match');
for(my $interpn=0; $interpn<scalar(@interproNodes); $interpn++){
my $ipnlevel = join "", "/protein/interpro[", $interpn + 1, "]";
my @matchNodes = $protein_node->findnodes($ipnlevel);
for(my $match=0; $match<scalar(@matchNodes); $match++){
my $matlevel = join "", "/protein/interpro[", $interpn+1, "]/match[",
$match+1, "]/location";
my @locNodes = $protein_node->findnodes($matlevel);
my @seqFeatures = map { Bio::SeqFeature::Generic->new(
-start => $_->getAttribute('start'),
-end => $_->getAttribute('end'),
-score => $_->getAttribute('score'),
-source_tag => 'IPRscan',
-primary_tag => 'region',
-display_name => $interproNodes[$interpn]->getAttribute('name'),
-seq_id => $protein_node->getAttribute('id') ),
} @locNodes;
foreach my $seqFeature (@seqFeatures){
my $annotation1 = Bio::Annotation::DBLink->new;
$annotation1->database($matchNodes[$match]->getAttribute('dbname'));
$annotation1->primary_id($matchNodes[$match]->getAttribute('id'));
$annotation1->comment($matchNodes[$match]->getAttribute('name'));
$seqFeature->annotation->add_Annotation('dblink',$annotation1);
my $annotation2 = Bio::Annotation::DBLink->new;
$annotation2->database('INTERPRO');
$annotation2->primary_id($interproNodes[$interpn]->getAttribute('id'));
$annotation2->comment($interproNodes[$interpn]->getAttribute('name'));
$seqFeature->annotation->add_Annotation('dblink',$annotation2);
my $annotation3 = Bio::Annotation::DBLink->new;
$annotation3->database($DBNodes[$interpn]->getAttribute('dbname'));
$annotation3->primary_id($DBNodes[$interpn]->getAttribute('id'));
$annotation3->comment($DBNodes[$interpn]->getAttribute('name'));
$seqFeature->annotation->add_Annotation('dblink',$annotation3);
}
$bioSeq->add_SeqFeature(@seqFeatures);
}
}
my $accession = $protein_node->getAttribute('id');
my $displayname = $protein_node->getAttribute('name');
$bioSeq->accession($accession);
$bioSeq->display_name($displayname);
return $bioSeq;} |
sub _initialize
{ my($self,@args) = @_;
$self->SUPER::_initialize(@args);
$self->{'_func_ftunit_hash'} = {};
my %param = @args; @param{ map { lc $_ } keys %param } = values %param;
my $line = undef;
while($line = $self->_readline()){
if($line =~ /<protein/){
$self->_pushback($line);
last;
}
}
$self->_xml_parser( XML::DOM::Parser->new() );
$self->_sequence_factory( new Bio::Seq::SeqFactory
( -verbose => $self->verbose(),
-type => 'Bio::Seq::RichSeq'))
if ( ! defined $self->sequence_factory ); } |
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to
the Bioperl mailing list. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _