$Bio::EnsEMBL::Utils::Converter::bio_ens_seqFeature::VERSION
=
'112.0.0_57'
;
$Bio::EnsEMBL::Utils::Converter::bio_ens_seqFeature::VERSION
=
'112.0.057'
;
@ISA
=
qw(Bio::EnsEMBL::Utils::Converter::bio_ens)
;
sub
_convert_single {
my
(
$self
,
$in
) =
@_
;
unless
(
$in
&&
defined
(
$in
) &&
$in
->isa(
'Bio::SeqFeature::Generic'
)){
$self
->throw(
"a Bio::SeqFeature::Generic object needed"
);
}
my
$seqFeature
=
$in
;
my
$seq_id
=
$seqFeature
->seq_id;
unless
(
defined
(
$seq_id
) &&
$seq_id
){
$self
->
warn
(
"No seq_id value. EnsEMBL SeqFeature will validate it"
);
$seq_id
=
'Unknown'
;
}
my
$score
=
$in
->score || 0;
my
$percent_id
;
if
(
$in
->has_tag(
'percent_id'
)){
(
$percent_id
) =
$in
->get_tag_values(
'percent_id'
);
}
else
{
$percent_id
||= 0;
}
my
$p_value
;
if
(
$in
->has_tag(
'p_value'
)){
(
$p_value
) =
$in
->get_tag_values(
'p_value'
);
}
elsif
(
$in
->has_tag(
'evalue'
)){
(
$p_value
) =
$in
->get_tag_values(
'evalue'
);
}
else
{
$p_value
||= 1;
}
my
$ens_seqFeature
;
my
%args
= (
-start
=>
$in
->start,
-end
=>
$in
->end,
-strand
=>
$in
->strand,
-score
=>
$score
,
-analysis
=>
$self
->analysis,
-source_tag
=>
$in
->source_tag,
-seqname
=>
$seq_id
,
-percent_id
=>
$percent_id
,
-p_value
=>
$p_value
);
my
$output_module
=
$self
->out;
if
(
$output_module
eq
'Bio::EnsEMBL::SeqFeature'
){
$ens_seqFeature
= new Bio::EnsEMBL::SeqFeature(
%args
);
}
elsif
(
$self
->out eq
'Bio::EnsEMBL::SimpleFeature'
){
$ens_seqFeature
= new Bio::EnsEMBL::SimpleFeature(
%args
);
$ens_seqFeature
->display_label(
'__NONE__'
);
}
elsif
(
$self
->out eq
'Bio::EnsEMBL::Exon'
){
$ens_seqFeature
= Bio::EnsEMBL::Exon->new_fast(
$self
->contig,
$seqFeature
->start,
$seqFeature
->end,
$seqFeature
->strand);
}
elsif
(
$self
->out eq
'Bio::EnsEMBL::ProteinFeature'
){
my
$seq_id2
=
$self
->analysis->logic_name;
unless
(
defined
$self
->translation_id){
$self
->throw(
'translation_id unset, in ProteinFeature conversion'
);
}
$args
{
'-seqname'
} =
$self
->translation_id;
$ens_seqFeature
= Bio::EnsEMBL::ProteinFeature->new(
-feature1
=> Bio::EnsEMBL::SeqFeature->new(
%args
),
-feature2
=> Bio::EnsEMBL::SeqFeature->new(
-start
=> 0,
-end
=> 0,
-seqname
=>
$seq_id2
)
);
}
else
{
$self
->throw(
"[$output_module] as -out, not supported"
);
}
$ens_seqFeature
->attach_seq(
$self
->contig);
return
$ens_seqFeature
;
}
1;