About a week ago I wrote describing a problem I was having with the CDS Glyph not rendering 6-frame translations when zoomed in closer than 500bp using a Chado database. I would see an error message: "Track rendering error: seq query failed"
The attached patch (also copied below)fixes the rendering problem using GBrowse 2.43 and a chado database.
Below is the code I have added to Bio/Graphics/Browser2/RenderPanels.pm
@@ -1754,7 +1754,15 @@
$groups{$l}{$id}->add_segment($feature);
next;
}
-
+ warn "[$$] \$segment->{feature_id} = $segment->{feature_id}" if DEBUG;
+ warn "[$$] \$segment->{srcfeature_id} = $segment->{srcfeature_id}" if DEBUG;
+ warn "[$$] \$feature->{feature_id} = $feature->{feature_id}" if DEBUG;
+ warn "[$$] \$feature->{srcfeature_id} = $feature->{srcfeature_id}" if DEBUG;
+ # Adding the following line prevents the following error:
+ # "DBD::Pg::st execute failed: ERROR: syntax error at end of input at character 92
+ # at /usr/local/lib/perl5/site_perl/5.8.8/Bio/DB/Das/Chado/Segment.pm line 1697."
+ # This allows rendering of CDS glyphs showing 3 or 6-frame translations when zoomed in.
+ $feature->{srcfeature_id} = $segment->{feature_id}; ### This is really the only line of code I've added.
$track->add_feature($feature);
Would you be able to review the above patch for appropriateness of placement?
I have also added a STACK trace from my apache error log that may be useful in validating where this bug propagates from.
I believe that the reason that the Postgres query fails is because in Bio::DB::Das::Chado::Segment in the dna method, $feat_id does not get a value since the 'srcfeature_id' was never set.
my $feat_id = $self->{srcfeature_id};
Hence when the database query is prepared to retrieve the dna sequence as below, since $feat_id is null/empty, the SQL query fails and GBrowse2 is unable to access the sequence to render the zoomed in CDS glyph.
$sth = $self->factory->dbh->prepare("
select substring(residues from $base_start for $sslen) from feature
where feature_id = $feat_id ");
I hope this fixes the bug.
I inadvertantly chopped of the name of the original reporter and fixer: Razi Khaja.
Thank you Razi.