From ea3d175eec068b62d3fdf9adbddc13375def384b Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Thu, 22 Sep 2011 16:20:31 -0700 Subject: [PATCH] Attempt to get closer to actually grabbing useful sequence info about a gene --- lib/SGN/Controller/Bulk.pm | 13 +++++++++++++ t/integration/bulk_gene.t | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/SGN/Controller/Bulk.pm b/lib/SGN/Controller/Bulk.pm index a49032d46..72fd9e410 100644 --- a/lib/SGN/Controller/Bulk.pm +++ b/lib/SGN/Controller/Bulk.pm @@ -129,6 +129,19 @@ sub bulk_gene_submit :Path('/bulk/gene/submit') :Args(0) { unless ($ids) { $c->throw_client_error(public_message => 'At least one identifier must be given'); } + + # TODO: this doesn't scale. Use a single OR clause? + for my $gene_id (split /\s+/, $ids) { + my $matching_features = $c->dbic_schema('Bio::Chado::Schema', 'sgn_chado') + ->resultset('Sequence::Feature') + ->search({ "me.name" => $gene_id },{ + prefetch => [ 'type', 'featureloc_features' ], + }); + my $f = $matching_features->next; + my @mrnas = grep $_->type->name eq 'mRNA', $f->child_features; + $c->stash->{sequence_identifiers} = [ map { $_->name } @mrnas ]; + } + $c->stash( bulk_download_success => 0 ); $c->stash( bulk_download_stats => 'Foo' ); $c->stash( sha1 => 'deadbeef' ); diff --git a/t/integration/bulk_gene.t b/t/integration/bulk_gene.t index 2fffb2a37..20b9b47ed 100644 --- a/t/integration/bulk_gene.t +++ b/t/integration/bulk_gene.t @@ -24,6 +24,6 @@ $mech->with_test_level( local => sub { ids => "Solyc02g081670.1", }, }, "submit bulk_gene with a single valid identifier"); - $mech->content_unlike(qr/Caught exception/); + $mech->content_unlike(qr/Caught exception/) or diag $mech->content; $mech->content_unlike(qr/Your query did not contain any valid identifiers/) or diag $mech->content; }); -- 2.11.4.GIT