/usr/share/perl5/Bio/Das/SegmentI.pm is in libbio-perl-perl 1.6.923-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | #
# BioPerl module for Bio::Das::SegmentI
#
# Please direct questions and support issues to <bioperl-l@bioperl.org>
#
# Cared for by Lincoln Stein <lstein@cshl.org>
#
# Copyright Lincoln Stein
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::Das::SegmentI - DAS-style access to a feature database
=head1 SYNOPSIS
# Get a Bio::Das::SegmentI object from a Bio::DasI database...
$segment = $das->segment(-name=>'Landmark',
-start=>$start,
-end => $end);
@features = $segment->overlapping_features(-type=>['type1','type2']);
# each feature is a Bio::SeqFeatureI-compliant object
@features = $segment->contained_features(-type=>['type1','type2']);
@features = $segment->contained_in(-type=>['type1','type2']);
$stream = $segment->get_feature_stream(-type=>['type1','type2','type3'];
while (my $feature = $stream->next_seq) {
# do something with feature
}
$count = $segment->features_callback(-type=>['type1','type2','type3'],
-callback => sub { ... { }
);
=head1 DESCRIPTION
Bio::Das::SegmentI is a simplified alternative interface to sequence
annotation databases used by the distributed annotation system. In
this scheme, the genome is represented as a series of landmarks. Each
Bio::Das::SegmentI object ("segment") corresponds to a genomic region
defined by a landmark and a start and end position relative to that
landmark. A segment is created using the Bio::DasI segment() method.
Features can be filtered by the following attributes:
1) their location relative to the segment (whether overlapping,
contained within, or completely containing)
2) their type
3) other attributes using tag/value semantics
Access to the feature list uses three distinct APIs:
1) fetching entire list of features at a time
2) fetching an iterator across features
3) a callback
=head1 FEEDBACK
=head2 Mailing Lists
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated.
bioperl-l@bio.perl.org
=head2 Support
Please direct usage questions or support issues to the mailing list:
I<bioperl-l@bioperl.org>
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
=head2 Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via the
web:
https://redmine.open-bio.org/projects/bioperl/
=head1 AUTHOR - Lincoln Stein
Email lstein@cshl.org
=head1 APPENDIX
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _
=cut
#'
# Let the code begin...
package Bio::Das::SegmentI;
use strict;
# Object preamble - inherits from Bio::Root::RootI;
use base qw(Bio::Root::RootI);
=head2 seq_id
Title : seq_id
Usage : $ref = $s->seq_id
Function: return the ID of the landmark
Returns : a string
Args : none
Status : Public
=cut
sub seq_id { shift->throw_not_implemented }
=head2 display_name
Title : seq_name
Usage : $ref = $s->seq_name
Function: return the human-readable name for the landmark
Returns : a string
Args : none
Status : Public
This defaults to the same as seq_id.
=cut
sub display_name { shift->seq_id }
=head2 start
Title : start
Usage : $s->start
Function: start of segment
Returns : integer
Args : none
Status : Public
This is a read-only accessor for the start of the segment. Alias
to low() for Gadfly compatibility.
=cut
sub start { shift->throw_not_implemented }
sub low { shift->start }
=head2 end
Title : end
Usage : $s->end
Function: end of segment
Returns : integer
Args : none
Status : Public
This is a read-only accessor for the end of the segment. Alias to
high() for Gadfly compatibility.
=cut
sub end { shift->throw_not_implemented }
sub stop { shift->end }
sub high { shift->end }
=head2 length
Title : length
Usage : $s->length
Function: length of segment
Returns : integer
Args : none
Status : Public
Returns the length of the segment. Always a positive number.
=cut
sub length { shift->throw_not_implemented; }
=head2 seq
Title : seq
Usage : $s->seq
Function: get the sequence string for this segment
Returns : a string
Args : none
Status : Public
Returns the sequence for this segment as a simple string.
=cut
sub seq {shift->throw_not_implemented}
=head2 ref
Title : ref
Usage : $ref = $s->ref([$newlandmark])
Function: get/set the reference landmark for addressing
Returns : a string
Args : none
Status : Public
This method is used to examine/change the reference landmark used to
establish the coordinate system. By default, the landmark cannot be
changed and therefore this has the same effect as seq_id(). The new
landmark might be an ID, or another Das::SegmentI object.
=cut
sub ref { shift->seq_id }
*refseq = \&ref;
=head2 absolute
Title : absolute
Usage : $s->absolute([$new_value])
Function: get/set absolute addressing mode
Returns : flag
Args : new flag (optional)
Status : Public
Turn on and off absolute-addressing mode. In absolute addressing
mode, coordinates are relative to some underlying "top level"
coordinate system (such as a chromosome). ref() returns the identity
of the top level landmark, and start() and end() return locations
relative to that landmark. In relative addressing mode, coordinates
are relative to the landmark sequence specified at the time of segment
creation or later modified by the ref() method.
The default is to return false and to do nothing in response to
attempts to set absolute addressing mode.
=cut
sub absolute { return }
=head2 features
Title : features
Usage : @features = $s->features(@args)
Function: get features that overlap this segment
Returns : a list of Bio::SeqFeatureI objects
Args : see below
Status : Public
This method will find all features that intersect the segment in a
variety of ways and return a list of Bio::SeqFeatureI objects. The
feature locations will use coordinates relative to the reference
sequence in effect at the time that features() was called.
The returned list can be limited to certain types, attributes or
range intersection modes. Types of range intersection are one of:
"overlaps" the default
"contains" return features completely contained within the segment
"contained_in" return features that completely contain the segment
Two types of argument lists are accepted. In the positional argument
form, the arguments are treated as a list of feature types. In the
named parameter form, the arguments are a series of -name=E<gt>value
pairs.
Argument Description
-------- ------------
-types An array reference to type names in the format
"method:source"
-attributes A hashref containing a set of attributes to match
-rangetype One of "overlaps", "contains", or "contained_in".
-iterator Return an iterator across the features.
-callback A callback to invoke on each feature
The -attributes argument is a hashref containing one or more
attributes to match against:
-attributes => { Gene => 'abc-1',
Note => 'confirmed' }
Attribute matching is simple string matching, and multiple attributes
are ANDed together. More complex filtering can be performed using the
-callback option (see below).
If -iterator is true, then the method returns an object reference that
implements the next_seq() method. Each call to next_seq() returns a
new Bio::SeqFeatureI object.
If -callback is passed a code reference, the code reference will be
invoked on each feature returned. The code will be passed two
arguments consisting of the current feature and the segment object
itself, and must return a true value. If the code returns a false
value, feature retrieval will be aborted.
-callback and -iterator are mutually exclusive options. If -iterator
is defined, then -callback is ignored.
NOTE: the following methods all build on top of features(), and do not
need to be explicitly implemented.
overlapping_features()
contained_features()
contained_in()
get_feature_stream()
=cut
sub features {shift->throw_not_implemented}
=head2 overlapping_features
Title : overlapping_features
Usage : @features = $s->overlapping_features(@args)
Function: get features that overlap this segment
Returns : a list of Bio::SeqFeatureI objects
Args : see below
Status : Public
This method is identical to features() except that it defaults to
finding overlapping features.
=cut
sub overlapping_features {
my $self = shift;
my @args = $_[0] =~ /^-/ ? (@_, -rangetype=>'overlaps')
: (-types=>\@_,-rangetype=>'overlaps');
$self->features(@args);
}
=head2 contained_features
Title : contained_features
Usage : @features = $s->contained_features(@args)
Function: get features that are contained in this segment
Returns : a list of Bio::SeqFeatureI objects
Args : see below
Status : Public
This method is identical to features() except that it defaults to
a range type of 'contained'.
=cut
sub contained_features {
my $self = shift;
my @args = $_[0] =~ /^-/ ? (@_, -rangetype=>'contained')
: (-types=>\@_,-rangetype=>'contained');
$self->features(@args);
}
=head2 contained_in
Title : contained_in
Usage : @features = $s->contained_in(@args)
Function: get features that contain this segment
Returns : a list of Bio::SeqFeatureI objects
Args : see below
Status : Public
This method is identical to features() except that it defaults to
a range type of 'contained_in'.
=cut
sub contained_in {
my $self = shift;
my @args = $_[0] =~ /^-/ ? (@_, -rangetype=>'contained_in')
: (-types=>\@_,-rangetype=>'contained_in');
$self->features(@args);
}
=head2 get_feature_stream
Title : get_feature_stream
Usage : $iterator = $s->get_feature_stream(@args)
Function: get an iterator across the segment
Returns : an object that implements next_seq()
Args : see below
Status : Public
This method is identical to features() except that it always generates
an iterator.
NOTE: This is defined in the interface in terms of features(). You do not
have to implement it.
=cut
sub get_feature_stream {
my $self = shift;
my @args = defined $_[0] && $_[0] =~ /^-/ ? (@_, -iterator=>1)
: (-types=>\@_,-iterator=>1);
$self->features(@args);
}
=head2 factory
Title : factory
Usage : $factory = $s->factory
Function: return the segment factory
Returns : a Bio::DasI object
Args : see below
Status : Public
This method returns a Bio::DasI object that can be used to fetch
more segments. This is typically the Bio::DasI object from which
the segment was originally generated.
=cut
#'
sub factory {shift->throw_not_implemented}
=head2 primary_tag
Title : primary_tag
Usage : $tag = $s->primary_tag
Function: identifies the segment as type "DasSegment"
Returns : a string named "DasSegment"
Args : none
Status : Public, but see below
This method provides Bio::Das::Segment objects with a primary_tag()
field that identifies them as being of type "DasSegment". This allows
the Bio::Graphics engine to render segments just like a feature in order
nis way useful.
This does not need to be implemented. It is defined by the interface.
=cut
#'
sub primary_tag {"DasSegment"}
=head2 strand
Title : strand
Usage : $strand = $s->strand
Function: identifies the segment strand as 0
Returns : the number 0
Args : none
Status : Public, but see below
This method provides Bio::Das::Segment objects with a strand() field
that identifies it as being strandless. This allows the Bio::Graphics
engine to render segments just like a feature in order nis way useful.
This does not need to be implemented. It is defined by the interface.
=cut
sub strand { 0 }
1;
|