| Summary | Included libraries | Package variables | Synopsis | Description | General documentation | Methods |
use Bio::DB::SeqFeature::Store;
# Open the sequence database
my $db = Bio::DB::SeqFeature::Store->new( -adaptor => 'DBI::mysql',
-dsn => 'dbi:mysql:test');
my $segment = $db->segment('Chr1',5000=>6000);
my @features = $segment->features('mRNA','match');
@features = $db->features(-seq_id=>'Chr1',with these statements:
-start=>5000,
-end=>6000,
-types=>['mRNA','match','repeat_region']);
$segment = $db->segment('Chr1',5000=>6000);
@features = $segment->features('mRNA','match','repeat_region');
You can also initialize a segment from an existing SeqFeature$segment = Bio::DB::SeqFeature::Segment->new($feature); # for Bio::DB::SeqFeatureThe segment object implements the full Bio::SeqFeature::CollectionI
$segment = Bio::DB::SeqFeature::Segment->new($feature,$store); # for other Bio::SeqFeatureI objects
| new | Description | Code |
| features | Description | Code |
| types | No description | Code |
| get_seq_stream | Description | Code |
| factory | No description | Code |
| store | Description | Code |
| type | No description | Code |
| as_string | Description | Code |
| rel2abs | Description | Code |
| abs2rel | Description | Code |
| start | No description | Code |
| end | No description | Code |
| seq_id | No description | Code |
| strand | No description | Code |
| ref | No description | Code |
| length | No description | Code |
| source_tag | No description | Code |
| display_name | No description | Code |
| name | No description | Code |
| class | No description | Code |
| abs_ref | No description | Code |
| abs_start | No description | Code |
| abs_end | No description | Code |
| abs_strand | No description | Code |
| get_SeqFeatures | No description | Code |
| get_all_tags | No description | Code |
| get_tag_values | No description | Code |
| add_tag_value | No description | Code |
| remove_tag | No description | Code |
| has_tag | No description | Code |
| seq | No description | Code |
| subseq | No description | Code |
| dna | No description | Code |
| entire_seq | No description | Code |
| location | No description | Code |
| primary_id | No description | Code |
| score | No description | Code |
| stop | No description | Code |
| absolute | No description | Code |
| desc | No description | Code |
| display_id | No description | Code |
| primary_seq | No description | Code |
| accession_number | No description | Code |
| new | code | next | Top |
Title : newThis class method creates a Bio::DB::SeqFeature::Segment object. You must provide a Bio::DB::SeqFeature::Store as well as the coordinates of the segment. These arguments can be provided explicitly or indirectly. First form: $segment = Bio::DB::SeqFeature::Segment->new($store,$seqid,$start,$end,$strand)In this form a segment is defined by a Bio::DB::SeqFeature::Store, the sequence ID, the start, end and strand. This is the form that is invoked internally by Bio::DB::SeqFeature::Store when you call its segment() method. Second form: $segment = Bio::DB::SeqFeature::Segment->new($seqfeature [,$store]);In this form, you pass new() a Bio::SeqFeatureI object. The segment is constructed from the seq_id and coordinates are taken from the object. If you pass a store-aware seqfeature object (e.g. Bio::DB::SeqFeature) then the store database is also derived from the feature. Otherwise you will have to pass the store as a second argument. |
| features | code | prev | next | Top |
Title : featuresThis is the workhorse for feature query and retrieval. It takes a series of -name=>$value arguments filter arguments. Features that match all the filters are returned. Argument ValueThis is identical to the Bio::DB::SeqFeature::Store->features() method, except that the -seq_id, -start, and -end arguments are provided by the segment object. If a simple list of arguments is provided, then the list is taken to be the set of feature types (primary tags) to filter on. Examples: All features that overlap the current segment: @features = $segment->features;All features of type mRNA that overlap the current segment: @features = $segment->features('mRNA');All features that are completely contained within the current segment:@features = $segment->features(-range_type=>'contains');All "confirmed" mRNAs that overlap the current segment: @features = $segment->features(-attributes=>{confirmed=>1},-type=>'mRNA'); |
| get_seq_stream | code | prev | next | Top |
Title : get_seq_streamThis is identical to Bio::DB::SeqFeature::Store->get_seq_stream() except that the location filter is always automatically applied so that the iterator you receive returns features that overlap the segment's region. When called without any arguments this method will return an iterator object that will traverse all indexed features in the database that overlap the segment's region. Call the iterator's next_seq() method to step through them (in no particular order): my $iterator = $db->get_seq_stream;You can select a subset of features by passing a series of filter arguments. The arguments are identical to those accepted by $segment->features(). get_feature_stream() ican be used as a synonym for this method. |
| store | code | prev | next | Top |
Title : store |
| as_string | code | prev | next | Top |
Title : as_stringThe as_string() method is overloaded into the "" operator so that the object is represented as a human readable string in the form "seq_id:start..end" when used in a string context. |
| rel2abs | code | prev | next | Top |
Title : rel2absThis function takes a list of positions in relative coordinates to the segment, and converts them into absolute coordinates. |
| abs2rel | code | prev | next | Top |
Title : abs2relThis function takes a list of positions in absolute coordinates and returns a list expressed in relative coordinates. |
| new | description | prev | next | Top |
my $class = shift; my ($store,$seqid,$start,$end,$strand); if (ref $_[0] && UNIVERSAL::isa($_[0],'Bio::SeqFeatureI')) { my $seqfeature = shift; $store = shift; $store ||= eval {$seqfeature->object_store}; $class->throw("I could not derive the Bio::DB::SeqFeature::Store object from the arguments passed to Bio::DB::SeqFeature::Segment->new(). Please pass the Store object as the second argument") unless $store; $seqid = $seqfeature->seq_id; $start = $seqfeature->start; $end = $seqfeature->end; $strand= $seqfeature->strand; } else { ($store,$seqid,$start,$end,$strand) = @_; } return bless { store => $store, seqid => $seqid, start => $start, end => $end, strand => $strand, },ref($class) || $class;}
| features | description | prev | next | Top |
my $self = shift; my @args; if (@_ == 0) { @args = (); } elsif ($_[0] !~/^-/) { my @types = @_; @args = (-type=>\@types); } else { @args = @_; } $self->{store}->features(@args,-seqid=>$self->{seqid},-start=>$self->{start},-end=>$self->{end});}
| types | description | prev | next | Top |
my $self = shift; my %types; my $iterator = $self->get_seq_stream(@_); while (my $f = $iterator->next_seq) { $types{$f->type}++; } return %types;}
| get_seq_stream | description | prev | next | Top |
my $self = shift; $self->{store}->get_seq_stream(@_,-seqid=>$self->{seqid},-start=>$self->{start},-end=>$self->{end});}
| factory | description | prev | next | Top |
shift->{store}}
| store | description | prev | next | Top |
shift->{store}}
| type | description | prev | next | Top |
shift->primary_tag}
| as_string | description | prev | next | Top |
my $self = shift; my $label = $self->seq_id; my $start = $self->start || ''; my $end = $self->end || ''; return "$label:$start..$end";}
| rel2abs | description | prev | next | Top |
my $self = shift; my @result; my ($start,$strand) = ($self->start,$self->strand); @result = $strand < 0 ? map { $start - $_ + 1 } @_ : map { $_ + $start - 1 } @_; # if called with a single argument, caller will expect a single scalar reply}
# not the size of the returned array!
return $result[0] if @result == 1 and !wantarray; @result;
| abs2rel | description | prev | next | Top |
my $self = shift; my @result; my ($start,$strand) = ($self->start,$self->abs_strand); @result = $strand < 0 ? map { $start - $_ + 1 } @_ : map { $_ - $start + 1 } @_; # if called with a single argument, caller will expect a single scalar reply}
# not the size of the returned array!
return $result[0] if @result == 1 and !wantarray; @result;
| start | description | prev | next | Top |
shift->{start}}
| end | description | prev | next | Top |
shift->{end}}
| seq_id | description | prev | next | Top |
shift->{seqid}}
| strand | description | prev | next | Top |
shift->{strand}}
| ref | description | prev | next | Top |
shift->seq_id}
| length | description | prev | next | Top |
my $self = shift; return abs($self->end - $self->start) +1;}
| source_tag | description | prev | next | Top |
__PACKAGE__}
| display_name | description | prev | next | Top |
shift->as_string}
| name | description | prev | next | Top |
shift->display_name}
| class | description | prev | next | Top |
'region'}| abs_ref | description | prev | next | Top |
shift->ref}
| abs_start | description | prev | next | Top |
shift->start}
| abs_end | description | prev | next | Top |
shift->end}
| abs_strand | description | prev | next | Top |
shift->strand}
| get_SeqFeatures | description | prev | next | Top |
| get_all_tags | description | prev | next | Top |
| get_tag_values | description | prev | next | Top |
| add_tag_value | description | prev | next | Top |
| remove_tag | description | prev | next | Top |
| has_tag | description | prev | next | Top |
| seq | description | prev | next | Top |
my $self = shift; require Bio::PrimarySeq unless Bio::PrimarySeq->can('new'); my ($start,$end) = ($self->start,$self->end); if ($self->strand < 0) { ($start,$end) = ($end,$start); } return Bio::PrimarySeq->new( -seq => $self->store->fetch_sequence($self->seq_id,$start,$end), -id => $self->display_name);}
| subseq | description | prev | next | Top |
my $self = shift; my ($newstart,$newstop) = @_; my $store = $self->store or return; my $seq = $store->fetch_sequence($self->seq_id,$self->start+$newstart-1,$self->end+$newstop-1); return Bio::PrimarySeq->new(-seq=>$seq);}
| dna | description | prev | next | Top |
my $seq = shift->seq; $seq = $seq->seq if CORE::ref($seq); return $seq;}
| entire_seq | description | prev | next | Top |
my $self = shift; require Bio::PrimarySeq unless Bio::PrimarySeq->can('new'); return Bio::PrimarySeq->new( -seq => $self->store->fetch_sequence($self->seq_id), -id => $self->seq_id);}
| location | description | prev | next | Top |
my $self = shift; require Bio::Location::Simple unless Bio::Location::Simple->can('new'); my $loc = Bio::Location::Simple->new(-start => $self->start, -end => $self->end, -strand => $self->strand); $loc->strand($self->strand); warn("strand will be ", $self->strand, "\n") if $self->strand < 0; return $loc;}
| primary_id | description | prev | next | Top |
my $self = shift; my $d = $self->{primary_id}; $self->{primary_id} = shift if @_; $d;}
| score | description | prev | next | Top |
return}| stop | description | prev | next | Top |
shift->end}
| absolute | description | prev | next | Top |
return 1}| desc | description | prev | next | Top |
shift->as_string}
| display_id | description | prev | next | Top |
shift->display_name}
| primary_seq | description | prev | next | Top |
shift->seq}
| accession_number | description | prev | next | Top |
return undef } # intended return undef}
| PUBLIC METHODS | Top |
| primary_tag, type, | Top |
Title : primary_tag,typeThe primary_tag method returns the constant tag "region". type() is a
Usage : $primary_tag = $segment->primary_tag
Function: returns the string "region"
Returns : "region"
Args : none
Status : public
| Bio::SeqFeatureI compatibility methods | Top |
| BUGS | Top |
| SEE ALSO | Top |
| AUTHOR | Top |