3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
24 Please email comments or questions to the
public Ensembl
25 developers list at <http:
27 Questions may also be sent to the Ensembl help desk at
40 -hstart => $hit_start,
42 -hseqname => $hit_name
47 ProteinFeature objects represent domains or other features of interest
48 on a peptide sequence.
54 package Bio::EnsEMBL::ProteinFeature;
66 Arg [IDESC] : (optional)
string An interpro description
67 Arg [INTERPRO_AC] : (optional)
string An interpro
accession
68 Arg [TRANSLATION_ID] : (optional) integer A translation dbID
69 Arg [...] : named arguments to
FeaturePair superclass
87 my ($proto, @args) = @_;
89 my $class = ref($proto) || $proto;
92 my ($idesc, $ilabel, $interpro_ac, $translation_id, $external_data, $hit_description, $cigar_string, $align_type, $slice) = rearrange([
'IDESC',
'ILABEL',
'INTERPRO_AC',
'TRANSLATION_ID',
'EXTERNAL_DATA',
'HDESCRIPTION',
'CIGAR_STRING',
'ALIGN_TYPE',
'SLICE'], @args);
94 # BaseAlignFeature expects cigar_line or features
95 if($cigar_string && $align_type){
96 $self = $class->SUPER::new(@args);
98 #call the grand parent directly
99 $self = $class->Bio::EnsEMBL::FeaturePair::new(@args);
102 # the strand of protein features is always 0
103 $self->{
'strand'} = 0;
104 $self->{
'idesc'} = $idesc ||
'';
105 $self->{
'ilabel'} = $ilabel ||
'';
106 $self->{
'interpro_ac'} = $interpro_ac ||
'';
107 $self->{
'translation_id'} = $translation_id ||
'';
108 $self->{
'external_data'} = $external_data ||
'';
109 $self->{
'hit_description'} = $hit_description ||
'';
110 $self->{
'cigar_string'} = $cigar_string ||
'';
111 $self->{
'align_type'} = $align_type;
120 : the strand to be set.
126 #do not allow the strand to be set
129 return $self->{
'strand'};
134 Arg [1] : (optional)
string The interpro description
135 Example : print $protein_feature->idesc();
136 Description: Getter/Setter
for the interpro description of
this protein
147 $self->{
'idesc'} = shift
if (@_);
148 return $self->{
'idesc'};
153 Arg [1] : (optional)
string The interpro label
154 Example : print $protein_feature->ilabel();
155 Description: Getter/Setter
for the interpro label of
this protein
166 $self->{
'ilabel'} = shift
if (@_);
167 return $self->{
'ilabel'};
172 Arg [1] : (optional)
string The interpro
accession
173 Example : print $protein_feature->interpro_ac();
174 Description: Getter/Setter
for the interpro
accession of
this protein
185 $self->{
'interpro_ac'} = shift
if (@_);
186 return $self->{
'interpro_ac'};
189 =head2 translation_id
191 Arg [1] : (optional) integer The dbID of the translation
192 Example : print $protein_feature->translation_id();
193 Description: Getter/Setter
for the translation dbID of
this protein
204 $self->{
'translation_id'} = shift
if (@_);
205 return $self->{
'translation_id'};
210 $self->{
'external_data'} = shift
if (@_);
211 return $self->{
'external_data'};
215 =head2 summary_as_hash
217 Example : $protein_feature_summary = $protein_feature->summary_as_hash();
218 Description : Retrieves a textual summary of
this Protein feature.
219 Not inherited from Feature.
220 Returns : hashref of arrays of descriptive strings
221 Status : Intended
for internal use
224 sub summary_as_hash {
227 $summary{
'type'} = $self->analysis->db;
228 $summary{
'id'} = $self->display_id;
229 $summary{
'start'} = $self->start;
230 $summary{
'end'} = $self->end;
231 $summary{
'interpro'} = $self->interpro_ac;
232 $summary{
'description'} = $self->idesc;
233 $summary{
'hit_start'} = $self->hstart;
234 $summary{
'hit_end'} = $self->hend;
235 $summary{
'cigar_string'} = $self->cigar_string;
236 $summary{
'align_type'} = $self->align_type;
237 $summary{
'hseqname'} = $self->hseqname;
238 $summary{
'translation_id'} = $self->translation_id;
244 =head2 alignment_strings
246 Arg [1] : list of
string $flags
247 Example : $pf->alignment_strings
248 Description: Allows to rebuild the alignment
string of both the query and target sequence
249 using the sequence from translation
object and
250 MD Z String
for mismatching positions. Regex : [0-9]+(([A-Z]|\^[A-Z]+)[0-9]+)* (Refer: SAM/BAM specification)
251 eg: MD:Z:96^RHKTDSFVGLMGKRALNS0V14
252 Returntype : array reference containing 2 strings
253 the first corresponds to seq
254 the second corresponds to hseq
262 sub alignment_strings {
266 my $transl_adaptor = $self->adaptor->db->get_TranslationAdaptor();
267 my $transl_object = $transl_adaptor->fetch_by_dbID($self->translation_id);
269 if(defined $transl_object && $transl_object->isa(
'Bio::EnsEMBL::Translation')) {
270 $seq = $transl_object->transcript()->translate()->seq();
273 if ($self->align_type eq
'mdtag') {
274 if(defined $seq && defined $self->cigar_string){
275 return $self->_mdz_alignment_string($seq,$self->cigar_string);
277 warn
"sequence or cigar_line not found for " . $self->translation_id;
280 throw(
"alignment_strings method not implemented for " . $self->align_type);
289 $self->throw(
"ProteinFeature cant be transformed directly as".
290 " they are not on EnsEMBL coord system" );
298 Description: PRIVATE implementation of
abstract superclass method. Returns
299 1 as the
'unit' used
for the hit sequence.
316 Description: PRIVATE implementation of
abstract superclass method. Returns
317 3 as the
'unit' used
for the query sequence.