BioPerl
view release on metacpan or search on metacpan
Bio/Tools/EPCR.pm view on Meta::CPAN
Returns : Bio::Tools::EPCR
Args : -fh => filehandle
OR
-file => filename
-primary => a string to be used as the common value for
each features '-primary' tag. Defaults to
'sts'. (This in turn maps to the GFF 'type'
tag (aka 'method')).
-source => a string to be used as the common value for
each features '-source' tag. Defaults to
'e-PCR'. (This in turn maps to the GFF 'source'
tag)
-groupclass => a string to be used as the name of the tag
which will hold the sts marker namefirst
attribute. Defaults to 'name'.
=cut
sub new {
my($class,@args) = @_;
my $self = $class->SUPER::new(@args);
my ($primary, $source,
$groupclass) = $self->_rearrange([qw(PRIMARY
SOURCE
GROUPCLASS)],@args);
$self->primary(defined $primary ? $primary : 'sts');
$self->source(defined $source ? $source : 'e-PCR');
$self->groupclass(defined $groupclass ? $groupclass : 'name');
$self->_initialize_io(@args);
return $self;
}
=head2 next_feature
Title : next_feature
Usage : $seqfeature = $obj->next_feature();
Function: Returns the next feature available in the analysis result, or
undef if there are no more features.
Example :
Returns : A Bio::SeqFeatureI implementing object, or undef if there are no
more features.
Args : none
=cut
sub next_feature {
my ($self) = @_;
my $line = $self->_readline;
return unless defined($line);
chomp($line);
my($seqname,$location,$mkrname, $rest) = split(/\s+/,$line,4);
my ($start,$end) = ($location =~ /(\S+)\.\.(\S+)/);
# `e-PCR -direct` results code match strand in $rest as (+) and (-). Decode it if present.
my $strandsign;
if ($rest =~ m/^\(([+-])\)(.*)$/) {
($strandsign,$rest) = ($1, $2);
} else {
$strandsign = "?";
}
my $strand = $strandsign eq "+" ? 1 : $strandsign eq "-" ? -1 : 0;
my $markerfeature = Bio::SeqFeature::Generic->new
( '-start' => $start,
'-end' => $end,
'-strand' => $strand,
'-source' => $self->source,
'-primary' => $self->primary,
'-seq_id' => $seqname,
'-tag' => {
$self->groupclass => $mkrname,
($rest ? ('Note' => $rest ) : ()),
});
#$markerfeature->add_tag_value('Note', $rest) if defined $rest;
return $markerfeature;
}
=head2 source
Title : source
Usage : $obj->source($newval)
Function:
Example :
Returns : value of source (a scalar)
Args : on set, new value (a scalar or undef, optional)
=cut
sub source{
my $self = shift;
return $self->{'_source'} = shift if @_;
return $self->{'_source'};
}
=head2 primary
Title : primary
Usage : $obj->primary($newval)
Function:
Example :
Returns : value of primary (a scalar)
Args : on set, new value (a scalar or undef, optional)
=cut
sub primary{
my $self = shift;
return $self->{'_primary'} = shift if @_;
return $self->{'_primary'};
}
=head2 groupclass
Title : groupclass
Usage : $obj->groupclass($newval)
Function:
Example :
Returns : value of groupclass (a scalar)
Args : on set, new value (a scalar or undef, optional)
( run in 1.012 second using v1.01-cache-2.11-cpan-71847e10f99 )