Hi
Have Updated DAS/biomart.pm on branch 0.4 with the changes proposed by
Els, Many Thanks.
If the new one does not work, please drop a note and we will have look
at it.
Cheers
Syed
On Tue, 2006-07-11 at 13:47 +0200, Els Vanbleu wrote:
> Hi all,
>
> I continued debugging and as far as I see, the biomart.pm module is now
> working fine. I copy-pasted the changes I made to the build_features
> method below. There seemed to be an issue with the attributes given to
> the 'new' method of the BioMart::Query and to the 'getResultTable'
> method of BioMart::QueryPlanner but that should be fixed now.
>
> Have fun!
> Regards,
> ELS
>
>
> sub build_features
> {
> my ($self, $opts) = @_;
>
> my $segment = $opts->{'segment'} || return ( );
> my $segment_start = $opts->{'start'};
> my $segment_end = $opts->{'end'};
>
> # Use $segment and, if they are defined, $segment_start and
> # $segment_end, to fetch the appropriate data from the mart.
>
> my $virtual_schema_name;
> if (defined($self->{'BioMart'}->{'virtualSchema'})) {
> $virtual_schema_name =
> ($self->{'BioMart'}->{'virtualSchema'});
> }else {
> $virtual_schema_name = DEFAULTVSCHEMA;
> }
>
> ### modified by EV ###
> my $query = BioMart::Query->new( 'registry' =>
> $self->{'BioMart'}->{'registry'},
> 'virtualSchemaName'=>$virtual_schema_name);
>
> my $atts = $self->{'BioMart'}->{'attributes'};
> foreach my $att (@{$atts}) {
> $query->addAttribute($att);
> }
> my $segFilter = $self->{'BioMart'}->{'filters'}->[0]->new();#clone
> my $segTable = BioMart::AttributeTable->new();
> $segTable->addRow( [ $segment ] );
> $segFilter->setTable($segTable);
> $query->addFilter($segFilter);
>
> if ($segment_start && $segment_end) {
> my $startFilter =
> $self->{'BioMart'}->{'filters'}->[1]->new();#clone
> my $startTable = BioMart::AttributeTable->new();
> $startTable->addRow( [ $segment_start ] );
> $startFilter->setTable($startTable);
> $query->addFilter($startFilter);
>
> my $endFilter = $self->{'BioMart'}->{'filters'}->[2]->new();#clone
> my $endTable = BioMart::AttributeTable->new();
> $endTable->addRow( [ $segment_end ] );
> $endFilter->setTable($endTable);
> $query->addFilter($endFilter);
> }
>
> my $reqKeys = REQUIREDKEYS;
> my $defaults = DEFAULTS;
> my @features = ( );
>
> my $query_planner = BioMart::QueryPlanner->new();
>
> ### modified by EV ###
> my $rtable = $query_planner->getResultTable($query);
> #,
>
> #$self->{'BioMart'}->{'registry'},
> #undef,
> #INIT_BATCHSIZE);
>
>
> ROW: while ($rtable->hasMoreRows) {
> my $row = $rtable->nextRow;
>
> my $href = {};
>
> #skip this feature unless all keys in REQUIREDKEYS are defined
> my $good = 0;
> KEY: foreach my $reqKey (@{$reqKeys}) {
> my $pos = $self->{'BioMart'}->{'required_keys'}->{$reqKey};
> next KEY unless ($row->[$pos]);
> $good++;
> }
> next ROW unless($good);
>
> my $i = 0;
> while ($i < @{$row}) {
> my $key = $self->{'BioMart'}->{'feature_keys'}->[$i];
> $href->{$key} = $row->[$i] || $defaults->{$key}; #may be
> either default, or undef
> $i++;
> }
>
> push @features, $href;
> }
> return @features;
> }
>
> -----Original Message-----
> From: Arek Kasprzyk [mailto:[EMAIL PROTECTED]
> Sent: dinsdag 11 juli 2006 12:12
> To: Els Vanbleu
> Cc: [email protected]
> Subject: Re: Biomart as DAS server
>
>
> On 11 Jul 2006, at 08:28, Els Vanbleu wrote:
>
> > Dear all,
> >
> > We are trying to implement BioMart as DAS server. Therefore we
> > followed
> > the instructions as mentioned in the README file of the /das folder,
> > i.e. install ProServer, make an Importable/Exportable in the mart and
> > write a biomart.ini file. All dependencies were correctly established
> > and the ProServer was successfully launched using our biomart.ini file
> > (we get a pid.file and output is directed to a log.file).
> >
> > With the url (pidserver/das/dsn/) we retrieve the available data
> > sources
> > but when trying to catch some features (e.g.
> > pidserver/das/mymart1/features?segment=B0222.1), the system failed
> > (giving a source error).
> >
> > After intensive debugging, we already think we solved a few bugs,
> > namely
> > in the das/biomart.pm module
> >
> > use constant DEFAULTVSCHEMA => "defaultSchema";
> >
> > should be
> >
> > use constant DEFAULTVSCHEMA => "default";
> >
> > in order to have compliant virtualSchemas when no virtualSchema is
> > specifically set in the mart (and so the mart uses the 'default'
> > virtualSchema).
> >
> > Secondly, it turned out to us that the Location->getDatasetByName
> > method
> > was case sensitive (BioMart::Configuration::Location), so for our
> > purposes we made it case insensitive.
> >
> > sub getDatasetByName {
> > my ($self,$dataSetName) = @_;
> > $dataSetName = uc $dataSetName;
> > my $dataSetHash = $self->get('datasets');
> > my $dataSetEntry = $dataSetHash->{$dataSetName};
> > return $dataSetEntry;
> > }
> >
> > But still, no luck. The remaining error message now is:
> >
>
> Hi Els,
> DAS server functionality clearly slipped through
> our release testing procedure - apologies. You identified all the
> problems correctly.
> Let us investigate and we'll get back to you with the advice on this
> soon
>
> a.
>
>
>
> >
> > -------------------- EXCEPTION --------------------
> >
> > DATE: 10-JUL-2006
> >
> > MSG: You need to define virtual schema name in order to create a Query
> > object
> >
> > STACK BioMart::Query::_new
> > /var/www/biomart-web/biomart-plib//BioMart/Query.pm:92
> > STACK BioMart::RootI::new
> > /var/www/biomart-web/biomart-plib//BioMart/RootI.pm:54
> > STACK Bio::Das::ProServer::SourceAdaptor::biomart::build_features
> > ../lib/Bio/Das/ProServer/SourceAdaptor/biomart.pm:146
> > STACK (eval) ./proserver:467
> > STACK poeserver::client_got_request ./proserver:459
> > STACK (eval) ./proserver:357
> > STACK poeserver::__ANON__ ./proserver:357
> > STACK POE::Session::_invoke_state
> > /usr/lib/perl5/site_perl/5.8.0/POE/Session.pm:484
> > STACK POE::Kernel::call
> > /usr/lib/perl5/site_perl/5.8.0/POE/Kernel.pm:1656
> > STACK POE::Wheel::ReadWrite::__ANON__
> > /usr/lib/perl5/site_perl/5.8.0/POE/Wheel/ReadWrite.pm:309
> > STACK POE::Session::_invoke_state
> > /usr/lib/perl5/site_perl/5.8.0/POE/Session.pm:484
> > STACK (eval) /usr/lib/perl5/site_perl/5.8.0/POE/Kernel.pm:983
> > STACK POE::Kernel::_dispatch_event
> > /usr/lib/perl5/site_perl/5.8.0/POE/Kernel.pm:969
> > STACK POE::Kernel::_data_ev_dispatch_due
> > /usr/lib/perl5/site_perl/5.8.0/POE/Resource/Events.pm:256
> > STACK POE::Kernel::loop_do_timeslice
> > /usr/lib/perl5/site_perl/5.8.0/POE/Loop/Select.pm:315
> > STACK POE::Kernel::loop_run
> > /usr/lib/perl5/site_perl/5.8.0/POE/Loop/Select.pm:323
> > STACK POE::Kernel::run
> > /usr/lib/perl5/site_perl/5.8.0/POE/Kernel.pm:1218
> > STACK toplevel ./proserver:185
> >
> > -------------------------------------------
> >
> > at ../lib/Bio/Das/ProServer/SourceAdaptor/biomart.pm line 146
> >
> > It seems to us that the ProServer got stuck when applying the
> > das_features method from the Bio/Das/ProServer/SourceAdaptor.pm
> module.
> >
> > Can anyone still follow? Any ideas how to proceed?
> > Thanks in advance.
> >
> > Els Vanbleu
> >
> >
>
>
> ------------------------------------------------------------------------
>
> -------
> Arek Kasprzyk
> EMBL-European Bioinformatics Institute.
> Wellcome Trust Genome Campus, Hinxton,
> Cambridge CB10 1SD, UK.
> Tel: +44-(0)1223-494606
> Fax: +44-(0)1223-494468
> ------------------------------------------------------------------------
>
> -------
>
>
>
--
======================================
Syed Haider.
EMBL-European Bioinformatics Institute
Wellcome Trust Genome Campus, Hinxton,
Cambridge CB10 1SD, UK.
======================================