NAME

Bio::Das::ProServer::SourceAdaptor - base class for sources

VERSION

$Revision: 2.59 $

SYNOPSIS

A base class implementing stubs for all SourceAdaptors.

DESCRIPTION

SourceAdaptor.pm generats XML and manages callouts for DAS request handling.

If you're extending ProServer, this class is probably what you need to inherit. The build_* methods are probably the ones you need to extend. build_features() in particular.

AUTHOR

Roger Pettett <rmp@sanger.ac.uk>

SUBROUTINES/METHODS

new : Constructor

my $oSourceAdaptor = Bio::Das::ProServer::SourceAdaptor::<implementation>->new({
  'dsn'      => q(),
  'port'     => q(),
  'hostname' => q(),
  'config'   => q(),
  'debug'    => 1,
});

Generally this would only be invoked on a subclass

init : Post-construction initialisation, passed the first argument to new()

$oSourceAdaptor->init();

length : Returns the segment-length given a segment

my $sSegmentLength = $oSourceAdaptor->length('1:1,100000');

mapmaster : Mapmaster for this source. Overrides configuration 'mapmaster' setting

my $sMapMaster = $oSourceAdaptor->mapmaster();

description : Description for this source. overrides configuration 'description' setting

my $sDescription = $oSourceAdaptor->description();

build_features : (subclasses only) Fetch feature data

This call is made by das_features(). It is passed one of:

{ 'segment'    => $, 'start' => $, 'end' => $ }

{ 'feature_id' => $ }

{ 'group_id'   => $ }

and is expected to return a reference to an array of hash references, i.e.
[{},{}...{}]

Each hash returned represents a single feature and should contain a subset of the following keys and types. For scalar types (i.e. numbers and strings) refer to the specification on biodas.org.

start                         => $
end                           => $
note                          => $ or [$,$,$...]
id       || feature_id        => $ 
label    || feature_label     => $
type                          => $ 
typetxt                       => $ 
method                        => $ 
method_label                  => $ 
group_id || group             => $ or [{
                                        grouplabel   => $,
                                        grouptype    => $,
                                        groupnote    => $,
                                        grouplink    => $,
                                        grouplinktxt => $,
                                        note         => $ or [$,$,$...],
                                        target       => [{
                                                           id        => $,
                                                           start     => $,
                                                           stop      => $,
                                                           targettxt => $,
                                                          }],
                                       },{}...]
grouplabel                    => $
grouptype                     => $
groupnote                     => $
grouplink                     => $
grouplinktxt                  => $
score                         => $
ori                           => $
phase                         => $
link                          => $
linktxt                       => $
target                        => scalar or [{
                                             id        => $,
                                             start     => $,
                                             stop      => $,
                                             targettxt => $,
                                            },{}...]
target_id                     => $
target_start                  => $
target_stop                   => $
targettxt                     => $
typecategory || type_category => $
typesubparts                  => $
typesuperparts                => $
typereference                 => $

build_types : (Subclasses only) fetch type data

This call is made by das_types(). It is passed one of:

[{ 'segment'    => $, 'start' => $, 'end' => $ }, {}...]

{ 'segment'    => $, 'start' => $, 'end' => $ }

and is expected to return a reference to an array of hash references, i.e.
[{},{}...{}]

Each hash returned represents a single type and should contain a subset of the following keys and values. For scalar types (i.e. numbers and strings) refer to the specification on biodas.org.

type        => $
method      => $
category    => $
c_ontology  => $
evidence    => $
e_ontology  => $
description => $
count       => $

build_entry_points : (Subclasses only) fetch entry_points data

This call is made by das_entry_points(). It is not passed any args

and is expected to return a reference to an array of hash references, i.e. [{},{}...{}]

Each hash returned represents a single entry_point and should contain a subset of the following keys and values. For scalar types (i.e. numbers and strings) refer to the specification on biodas.org.

segment  => $
length   => $
subparts => $

init_segments : hook for optimising results to be returned.

By default - do nothing
Not necessary for most circumstances, but useful for deciding on what sort
of coordinate system you return the results if more than one type is available.

$self->init_segments() is called inside das_features() before build_features().

known_segments : returns a list of valid segments that this adaptor knows about

my @aSegmentNames = $oSourceAdaptor->known_segments();

segment_version : gives the version of a segment (MD5 under certain circumstances) given a segment name

my $sVersion = $oSourceAdaptor->segment_version($sSegment);

dsn : get accessor for this sourceadaptor's dsn

my $sDSN = $oSourceAdaptor->dsn();

dsnversion : get accessor for this sourceadaptor's dsn version

my $sDSNVersion = $oSourceAdaptor->dsnversion();

start : get accessor for segment start given a segment

my $sStart = $oSourceAdaptor->start('DYNA_CHICK:35,127');

Returns 1 by default

end : get accessor for segment end given a segment

my $sEnd = $oSourceAdaptor->end('DYNA_CHICK:35,127');

transport : Build the relevant B::D::PS::SA::Transport::<...> configured for this adaptor

my $oTransport = $oSourceAdaptor->transport();

config : get/set config settings for this adaptor

$oSourceAdaptor->config($oConfig);

my $oConfig = $oSourceAdaptor->config();

implements : helper to determine if an adaptor implements a request based on its capabilities

my $bIsImplemented = $oSourceAdaptor->implements($sDASCall); # e.g. $sDASCall = 'sequence'

das_capabilities : DAS-response capabilities header support

my $sHTTPHeader = $oSourceAdaptor->das_capabilities();

das_dsn : DAS-response for dsn request

my $sXMLResponse = $sa->das_dsn();

open_dasdsn : DAS-response dsn xml leader

my $sXMLResponse = $sa->open_dasdsn();

close_dasdsn : DAS-response dsn xml trailer

my $sXMLResponse = $sa->close_dasdsn();

unknown_segment : DAS-response unknown segment error response

my $sXMLResponse = $sa->unknown_segment();

das_features : DAS-response for 'features' request

my $sXMLResponse = $sa->das_features();

error_feature : DAS-response unknown feature error

my $sXMLResponse = $sa->error_feature();

das_dna : DAS-response for DNA request

my $xml = $sa->das_dna();

das_sequence : DAS-response for sequence request

my $sXMLResponse = $sa->das_sequence();

das_types : DAS-response for 'types' request

my $sXMLResponse = $sa->das_types();

das_entry_points : DAS-response for 'entry_points' request

my $sXMLResponse = $sa->das_entry_points();

das_stylesheet : DAS-response for 'stylesheet' request

my $sXMLResponse = $sa->das_stylesheet();

das_homepage : DAS-response (non-standard) for 'homepage' request

my $sHTMLResponse = $sa->das_homepage();

das_xsl : DAS-response (non-standard) for 'xsl' request

my $sXSLResponse = $sa->das_xsl();

das_alignment

Title    : das_alignment
Function : This produces the das repsonse for an alignment
Args     : query options
returns  : string containing Das repsonse for the alignment

Example Response:
<alignment>
 <alignObject>
   <alignObjectDetail />
   <sequence />
 </alignObject>
 <score/>
 <block>
   <segment>
     <cigar />
   </segment>
 </block>
 <geo3D>
   <matrix>
     <max11 coord="float" />
     <max12 coord="float" />
     <max13 coord="float" />
     <max21 coord="float" />
     <max22 coord="float" />
     <max23 coord="float" />
     <max31 coord="float" />
     <max32 coord="float" />
     <max33 coord="float" />
   </matrix>
 </geo3D>	
</alignment>

_gen_align_object_response

Title    : _gen_align_object_response
Function : Formats the supplied alignment object data structure and
         : arbitrary spacing for pretty printing and converts the
         : data structure into dasalignment xml
Args     : align data structure, spacing string
Returns  : Das Response string encapuslating aliObject

_gen_align_score_response

Title   : _gen_align_score_response
Function: The takes an input score data structure and arbitrary spacing 
        : for pretty printing and converts the data structure into 
        : dasalignment xml
Args    : score data structure, spacing string
Returns : Das Response string from alignment score

_gen_align_block_response

Title   : _gen_align_block_response
Function: The takes an input block data structure and arbitrary spacing 
        : for pretty printing and converts the block data structure into 
        : dasalignment xml
Args    : block data structure, spacing string
Returns : Das Response string from alignmentblock

_gen_align_geo3d_response

Title    : genAlignGeo3d
Function : Takes a geo3d data structure and arbitrary spacing for pretty printing and convertis it into DAS repsonse XML that represents the alignment matrix.
Args     : data structure containing the vector and matrix, spacing string
Returns  : String containing the DAS response xml

das_structure

Title    : das_structure
Function : This produces the das repsonse for a pdb structure
Args     : query options.  Currently, this will that query, chain and modelnumber.
         : The only part of the specification that this does not adhere to is the range argument. 
         : However, I think this argument is a potential can of worms!
returns  : string containing Das repsonse for the pdb structure
comment  : See http://www.efamily.org.uk/xml/das/documentation/structure.shtml for more information 
         : on the das structure specification.

Example Response:
<object dbAccessionId="1A4A" intObjectId="1A4A" objectVersion="29-APR-98" type="protein structure" dbSource="PDB" dbVersion="20040621" dbCoordSys="PDBresnum" />
<chain id="A" SwissprotId="null">
 <group name="ALA" type="amino" groupID="1">
   <atom atomID="1" atomName=" N  " x="-19.031" y="16.695" z="3.708" />
   <atom atomID="2" atomName=" CA " x="-20.282" y="16.902" z="4.404" />
   <atom atomID="3" atomName=" C  " x="-20.575" y="18.394" z="4.215" />
   <atom atomID="4" atomName=" O  " x="-20.436" y="19.194" z="5.133" />
   <atom atomID="5" atomName=" CB " x="-20.077" y="16.548" z="5.883" />
   <atom atomID="6" atomName="1H  " x="-18.381" y="17.406" z="4.081" />
   <atom atomID="7" atomName="2H  " x="-18.579" y="15.781" z="3.874" />
   <atom atomID="8" atomName="3H  " x="-19.018" y="16.844" z="2.68" />
 </group>
 <group name="HOH" type="hetatm" groupID="219">
   <atom atomID="3057" atomName=" O  " x="-17.904" y="13.635" z="-7.538" />
   <atom atomID="3058" atomName="1H  " x="-18.717" y="14.098" z="-7.782" />
   <atom atomID="3059" atomName="2H  " x="-17.429" y="13.729" z="-8.371" />
 </group>
</chain>
<connect atomSerial="26" type="bond">
 <atomID atomID="25" />
 <atomID atomID="242" />
</connect>

_gen_object_response

Title    : _gen_object_response
Function : Formats the supplied structure object data structure and
         : arbitrary spacing for pretty printing and converts the
         : data structure into dasstructure xml
Args     : object data structure, spacing string
Returns  : Das Response string encapuslating 'object'
Comment  : The object response allows the details of the coordinates to be descriped. For example
         : the fact that the coos are part of a pdb file.

_gen_chain_response

Title    : _gen_chain_response
Function : Formats the supplied chain object data structure and
         : arbitrary spacing for pretty printing and converts the
         : data structure into dasstructure xml
Args     : chain data structure, spacing string
Returns  : Das Response string encapuslating 'chain'
Comment  : Chain objects contain all of the atom positions (including hetatoms).
         : The groups are typically residues or ligands.

_gen_connect_response

Title    : _gen_connect_response
Function : Formats the supplied connect data structure and
         : arbitrary spacing for pretty printing and converts the
         : data structure into dasstructure xml
Args     : connect data structure, spacing string
Returns  : Das Response string encapuslating "connect"
Comment  : Such objects are specified to enable groups of atoms to be connected together.

cleanup : Post-request garbage collection

CONFIGURATION AND ENVIRONMENT

Used within Bio::Das::ProServer::Config, eg/proserver and of course all subclasses.

DIAGNOSTICS

set $self->{'debug'} = 1

DEPENDENCIES

HTML::Entities

INCOMPATIBILITIES

None reported

BUGS AND LIMITATIONS

None reported

LICENSE AND COPYRIGHT

Copyright (c) 2007 The Sanger Institute

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.