[ensembl-dev] Enumerating repeat types for get_all_RepeatFeatures()

Andy Yates ayates at ebi.ac.uk
Mon Jan 16 19:51:23 GMT 2012


Hi John,

It seems like a fair request for enhancement. I've added the method into the repeat consensus adaptor & altered the repeat feature API to limit by more than one type at the same time. See what you think about them.

Andy

p.s. If you want to do any SQL queries you may want to look at the SqlHelper class. It's available from any DBConnection object and compresses queries like the one you sent into:

my $types = $dbc->sql_helper()->execute_simple(-SQL => 'SELECT DISTINCT repeat_type FROM repeat_consensus');

On 16 Jan 2012, at 14:14, John Marshall wrote:

> I recently noticed from the documentation that Bio::EnsEMBL::Slice::get_all_RepeatFeatures() can optionally take a repeat type argument to limit the types of repeat feature returned:
> 
> 	Example: @repeat_feats = @{$slice->get_all_RepeatFeatures(undef,'LTR')};
> 
> This is very convenient for one of my scripts, which, for any requested species, dumps out a selection of repeat features arranged by type.  However there doesn't appear to be a way to enumerate all the extant repeat types for a given species -- while the type names appear to be fairly standardised, some species are missing a few of them and I wouldn't want to assume that I had seen all possibilities.
> 
> I solved this in my script with the following hackish function:
> 
> # Returns the set of all types of repeat features in $adaptor's species.
> sub fetch_all_repeat_types {
>  my ($adaptor) = @_;
> 
>  my ($sth, @types, $repeat_type);
>  $sth = $adaptor->prepare("SELECT DISTINCT repeat_type FROM repeat_consensus");
>  $sth->execute();
>  $sth->bind_columns(\$repeat_type);
>  while ($sth->fetch()) { push @types, $repeat_type }
>  return @types;
> }
> 
> but of course this makes the script susceptible to schema changes, and ideally such a function would instead be available as Bio::EnsEMBL::DBSQL::RepeatConsensusAdaptor::fetch_all_repeat_types() or similar.  (Admittedly this is probably opening a can of worms as there may well be many other items that could use similar enumeration functions...)
> 
> Any thoughts as to the right way to do this?
> 
> Thanks,
> 
>    John
> _______________________________________________
> Dev mailing list    Dev at ensembl.org
> List admin (including subscribe/unsubscribe): http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/

---
Andrew Yates                   Ensembl Core Software Project Leader
EMBL-EBI                       Tel: +44-(0)1223-492538
Wellcome Trust Genome Campus   Fax: +44-(0)1223-494468
Cambridge CB10 1SD, UK         http://www.ensembl.org/





More information about the Dev mailing list