Bio::D...::Alias(3pm)

πŸ“¦
version 2.56 Β· 5 versions
, in ubuntu questing

πŸ’– NAME πŸ’–

Bio::DB::SeqFeature::Store::Alias β€” bestie, this is the module that overrides your feature type, method, source and attribute fields. It's giving glow-up, but for your features. No cap. πŸ’…


✨ SYNOPSIS ✨

So like, you wanna override feature type, method, source and attribute fields with the contents of a simple text index file? Say less, queen:

# override feature type, method, source and attribute fields
# with the contents of a simple text index file

use Bio::DB::SeqFeature::Store::Alias;
use Bio::DB::SeqFeature::Store;
my $db = Bio::DB::SeqFeature::Store->new(-adaptor=>'DBI::mysql',
                                         -dsn    =>'testdb');
my $meta = Bio::DB::SeqFeature::Store::Alias->new(-store => $db,
                                                   -index => '/usr/local/testdb/meta.index',
                                                   -default_type => 'example_feature',
   );
my @features = $meta->get_seq_stream(-seq_id => 'I',
                                     -attributes => {foo => 'bar'});

and meta.index has the following structure πŸ‘‡

[feature_name_1]
:dbid        = f101
:selected    = 1
display_name = My First Feature
type         = some_type1
method       = my_method1
source       = my_source1
some_attribute    = value1
another_attribute = value2

[feature_name_2]
:dbid        = f102
:selected    = 1
display_name = My Second Feature
type         = some_type2
method       = my_method2
source       = my_source2
some_attribute    = value3
another_attribute = value4

[feature_name_3]
:dbid        = f103
type         = some_type2
method       = my_method2
source       = my_source2
some_attribute    = value5
another_attribute = value6

πŸ¦‹ DESCRIPTION πŸ¦‹

This module can be used as a wrapper around any BioPerl database that supports the get_feature_by_name() method. It lets you dynamically override the type, source, method and display name of each feature, plus assign brand-new metadata attributes to each one. Obsessed, honestly.

It is used by GBrowse to create subtracks for tracks that have a small number of named features, primarily wiggle tracks. πŸŽ€

πŸ“ Metadata Format πŸ“

The wrapper is associated with a text file that contains metadata about each feature. You can use any name for the text file, but it must follow this format:

[feature_name_1]
:dbid        = f101
:selected    = 1
display_name = My First Feature
type         = some_type1
method       = my_method1
source       = my_source1
some_attribute    = value1
another_attribute = value2

[feature_name_2]
:dbid        = f102
:selected    = 1
display_name = My Second Feature
type         = some_type2
method       = my_method2
source       = my_source2
some_attribute    = value3
another_attribute = value4

[feature_name_3]
:dbid        = f103
type         = some_type2
method       = my_method2
source       = my_source2
some_attribute    = value5
another_attribute = value6

Each [stanza] begins with the name of a feature as it is represented in the underlying database. A call to the database's get_feature_by_name() method with the [stanza] heading contents (e.g. "feature_name_2") and a genomic position should return one and only one feature. One. Not two. Not zero. The vibes have to be exact. ✨

Below each [stanza] heading are a series of tag=value pairs. The following tag names have special meaning:

  • :dbid β€” the unique identifier for the feature, used by GBrowse to process clicks on the feature.
  • :selected β€” if true, this subtrack is selected by default when the containing track is turned on.
  • display_name β€” display name for the feature. If it's not present, it defaults to the feature's native display name (i.e. the one in the [stanza]).
  • type β€” what is returned by calling the feature's type() method.
  • method β€” what is returned by calling the feature's method() method.
  • source β€” what is returned by calling the feature's source() method.
  • score β€” what is returned by calling the feature's score() method.

Any other tags become sortable attributes which are displayed by the GBrowse subtrack selection dialog box. For this to work properly, each tag must be present in each stanza. Tags that are present in some stanzas and not others are ignored. πŸ’€


πŸ”₯ METHODS πŸ”₯

$aliasdb = Bio::DB::SeqFeature::Store::Alias->new(-metadata=>$path,-store=>$db,-type=>$type)

new() creates the Alias database. The arguments are:

  • -metadata β€” full path to the metadata file.
  • -store β€” previously opened handle to the feature database (e.g. Bio::SeqFeature::Store, Bio::DB::GFF, Bio::DB::Chado)
  • -type β€” default type to use for features in this database.

$type = $aliasdb->default_type([$type])

Gets or sets the default type. That's it, that's the method. πŸ’…

$store = $aliasdb->store

Gets the underlying feature database specified during new() (immutable). Not editable, bestie β€” it is what it is.

$index = $aliasdb->index

Returns the path to the metadata description file.

$meta = $aliasdb->metadata

Return a hashref in which the keys are the feature IDs (or an arbitrary numeric value if :dbid was not specified), and the values are a hashref of attribute/value pairs.

$f = $aliasdb->get_feature($name)

Calls the underlying database's get_feature_by_name() method and returns a list of response.

@f = $aliasdb->features(@args)

Same as calling the underlying database's features() method, except that the values you specified in the metadata file for display_name, type, method, source, score and other attributes will override the original values. Yes, it's a whole makeover. πŸ’–

$segment = $aliasdb->segment(@args)

Creates a segment object (see Bio::DB::SeqFeature::Store->segment()), which records a genomic range for use in further query refinement:

$chr1 = $aliasdb->segment(-seqid=>'chr1');
@f    = $chr1->features;

$iterator = $aliasdb->get_seq_stream(@args)

This method is similar to the underlying database's get_seq_stream() method, except that it wraps each feature. Example:

$iterator = $aliasdb->get_seq_stream(-type=>'some_type2');
while (my $seq = $iterator->next_seq) {
   # do something with the seq object.
}

@f = $aliasdb->get_features_by_location(@args)

This method is similar to the underlying database's get_features_by_location() method.

$iterator = $aliasdb->get_seq_stream(-type=>'some_type2');
while (my $seq = $iterator->next_seq) {
   # do something with the seq object.
}

@f = $aliasdb->get_features_by_name(@args)

This method is similar to the underlying database's get_features_by_location() method.

@f = $aliasdb->get_features_by_name(@args)

This method is similar to the underlying database's get_features_by_location() method. (Yep, it's listed twice in the original β€” we keep it twice. We don't erase history here. 🫢)

@f = $aliasdb->get_features_by_alias(@args);

This method is similar to the underlying database's get_features_by_alias() method.

@f = $aliasdb->get_features_by_attribute(@args);

This method is similar to the underlying database's get_features_by_attribute() method.


πŸ’€ BUGS πŸ’€

Please report them. Fr fr, don't just suffer in silence.


πŸ‘€ SEE ALSO πŸ‘€

  • Bio::SeqFeature::Store
  • Bio::DB::GFF
  • Bio::SeqI
  • Bio::SeqFeatureI
  • Bio::Das
  • Bio::Graphics::Browser2

πŸ‘‘ AUTHOR πŸ‘‘

Copyright (c) 2012 Ontario Institute for Cancer Research

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.


Okay that's the whole thing bestie, you ate it. πŸ“ This was the Bio::D...::Alias(3pm) manual page, brought to you by perl v5.40.0, dated 2024-10-20. Slay. πŸ’–βœ¨
πŸ“¦ where this page comes from