These documents are For the HEAD of the CVS repository on July 19, 2007
Api docs for previous releases
Modware::Feature
GENERIC
Modware::Feature::GENERIC - default Modware representation of a simple genome sequence feature (start, stop, strand)
|
No package variables defined. |
my $tata_box = new Modware::Feature( -type => 'TATA_box', -source => 'test source', -bioperl => $some_bio_seqFeature_generic_object, -reference_feature => $some_chromosome_or_contig_object );
# or my $tata_box = new Modware::Feature( -primary_id => $id_of_some_tatabox_feature );
# since there is no Modware::Feature::TATA_BOX class a Modware::Feature::Generic class # will get created
|
Generic feature class. Used for simple features with a start, stop, stop and no structure. This default feature class is instantiated when Modware encounters a feature with a 'type' that does not map to a class in Modware::Feature::*
The assumption is that the feature type can be represented by a Bio::SeqFeature::Generic object (start, stop, strand, refernece feature)
|
Methods description
Title : _get_bioperl
Note : creates a bioperl object representing this Contig (Bio::SeqFeature::Generic)
Usage : called internally by lazy evaluated 'bioperl' method
Function : creates a bioperl object with a location on the chromosome's bioperl object.
Returns : nothing
Args : none
Title : _init
Usage : called internally by constructor
: (hook to do any post-instantiation initialization)
Function : does nothing in Modware::Feature::GENERIC
Returns : nothing
Args : none
Title : _update_cached_sequence
Note : internal method for features that store sequences
Function : do not store sequences for generic features, does nothing here
Returns : nothing
Args : none
Title : end
Function : returns the end position relatve to a genomic
: reference feature (chromosome, contig, etc.)
Returns : integer base position
Args : none
Title : insert
Function : calls SUPER::insert but then inserts the location
:
Returns : nothing
Args : none
Title : length
Function : returns the length of the feature
Returns : integer length
Args : none
Title : new
Note : never call this directly. Use new Modware::Feature with 'type' set to '
Usage : my $match = new Modware::Feature(
-type => 'match',
-source => 'blastn.10.19.2007',
-bioperl => $some_bio_search_hit_generichit_object
);
Function : called by Modware::Feature->new when type = 'match'
Returns : feature_id string
Args : named arguments: -source, -type, -bioperl (Bio::Search::Hit::GenericHit), -description
Title : shift_feature
Note :
Usage : To move a feature upstream by 125 bases:
: $feature->shift_feature( 25 );
Function : moves a feature by a specified amount
Returns : nothing
Args : integer ( + or - )
Title : start
Function : returns the start position relatve to a genomic
: reference feature (chromosome, contig, etc.)
Returns : integer base position
Args : none
Title : update
Function : calls SUPER::update but then updates the location
:
Returns : nothing
Args : none
Methods code
sub _get_bioperl
{ my ($self, @args) = @_;
my $bioperl = new Bio::SeqFeature::Generic();
$bioperl->start( $self->_featureloc() + 1 );
$bioperl->end( $self->_featureloc() );
$bioperl->strand( $self->_featureloc() ) if $self->_featureloc();
$bioperl->primary_tag( $self->type() );
$self->reference_feature();
#
# returning a CONTIG object having a chromosome attached to it
# to chromosome ( in _get_contig_features() )
# results in weird behavior: if there are more than 8 contigs in the
# array the code breaks, but does not throw an error.
#
$bioperl->attach_seq( $self->reference_feature()->bioperl ) if $self->{'reference_feature'};
$self->bioperl( $bioperl );
}
sub _init
{ my ($self, @args) = @_;
}
sub _update_cached_sequence
{ my ($self, $obj) = @_;
#
# not updateing any seqs
#
}
sub end
{ my ($self, @args) = @_;
return $self->bioperl(@args);
}
sub insert
{ my ($self, @args) = @_;
$self->SUPER::insert();
$self->_insert_featureloc();
}
sub length
{ my ($self, @args) = @_;
return $self->bioperl(@args);
}
sub new
{ my ($type, @args) = @_;
#
# do not bless it here, assume subclass will bless as a subclass type
#
my $self = {};
bless $self,$type;
# You can pass in a chromosome_name or a reference _feature
# chromosome_name will probably be deprecated
my @arglist = qw(
SOURCE DESCRIPTION CHROMOSOME_NAME START END REFERENCE_FEATURE
);
my (
$source, $description, $chromosome_name, $start, $end, $reference_feature
) = $self->_rearrange( [@arglist], @args );
if ( !($chromosome_name xor $reference_feature)|| !$start || !$end ) {
$self->throw( "Need -start, -end, and -chromosome_name or -reference_feature arguements to constructor.");
}
my $bioperl = new Bio::SeqFeature::Generic( -start => $start, -end => $end );
$reference_feature = new Modware::Chromosome( -name => $chromosome_name ) if $chromosome_name;
$self->source ( $source ) if defined $source;
$self->bioperl ( $bioperl ) if defined $bioperl;
$self->description ( $description ) if defined $description;
$self->reference_feature ( $reference_feature ) if defined $reference_feature;
$bioperl->attach_seq( $self->reference_feature->bioperl ) if $self->{'reference_feature'};
$self->qualifiers( [] );
$self->_init();
return $self;
}
sub shift_feature
{ my ($self, $offset) = @_;
my $bioperl = $self->bioperl;
$bioperl->start( $bioperl->start() + $offset );
$bioperl->end ( $bioperl->end() + $offset );
}
sub start
{ my ($self, @args) = @_;
return $self->bioperl(@args);
}
sub update
{ my ($self, @args) = @_;
$self->SUPER::update();
if ( $self->{'bioperl'} ) {
$self->_update_featureloc();
}
}
General documentation
Copyright © 2006, Northwestern University
All rights reserved.
|
|