Commit 7a2d4026 authored by juguang's avatar juguang
Browse files

protein feature converters

parent 14b6cc21
......@@ -81,12 +81,14 @@ sub _initialize {
my ($dbadaptor,
$dbdriver, $dbhost, $dbport, $dbuser, $dbpass, $dbname,
$analysis, $analysis_dbid, $analysis_logic_name,
$contig, $contig_dbid, $contig_name) =
$contig, $contig_dbid, $contig_name,
$translation_id) =
$self->_rearrange([qw(DBADAPTOR
DBDRIVER DBHOST DBPORT DBUSER DBPASS DBNAME
ANALYSIS ANALYSIS_DBID ANALYSIS_LOGIC_NAME
CONTIG CONTIG_DBID CONTIG_NAME)], @args);
CONTIG CONTIG_DBID CONTIG_NAME
TRANSLATION_ID)], @args);
if(defined $dbadaptor){
......
......@@ -56,7 +56,9 @@ use Bio::EnsEMBL::Utils::Converter::bio_ens;
sub _initialize {
my ($self, @args) = @_;
$self->SUPER::_initialize(@args);
my ($translation_id) = $self->_rearrange([qw(TRANSLATION_ID)], @args);
$self->translation_id($translation_id);
# internal converter for seqFeature
$self->{_bio_ens_seqFeature} = new Bio::EnsEMBL::Utils::Converter (
-in => 'Bio::SeqFeature::Generic',
......@@ -104,6 +106,7 @@ sub _convert_single_to_proteinFeature {
-feature1 => $featurePair->feature1,
-feature2 => $featurePair->feature2
);
$proteinFeature->seqname($self->translation_id);
return $proteinFeature;
}
......@@ -155,5 +158,10 @@ sub _create_consensus{
return $consensus;
}
sub translation_id {
my ($self, $arg) = @_;
return $self->{_translation_id} = $arg if(defined($arg));
return $self->{_translation_id};
}
1;
......@@ -64,16 +64,38 @@ sub _convert_single {
$self->warn("No seq_id value. EnsEMBL SeqFeature will validate it");
$seq_id = 'Unknown';
}
# Debated issue here. There are p_value and percent_id in EnsEMBL API and DB
# schema, but not in bioperl. If in bioperl there are tags called p_value or
# percent_id, then the values are passed, otherwise set the default 1.
#
# the problem arise when I try to converter the seqfeature for tmhmm to
# EnsEMBL seqFeature.
# -- Juguang, 11 July '03
my $score = $in->score || 1;
my $percent_id;
if($in->has_tag('percent_id')){
($percent_id) = @{$in->get_tag_values('percent_id')};
}else{
$percent_id ||= 1;
}
my $p_value;
if($in->has_tag('p_value')){
($p_value) = @{$in->get_tag_values('p_value')};
}else{
$p_value ||= 1;
}
my $ens_seqFeature;
my @args = (
-start => $in->start,
-end => $in->end,
-strand => $in->strand,
-score => $in->score,
-score => $score,
-analysis => $self->analysis,
-source_tag => $in->source_tag,
-seqname => $seq_id
-seqname => $seq_id,
-percent_id => $percent_id,
-p_value => $p_value
);
my $output_module = $self->out;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment