Bio::SeqIO::game gameHandler
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Summary
Bio::SeqIO::game::gameHandler -- PerlSAX handler for game-XML
Package variables
No package variables defined.
Included modules
Bio::SeqIO::game::gameSubs
Bio::SeqIO::game::seqHandler
strict
Inherit
Bio::SeqIO::game::gameSubs
Synopsis
This modules is not used directly
Description
Bio::SeqIO::game::gameHandler is the top-level XML handler invoked by PerlSAX
Methods
start_documentDescriptionCode
end_documentDescriptionCode
loadDescriptionCode
s_gameDescriptionCode
e_gameDescriptionCode
e_seqDescriptionCode
e_map_positionDescriptionCode
e_annotationDescriptionCode
Methods description
start_documentcode    nextTop
 Title   : start_document
 Function: begin parsing the document
end_documentcodeprevnextTop
 Title   : end_document
 Function: finish parsing the document
loadcodeprevnextTop
 Title   : load
 Usage   : $seqs = $handler->load
 Function: start parsing
 Returns : a ref to a list of sequence objects
 Args    : an optional flag to supress  elements (not used yet)
s_gamecodeprevnextTop
 Title   : s_game
 Function: begin parsing game element
e_gamecodeprevnextTop
 Title   : e_game
 Function: process the game element
e_seqcodeprevnextTop
 Title   : e_seq
 Function: process the sequence element
e_map_positioncodeprevnextTop
 Title   : e_map_position
 Function: process the map_position element
e_annotationcodeprevnextTop
 Title   : e_annotation
 Function: process the annotation
Methods code
start_documentdescriptionprevnextTop
sub start_document {
    my ($self, $document) = @_;

    $self->SUPER::start_document($document);
    
    $self->{sequences}    = {};
    $self->{annotations}  = {};
    $self->{computations} = {};
    $self->{map_position} = {};
    $self->{focus}        = {};
}
end_documentdescriptionprevnextTop
sub end_document {
    my ($self, $document) = @_;
    
    $self->SUPER::end_document($document);
    
    return $self;
}
loaddescriptionprevnextTop
sub load {
    my $self = shift;
    my $suppress_comps = shift;
    my @seqs = ();
    
    for ( 1..$self->{game} ) {
        my $seq  = $self->{sequences}->{$_} 
	  or $self->throw("No sequences defined");
        my $ann  = $self->{annotations}->{$_}
	  or $self->throw("No annotations");
        my $comp = $self->{computations}->{$_};
	my $map  = $self->{map_position}->{$_}
	  or $self->complain("No map position defined");
        my $foc  = $self->{focus}->{$_}
	  or $self->throw("No main sequence defined");
	my $src  = $self->{has_source};
	
	my $bio = Bio::SeqIO::game::seqHandler->new( $seq, $ann, $comp, $map, $src );
	push @seqs, $bio->convert;
    }\@
    
    seqs;
}
s_gamedescriptionprevnextTop
sub s_game {
    my ($self, $e) = @_;
    my $el = $self->curr_element;
    $self->{game}++;
    
    my $version = $el->{Attributes}->{version};
    
    unless ( defined $version ) {
	$self->complain("No GAME-xml version specified -- guessing v1.2\n");
        $version = 1.2;
    }
    if ( defined($version) && $version == 1.2) {
        $self->{origin_offset} = 1;
    } else {
	$self->{origin_offset} = 0;
    }

    if (defined($version) && ($version != 1.2)) {
        $self->complain("GAME version $version is not supported\n",
		        "I'll try anyway but I may fail!\n");
    }
}
e_gamedescriptionprevnextTop
sub e_game {
    my ($self, $el) = @_;
    $self->flush( $el );
}
e_seqdescriptionprevnextTop
sub e_seq {
    my ($self, $e) = @_;
    my $el = $self->curr_element();
    $self->{sequences}->{$self->{game}} ||= [];
    my $seqs = $self->{sequences}->{$self->{game}};
    
    if ( defined $el->{Attributes}->{focus} ) {
	$self->{focus}->{$self->{game}} = $el;
    }
    push @{$seqs}, $el;
    
    $self->flush;
}
e_map_positiondescriptionprevnextTop
sub e_map_position {
    my ($self, $e) = @_;
    my $el = $self->curr_element;
    $self->{map_position}->{$self->{game}} = $el;
}
e_annotationdescriptionprevnextTop
sub e_annotation {
    my ($self, $e) = shift;
    my $el = $self->curr_element;
    $self->{annotations}->{$self->{game}} ||= [];
    my $anns = $self->{annotations}->{$self->{game}};
    push @{$anns}, $el;
}
General documentation
FEEDBACKTop
Mailing ListsTop
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/MailList.shtml      - About the mailing lists
Reporting BugsTop
Report bugs to the Bioperl bug tracking system to help us keep track
of the bugs and their resolution.
Bug reports can be submitted via email or the web:
  bioperl-bugs@bioperl.org
  http://bugzilla.bioperl.org/
AUTHOR - Sheldon McKayTop
Email smckay@bcgsc.bc.ca
APPENDIXTop
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _