Bio-Das-ProServer
view release on metacpan or search on metacpan
lib/Bio/Das/ProServer/SourceAdaptor.pm view on Meta::CPAN
}
my $response .= sprintf q(<chain id="%s" %s>),
$id,
$chain->{'modelNumber'}?qq(model="$chain->{'modelNumber'}"):q();
#########
# Now add the "residues" to the chain
#
for my $group (@{$chain->{'groups'}}) {
my $gid = $group->{'id'};
my $icode = $group->{'icode'} || q();
#########
# Residue properties
#
$response .= sprintf q(<group type="%s" groupID="%s" name="%s" %s>),
$group->{'type'},
$gid,
$group->{'name'},
$icode ? qq(insertCode="$icode") : q();
#########
# Add the atoms to the chain
#
for my $atom (@{$group->{'atoms'}}) {
$response .= sprintf q(<atom x="%s" y="%s" z="%s" atomName="%s" atomID="%s"%s%s%s/>),
(map { $atom->{$_} } qw(x y z atomName atomId)),
(map { $atom->{$_}?qq( $_="$atom->{$_}"):q() } qw(occupancy tempFactor altLoc));
lib/Bio/Das/ProServer/SourceAdaptor/file.pm view on Meta::CPAN
for my $key (@FEATURE_KEYS) {
if ($self->config->{$key}) {
push @{ $self->{'extras'} }, $key;
}
}
$self->{'capabilities'}{'features'} = '1.0';
$self->{'capabilities'}{'types'} = '1.0';
if ($self->config->{'fid_query'}) {
$self->{'capabilities'}{'feature-by-id'} = '1.0';
}
if ($self->config->{'gid_query'}) {
$self->{'capabilities'}{'group-by-id'} = '1.0';
}
if ($self->config->{'stylesheet'} || $self->config->{'stylesheetfile'}) {
$self->{'capabilities'}{'stylesheet'} = '1.0';
}
return;
}
sub build_features {
my ($self, $args) = @_;
lib/Bio/Das/ProServer/SourceAdaptor/file.pm view on Meta::CPAN
my $query;
if ($segment) {
$query = $self->config->{'feature_query'} || q();
$query =~ s/%segment/$segment/mxs;
$query =~ s/%start/$start/mxs;
$query =~ s/%end/$end/mxs;
} elsif ($feature) {
$query = $self->config->{'fid_query'} || q();
$query =~ s/%feature_id/$feature/mxs;
} elsif ($group) {
$query = $self->config->{'gid_query'} || q();
$query =~ s/%group_id/$group/mxs;
} else {
$query = 'field0 like .*';
}
if (!$query) {
carp("Query type not supported. Args given: segment=$segment, feature_id=$feature, group_id=$group");
return ();
}
lib/Bio/Das/ProServer/SourceAdaptor/file.pm view on Meta::CPAN
homepage = http://www.example.com/project/
title = Example source
description = An example DAS source backed by a flat file
# Transport parameters:
filename = %serverroot/eg/data/mysimple.txt
cache = yes
# Adaptor parameters:
cols = segment,start,end,ori,type
feature_query = field0 = %segment and field2 >= %start and field1 <= %end
fid_query = field3 = %feature_id
gid_query = field4 = %group_id
=head3 filename (required)
Text file location
=head3 cache (optional)
Cache file contents - faster but increases memory footprint
=head3 cols (required)
lib/Bio/Das/ProServer/SourceAdaptor/file.pm view on Meta::CPAN
=head3 feature_query (required)
The query to use for segment-based queries. %segment, %start and %end will be
replaced with their respective values from a DAS request.
=head3 fid_query (optional)
The query to use for feature ID-based queries. %feature_id will be replaced with
the appropriate value from a DAS request.
=head3 gid_query (optional)
The query to use for group ID-based queries. %group_id will be replaced with
the appropriate value from a DAS request.
=head3 "fill-in" attributes
By specifying other parameters in the INI configuration, it is possible to "fill
in" attributes that are not included as columns in the data file. For example,
if all features were generated using the same method, it can be specified in the
INI file:
( run in 1.313 second using v1.01-cache-2.11-cpan-5735350b133 )