The problem with this method (it works fine though) is that it needs to get all the genes which will take up a lot of memory.<br>An alternative way of doing this is to use the db connection itself and use this to query the database directly only getting those genes you want..<br>
Here is an example:-<br>-----------------------------------------------------------------------------------------------------------------<br>use Bio::EnsEMBL::Registry;<br>use Bio::SeqIO;<br>use strict;<br>my $reg = "Bio::EnsEMBL::Registry";<br>
<br>my $species = "human";<br>my $search_str = "%breast cancer%";<br><br>$reg->load_registry_from_db(    <br>    -host => '<a href="http://ensembldb.ensembl.org">ensembldb.ensembl.org</a>',<br>
    -user => 'anonymous');<br><br>my $core_ga = $reg->get_adaptor($species,"core","gene");<br><br><br>my $sql = 'Select gene_id from gene where description like ?';<br>my $sth = $core_ga->dbc->prepare($sql) || die "Could not prepare $sql for core database";<br>
$sth->execute($search_str) or croak( $core_ga->dbc->errstr() );<br><br>while (my $gene_id = $sth->fetchrow_array()){<br>  my $gene = $core_ga->fetch_by_dbID($gene_id);<br>  print $gene->stable_id."\t".$gene->description."\n";<br>
}<br>-----------------------------------------------------------------------------------------------------------------<br><br><br><br><br><br><br><br><div class="gmail_quote">On Wed, Feb 13, 2013 at 11:09 AM, Adam Witney <span dir="ltr"><<a href="mailto:awitney@sgul.ac.uk" target="_blank">awitney@sgul.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Thanks Andy, in the meantime, I just realised, of course I can just do this:<br>
<br>
my $genes = $dba->get_GeneAdaptor()-><u></u>fetch_all();<br>
        <br>
foreach my $gene ( @{$genes} ) {        <br>
        if ( $gene->description && $gene->description =~ m/$string/ ) {<br>
                # do stuff<br>
        }<br>
}<br>
<br>
Thanks again<span class="HOEnZb"><font color="#888888"><br>
<br>
Adam</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On 13/02/2013 10:30, Andy Yates wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Adam,<br>
<br>
Currently we do not support this. The actual code which implements this search is in the DBEntryAdaptor and would require edits in there. I can see a point in having this kind of functionality so we will put it on our to-do list.<br>

<br>
Andy<br>
<br>
On 13 Feb 2013, at 10:24, Adam Witney <<a href="mailto:awitney@sgul.ac.uk" target="_blank">awitney@sgul.ac.uk</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Hi,<br>
<br>
Is there a method to search the Gene description field. I am currently using fetch_all_by_external_name, but this only works if the gene has been annotated with gyrA:<br>
<br>
my $genes = $dba->get_GeneAdaptor()-><u></u>fetch_all_by_external_name('<u></u>gyrA');<br>
<br>
What I would like to be able to do is search the data returned by the description method ($gene->description), is this possible? eg something like this:<br>
<br>
my $genes = $dba->get_GeneAdaptor()-><u></u>fetch_all_by_description('%<u></u>gyrase%');<br>
<br>
Thanks<br>
<br>
Adam<br>
<br>
______________________________<u></u>_________________<br>
Dev mailing list    <a href="mailto:Dev@ensembl.org" target="_blank">Dev@ensembl.org</a><br>
Posting guidelines and subscribe/unsubscribe info: <a href="http://lists.ensembl.org/mailman/listinfo/dev" target="_blank">http://lists.ensembl.org/<u></u>mailman/listinfo/dev</a><br>
Ensembl Blog: <a href="http://www.ensembl.info/" target="_blank">http://www.ensembl.info/</a><br>
</blockquote>
<br>
<br>
______________________________<u></u>_________________<br>
Dev mailing list    <a href="mailto:Dev@ensembl.org" target="_blank">Dev@ensembl.org</a><br>
Posting guidelines and subscribe/unsubscribe info: <a href="http://lists.ensembl.org/mailman/listinfo/dev" target="_blank">http://lists.ensembl.org/<u></u>mailman/listinfo/dev</a><br>
Ensembl Blog: <a href="http://www.ensembl.info/" target="_blank">http://www.ensembl.info/</a><br>
<br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
Dev mailing list    <a href="mailto:Dev@ensembl.org" target="_blank">Dev@ensembl.org</a><br>
Posting guidelines and subscribe/unsubscribe info: <a href="http://lists.ensembl.org/mailman/listinfo/dev" target="_blank">http://lists.ensembl.org/<u></u>mailman/listinfo/dev</a><br>
Ensembl Blog: <a href="http://www.ensembl.info/" target="_blank">http://www.ensembl.info/</a><br>
</div></div></blockquote></div><br>