4 Bio::Matrix::PSM::InstanceSite - A PSM site occurrence
8 use Bio::Matrix::PSM::InstanceSite;
10 #You can get an InstanceSite object either from a file:
12 my ($instances,$matrix)=$SomePSMFile->parse_next;
16 my %params=(seq=>'TATAAT',
17 id=>"TATAbox1", accession=>'ENSG00000122304', mid=>'TB1',
18 desc=>'TATA box, experimentally verified in PRM1 gene',
19 -relpos=>-35, -anchor=>'CHR7', -start=>35000921, -end=>35000926);
21 #Last 2 arguments are passed to create a Bio::LocatableSeq object
22 #Anchor shows the coordinates system for the Bio::LocatableSeq object
26 Abstract interface to PSM site occurrence (PSM sequence
27 match). InstanceSite objects may be used to describe a PSM (See
28 L<Bio::Matrix::PSM::SiteMatrix>) sequence matches. The usual
29 characteristic of such a match is sequence coordinates, score,
30 sequence and sequence (gene) identifier- accession number or other id.
32 This object inherits from Bio::LocatableSeq (which defines the real
33 sequence) and might hold a SiteMatrix object, used to detect the CRE
34 (cis-regulatory element), or created from this CRE.
36 While the documentation states that the motif id and gene id
37 (accession) combination should be unique, this is not entirely true-
38 there might be more than one occurrence of the same cis-regulatory
39 element in the upstream region of the same gene. Therefore relpos
40 would be the third element to create a really unique combination.
46 User feedback is an integral part of the evolution of this and other
47 Bioperl modules. Send your comments and suggestions preferably to one
48 of the Bioperl mailing lists. Your participation is much appreciated.
50 bioperl-l@bioperl.org - General discussion
51 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
55 Please direct usage questions or support issues to the mailing list:
57 I<bioperl-l@bioperl.org>
59 rather than to the module maintainer directly. Many experienced and
60 reponsive experts will be able look at the problem and quickly
61 address it. Please include a thorough description of the problem
62 with code and data examples if at all possible.
66 Report bugs to the Bioperl bug tracking system to help us keep track
67 the bugs and their resolution. Bug reports can be submitted via the
70 https://github.com/bioperl/bioperl-live/issues
74 Bio::Matrix::PSM::InstanceSiteI implementation
76 =head1 AUTHOR - Stefan Kirov
86 # Let the code begin...
87 package Bio
::Matrix
::PSM
::InstanceSite
;
90 use base
qw(Bio::LocatableSeq Bio::Matrix::PSM::InstanceSiteI);
95 Usage : my $isntance=Bio::Matrix::PSM::InstanceSite->new
96 (-seq=>'TATAAT', -id=>"TATAbox1",
97 -accession_number='ENSG00000122304', -mid=>'TB1',
98 -desc=>'TATA box, experimentally verified in PRM1 gene',
99 -relpos=>-35, -anchor=>'CHR7', -start=>35000921, -end=>35000926, strand=>1)
100 Function: Creates an InstanceSite object from memory.
103 Returns : Bio::Matrix::PSM::InstanceSite object
110 my ($class, @args) = @_;
111 my %args = @args; #Too many things to rearrange, and I am creating >1K such objects routinely, so this is a performance issue
112 $args{'-start'} ||= 1;
113 my $end = $args{'-start'} + length($args{-seq
}) -1;
114 if (!defined($args{-strand
})) {
118 my $self = $class->SUPER::new
(@args,'-end',$end);
121 (my $key = shift @args) =~ s/-//gi; #deletes all dashes (only dashes)!
122 $args{$key} = shift @args;
124 #should throw exception if seq is null, for now just warn
125 if (($args{seq
} eq '') || (!defined($args{seq
}))) {
127 warn "No sequence?!\n";
129 $self->{mid
}=$args{mid
};
130 $self->seq($args{seq
});
131 $self->desc($args{desc
});
132 $self->{score
}=$args{score
};
133 $self->{relpos
}=$args{relpos
};
134 $self->{frame
}=$args{frame
};
135 $self->{anchor
}=$args{anchor
};
143 Usage : my $mid=$instance->mid;
144 Function: Get/Set the motif id
155 my $prev = $self->{mid
};
156 if (@_) { $self->{mid
} = shift; }
163 Usage : my $score=$instance->score;
164 Function: Get/Set the score (mismatches) between the instance and the attached (or
168 Returns : real number
175 my $prev = $self->{score
};
176 if (@_) { $self->{score
} = shift; }
183 Usage : my $anchor=$instance->anchor;
184 Function: Get/Set the anchor which shows what coordinate system start/end use
194 my $prev = $self->{anchor
};
195 if (@_) { $self->{anchor
} = shift; }
202 Usage : my $start=$instance->start;
203 Function: Get/Set the position of the instance on the sequence used
212 #Provided by LocatableSeq
217 Usage : my $minstance=$misntance->score;
218 Function: Get/Set the unique identifier- sequence id/motif id, for example PRM1_TATAbox.
219 Not necessarily human readable.
229 my $prev = $self->{minstance
};
230 if (@_) { $self->{minstance
} = shift; }
237 Usage : my $seqpos=$instance->relpos;
238 Function: Get/Set the relative position of the instance with respect to the transcription start
239 site (if known). Can and usually is negative.
249 my $prev = $self->{relpos
};
250 if (@_) { $self->{relpos
} = shift; }
257 Usage : $ann = $seq->annotation or $seq->annotation($annotation)
258 Function: Gets or sets the annotation
259 Returns : L<Bio::AnnotationCollectionI> object
260 Args : None or L<Bio::AnnotationCollectionI> object
262 See L<Bio::AnnotationCollectionI> and L<Bio::Annotation::Collection>
268 my ($obj,$value) = @_;
269 if( defined $value ) {
270 $obj->throw("object of class ".ref($value)." does not implement ".
271 "Bio::AnnotationCollectionI. Too bad.")
272 unless $value->isa("Bio::AnnotationCollectionI");
273 $obj->{'_annotation'} = $value;
274 } elsif( ! defined $obj->{'_annotation'}) {
275 $obj->{'_annotation'} = Bio
::Annotation
::Collection
->new();
277 return $obj->{'_annotation'};
283 Usage : $species = $seq->species() or $seq->species($species)
284 Function: Gets or sets the species
285 Returns : L<Bio::Species> object
286 Args : None or L<Bio::Species> object
288 See L<Bio::Species> for more information
293 my ($self, $species) = @_;
295 $self->{'species'} = $species;
297 return $self->{'species'};
305 Usage : my $frane=$instance->frame;
306 Function: Get/Set the frame of a DNA instance with respect to a protein motif used.
307 Returns undef if the motif was not protein or the DB is protein.
311 Args : integer (0, 1, 2)
317 my $prev = $self->{frame
};
318 if (@_) { $self->{frame
} = shift; $self->throw("This is not a legitimate frame") unless (grep(/$self->{frame}/,qw
[0 1 2])); }