Bio::Network::IO
psi10
Toolbar
Summary
Bio::Network::IO::psi10
Package variables
No package variables defined.
Included modules
Bio::Annotation::Collection
Bio::Annotation::DBLink
Bio::Root::Root
Bio::Seq::SeqFactory
Bio::Species
XML::Twig
Inherit
Synopsis
Do not use this module directly, use Bio::Network::IO:
my $io = Bio::Network::IO->new(-format => 'psi10',
-file => 'data.xml');
my $network = $io->next_network;
Description
Methods
Methods description
Name : next_network Purpose : Constructs a protein interaction graph from PSI XML data Usage : my $net = $io->next_network() Arguments : Returns : A Bio::Network::ProteinNet object |
Name : _proteinInteractor Purpose : Parses protein information into Bio::Seq::RichSeq objects Returns : Usage : Internally called by next_network() Arguments : None |
Name : _addInteraction Purpose : Adds a new Interaction to a graph Usage : Do not call, called internally by next_network() Returns : Notes : The PSI MI 2.5 standard calls for a field titled interactorRef |
Methods code
BEGIN { $fac = Bio::Seq::SeqFactory->new(-type => 'Bio::Seq::RichSeq'); } |
sub next_network
{ my $self = shift;
$net = Bio::Network::ProteinNet->new(refvertexed => 1);
my $t = XML::Twig->new(TwigHandlers => {
proteinInteractor =>\& _proteinInteractor,
interaction =>\& _addInteraction
});
$t->parsefile($self->file);
$net;} |
sub _proteinInteractor
{ my ($twig, $pi) = @_;
my ($acc, $sp, $desc, $prim_id);
my $org = $pi->first_child('organism');
my $taxid = $org->att('ncbiTaxId');
if ( !exists($species{$taxid}) ) {
my $common = $org->first_child('names')->first_child('shortLabel')->text;
my $full;
eval {
$full = $org->first_child('names')->first_child('fullName')->text;
};
$full = $common if $@;
my $sp_obj = Bio::Species->new(-ncbi_taxid => $taxid,
-name => $full,
-common_name => $common
);
$species{$taxid} = $sp_obj;
}
my @ids = $pi->first_child('xref')->children();
my %ids = map {$_->att('db'), $_->att('id')} @ids;
$ids{'psixml'} = $pi->att('id');
$prim_id = defined ($ids{'GI'}) ? $ids{'GI'} : '';
$acc = $ids{'RefSeq'} ||
$ids{'SWP'} || $ids{'Swiss-Prot'} || $ids{'Ref-Seq'} || $ids{'uniprotkb'} || $ids{'GI'} ||
$ids{'PIR'} ||
$ids{'intact'} || $ids{'psi-mi'} || $ids{'DIP'} || $ids{'ensembl'} || $ids{'flybase'} || $ids{'wormbase'} || $ids{'sgd'} || $ids{'ddbj/embl/genbank'} || $ids{'mint'};
eval {
$desc = $pi->first_child('names')->first_child('fullName')->text;
};
if ($@) {
warn("No fullName, use shortLabel for description instead");
$desc = $pi->first_child('names')->first_child('shortLabel')->text;
}
my $ac = Bio::Annotation::Collection->new();
for my $db (keys %ids) {
next if $ids{$db} eq $acc;
next if $ids{$db} eq $prim_id;
my $an = Bio::Annotation::DBLink->new( -database => $db,
-primary_id => $ids{$db},
);
$ac->add_Annotation('dblink',$an);
}
my $prot = $fac->create(
-accession_number => $acc,
-desc => $desc,
-display_id => $acc,
-primary_id => $prim_id,
-species => $species{$taxid},
-annotation => $ac);
my $node = Bio::Network::Node->new(-protein => [($prot)]);
$net->add_node($node);
$net->add_id_to_node($ids{'psixml'},$node);
$net->add_id_to_node($prot->primary_id,$node);
$net->add_id_to_node($prot->accession_number,$node);
$ac = $prot->annotation();
for my $an ($ac->get_Annotations('dblink')) {
$net->add_id_to_node($an->primary_id,$node);
}
$twig->purge();} |
sub _addInteraction
{ my ($twig, $i) = @_;
my @ints = $i->first_child('participantList')->children;
my @nodeids = map {$_->first_child('proteinInteractorRef')->att('ref')} @ints;
my $interx_id = $i->first_child('xref')->first_child('primaryRef')->att('id');
my $node1 = $net->get_nodes_by_id($nodeids[0]);
my $node2 = $net->get_nodes_by_id($nodeids[1]);
my $interx = Bio::Network::Interaction->new(-id => $interx_id);
$net->add_interaction(-nodes => [($node1,$node2)],
-interaction => $interx );
$net->add_id_to_interaction($interx_id,$interx);
$twig->purge();
}
1;
__END__} |
General documentation
| DATA NOT YET AVAILABLE | Top |
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via the
web:
http://bugzilla.open-bio.org/