bioxml-game/ 40775 765 764 0 7032225065 11643 5 ustar sac bioperl bioxml-game/dtd/ 40775 765 764 0 7032225065 12416 5 ustar sac bioperl bioxml-game/dtd/GAME.dtd 100664 765 764 32612 7027606432 13752 0 ustar sac bioperl
bioxml-game/README 100664 765 764 325 6774060307 12610 0 ustar sac bioperl This repository is for document type definitions describing
biological sequence annotations. It also includes tools for
manipulating documents that follow these DTDs, some real
examples, and related documentation. bioxml-game/examples/ 40775 765 764 0 7032225065 13461 5 ustar sac bioperl bioxml-game/examples/DmNotch_pfam_partial.xml 100664 765 764 4464 7015333763 20371 0 ustar sac bioperl
08/26/1999
hmmpfam
2.1.1
E
none
Pfam
god (and Sean Eddy) knows when it was created
4.1
1015.5
Pfam
PF00008
22.6
Motif
EGF
62
32
CTSV-GCQNGGTCVTQLN------GKTYCACDSH-----YVGDYC
0
44
CapnnpCsngGtCvntpggssdnfggytCeCppGdyylsytGkrC
32.5
Motif
EGF
100
35
CNSI-RCQNGGTCQVTFRNG---RPGISCKCPLG-----FDESLC
0
44
CapnnpCsngGtCvntpggssdnfggytCeCppGdyylsytGkrC
bioxml-game/tools/ 40775 765 764 0 7032225065 13003 5 ustar sac bioperl bioxml-game/tools/Game/ 40775 765 764 0 7032225065 13654 5 ustar sac bioperl bioxml-game/tools/Game/Formatter.pm 100664 765 764 6360 6765633267 16302 0 ustar sac bioperl =head1 NAME
Game::Formatter - Handler for Formatter Formats
=head1 SYNOPSIS
=cut
package Game::Formatter;
use Exporter;
use vars qw($AUTOLOAD @ISA);
use strict;
use Bio::Root::Object;
@ISA = qw(Bio::Root::Object Exporter);
=head2 make
Title : make
Usage : $format = Game::Formatter->make(-file => $filename, -format => 'Format')
Function: Returns a new
Returns : A Game::Formatter::Handler initialsed with the appropiate format
Args : -file => $filename
-format => format
-fh => filehandle to attach to
=cut
my $entry = 0;
sub make {
my ($class,%param) = @_;
my ($format);
$format = $param{'-format'} || $param{'-FORMAT'};
if( &_load_format_module($format) == 0 ) {
return undef;
}
$format = "Game::Formatter::$format"->new(%param);
return $format;
}
=head2 _load_format_module
Title : _load_format_module
Usage : *INTERNAL Formatter stuff*
Function: Loads up (like use) a module at run time on demand
Example :
Returns :
Args :
=cut
sub _load_format_module {
my ($format) = @_;
my ($module,$load,$m);
$module = "_SUPER::_initialize;
my ($file,$fh, $sf) = $self->_rearrange([qw(
FILE
FH
)],
@args,
);
if( $file && $fh ) {
$self->throw("Providing both a file and a filehandle for reading from - only one please!");
}
if( $file ) {
$fh = new IO::File;
$fh->open(">$file") || $self->throw("Could not open $file for format writing $!");
}
# print "Setting filehandle to $fh\n";
if ($fh) {
$self->_filehandle($fh);
$self->stream(Game::Stream::Filestream->new($fh));
}
# set stuff in self from @args
return $make; # success - we hope!
}
=head2 _filehandle
Title : _filehandle
Usage : $obj->_filehandle($newval)
Function:
Example :
Returns : value of _filehandle
Args : newvalue (optional)
=cut
sub _filehandle {
my ($obj,$value) = @_;
if( defined $value) {
$obj->{'_filehandle'} = $value;
}
return $obj->{'_filehandle'};
}
sub stream {
my $self = shift;
$self->{_stream} = shift if @_;
return $self->{_stream};
}
=head2 comp_analysis_out
Title : comp_analysis_out
Usage : comp_analysis_out($comp_analysis, $stream)
Function: transforms a CompAnalysis object to XML
Returns :
Args : CompAnalysis, Stream
=cut
sub comp_analysis_out {
my $self = shift;
$self->throw("this should be defined in the implementation class");
}
1;
bioxml-game/tools/Game/ModelBuilder.pm 100664 765 764 6066 6765633267 16711 0 ustar sac bioperl
=head1 NAME
Game::ModelBuilder - Handler for ModelBuilder Formats
=head1 SYNOPSIS
=cut
package Game::ModelBuilder;
use Exporter;
use vars qw($AUTOLOAD @ISA);
use strict;
use IO::File;
use Bio::Root::Object;
use Game::Stream::Filestream;
@ISA = qw(Bio::Root::Object Exporter);
# _initialize is where the heavy stuff will happen when new is called
=head2 make
Title : make
Usage : $format = Game::ModelBuilder->make(-file => $filename, -format => 'Format')
Function: Returns a new
Returns : A Game::ModelBuilder::Handler initialsed with the appropiate format
Args : -file => $filename
-format => format
-fh => filehandle to attach to
=cut
my $entry = 0;
sub make {
my ($class,%param) = @_;
my ($format);
$format = $param{'-format'} || $param{'-FORMAT'};
if( &_load_format_module($format) == 0 ) {
return undef;
}
$format = "Game::ModelBuilder::$format"->new(%param);
return $format;
}
=head2 _load_format_module
Title : _load_format_module
Usage : *INTERNAL ModelBuilder stuff*
Function: Loads up (like use) a module at run time on demand
Example :
Returns :
Args :
=cut
sub _load_format_module {
my ($format) = @_;
my ($module,$load,$m);
$module = "_SUPER::_initialize;
my ($file,$fh, $sf) = $self->_rearrange([qw(
FILE
FH
)],
@args,
);
if( $file && $fh ) {
$self->throw("Providing both a file and a filehandle for reading from - only one please!");
}
if( $file ) {
$fh = new IO::File;
$fh->open($file) || $self->throw("Could not open $file for format reading $!");
}
# print "Setting filehandle to $fh\n";
if ($fh) {
$self->_filehandle($fh);
$self->stream(Game::Stream::Filestream->new($fh));
}
# set stuff in self from @args
return $make; # success - we hope!
}
=head2 _filehandle
Title : _filehandle
Usage : $obj->_filehandle($newval)
Function:
Example :
Returns : value of _filehandle
Args : newvalue (optional)
=cut
sub _filehandle {
my ($obj,$value) = @_;
if( defined $value) {
$obj->{'_filehandle'} = $value;
}
return $obj->{'_filehandle'};
}
sub stream {
my $self = shift;
$self->{_stream} = shift if @_;
return $self->{_stream};
}
1;
bioxml-game/tools/Game/Formatter/ 40775 765 764 0 7032225065 15617 5 ustar sac bioperl bioxml-game/tools/Game/Formatter/Embl.pm 100664 765 764 1160 6765633267 17152 0 ustar sac bioperl
=head2 comp_analysis_out
Title : comp_analysis_out
Usage : comp_analysis_out($comp_analysis, $handler)
Function: transforms a CompAnalysis object to EMBL fmt
Returns :
Args : CompAnalysis, Handler
=cut
sub comp_analysis_out {
my $self = shift;
my $comp_analysis = shift;
my $handler = shift;
}
=head2 result_set_out
Title : result_set_out
Usage : result_set_out($result_set, $handler)
Function: transforms a ResultSet object to EMBL fmt
Returns :
Args : ResultSet, Handler
=cut
sub result_set_out {
my $self = shift;
my $result_set = shift;
my $handler = shift;
}
bioxml-game/tools/Game/Formatter/Game.pm 100664 765 764 3433 6765633267 17151 0 ustar sac bioperl package Game::Formatter::Game;
use Exporter;
use vars qw($AUTOLOAD @ISA);
use strict;
@ISA = qw(Game::Formatter Exporter);
=head2 comp_analysis_out
Title : comp_analysis_out
Usage : comp_analysis_out($comp_analysis, $stream)
Function: transforms a CompAnalysis object to XML
Returns :
Args : CompAnalysis, Stream
=cut
sub comp_analysis_out {
my $self = shift;
my ($comp_analysis, $inserted_text) =
$self->_rearrange(['COMP_ANALYSIS', 'TEXT'], @_);
my $stream = $self->stream();
$stream->out("seq()."\">");
$stream->out("".$comp_analysis->score().">");
my $result_set;
foreach $result_set (@{$comp_analysis->result_set_l()}) {
result_set_out($result_set, $stream);
}
$stream->out("");
}
=head2 result_set_out
Title : result_set_out
Usage : result_set_out($result_set, $stream)
Function: transforms a ResultSet object to XML
Returns :
Args : ResultSet, Stream
=cut
sub result_set_out {
my $self = shift;
my ($result_set, $inserted_text) =
$self->_rearrange(['RESULT_SET', 'TEXT'], @_);
my $stream = $self->stream();
$stream->out("");
$stream->out("");
$stream->out($result_set->score());
$stream->out("");
$stream->out("");
$stream->out($result_set->dbxref());
$stream->out("");
my $type;
foreach $type (keys %{$result_set->output_h()}) {
$stream->out("");
}
$stream->out("");
$stream->out($result_set->dbxref());
$stream->out("");
# ...
$stream->out("");
}
bioxml-game/tools/Game/Model/ 40775 765 764 0 7032225065 14714 5 ustar sac bioperl bioxml-game/tools/Game/Model/Annotation.pm 100664 765 764 0 6765633267 17412 0 ustar sac bioperl bioxml-game/tools/Game/Model/CompAnalysis.pm 100664 765 764 2620 6765633267 17774 0 ustar sac bioperl package Game::Model::CompAnalysis;
use Exporter;
use vars qw($AUTOLOAD @ISA);
use strict;
use Bio::Root::Object;
@ISA = qw(Bio::Root::Object Exporter);
sub _initialize {
my $self = shift;
my ($seq, $date, $program, $version, $database) =
$self->_rearrange(['SEQ', 'DATE', 'PROGRAM', 'VERSION', 'DATABASE'], @_);
$self->{_seq} = $seq;
$self->{_date} = $date;
$self->{_program} = $program;
$self->{_version} = $version;
$self->{_database} = $database;
$self->{result_set_l} = [];
}
=head2 seq
should this be an IDREF or a reference to an actual Seq object?
=cut
sub seq {
my $self = shift;
$self->{_seq} = shift if @_;
return $self->{_seq};
}
=head2 date
=cut
sub date {
my $self = shift;
$self->{_date} = shift if @_;
return $self->{_date};
}
=head2 program
=cut
sub program {
my $self = shift;
$self->{_program} = shift if @_;
return $self->{_program};
}
=head2 version
=cut
sub version {
my $self = shift;
$self->{_version} = shift if @_;
return $self->{_version};
}
=head2 database
=cut
sub database {
my $self = shift;
$self->{_database} = shift if @_;
return $self->{_database};
}
=head2 result_set_l
accessor for a ref to a list of ResultSet objects
=cut
sub result_set_l {
my $self = shift;
$self->{_result_set_l} = shift if @_;
return $self->{_result_set_l};
}
1;
bioxml-game/tools/Game/Model/ResultSet.pm 100664 765 764 2372 6765633267 17330 0 ustar sac bioperl =head1 NAME
Game::Model::ResultSet
=head2 SYNOPSIS
=head2 DESCRIPTION
=cut
package Game::Model::ResultSet;
use Exporter;
use vars qw($AUTOLOAD @ISA);
use strict;
@ISA = qw(Bio::Root::Object Exporter);
sub _initialize {
my $self = shift;
my ($score, $dbxref) =
$self->_rearrange(['SCORE', 'DBXREF'], @_);
$self->{_score} = $score;
$self->{_dbxref} = $dbxref;
$self->{_output_h} = {};
$self->{result_l} = [];
}
=head2 score
=cut
sub score {
my $self = shift;
$self->{_score} = shift if @_;
return $self->{_score};
}
=head2 dbxref
=cut
sub dbxref {
my $self = shift;
$self->{_dbxref} = shift if @_;
return $self->{_dbxref};
}
=head2 output_h
this is for weakly typed additional variables
xml type output implemented as a hashref (the hash key is the type) -
this may not be correct; for instance, we may want two output elements
with same "type", or we may want the output elements to be ordered???
this method gets or sets the whole hashref
=cut
sub output_h {
my $self = shift;
$self->{_output_h} = shift if @_;
return $self->{_output_h};
}
=head2 result_l
=cut
sub result_l {
my $self = shift;
$self->{_result_l} = shift if @_;
return $self->{_result_l};
}
1;
bioxml-game/tools/Game/ModelBuilder/ 40775 765 764 0 7032225065 16223 5 ustar sac bioperl bioxml-game/tools/Game/ModelBuilder/Blast.pm 100664 765 764 4342 6765633267 17751 0 ustar sac bioperl package Game::ModelBuilder::Blast;
use Exporter;
use vars qw($AUTOLOAD @ISA);
use strict;
use Game::Model::ResultSet;
use Game::Model::CompAnalysis;
@ISA = qw(Game::ModelBuilder Exporter);
=head2 next_result_set
Title : next_result_set
Usage : $result_set = $stream->next_result_set()
Function: returns the next ResultSet in the stream
Returns : Game::ResultSet object
Args :
VERY BASIC AT THE MOMENT
=cut
sub next_result_set {
my $self = shift;
my $result_set;
my $stream = $self->stream();
my $end_of_section = 0;
my $section_text = "";
my $line;
my $line_no = 0;
while (!$end_of_section && ($line = $stream->get_chunk("\n"))) {
if ($line =~ /^>/ && $line_no > 0) {
$stream->insert($line); # rewind!
$end_of_section = 1;
}
elsif ($line =~ /^PARAMETERS/ && $line_no > 0) {
$end_of_section = 1;
}
else {
$section_text.= $line;
#...
$line_no++;
}
}
# currently does ultra simple parsing - just puts everything in the
# xml