BioPerl
view release on metacpan or search on metacpan
Bio/Seq/EncodedSeq.pm view on Meta::CPAN
}
return ($self->can_call_new ? ref($self) : __PACKAGE__)->new(
-seq => join('', grep { defined } @nt[$start..--$end]),
-start => $self->start,
-end => $self->end,
-strand => 1,
-alphabet => 'dna' );
}
=head2 translate
Title : translate
Usage : $prot = $obj->translate(@args);
Function: obtain the protein sequence encoded by the underlying DNA
sequence; same as $obj->cds()->translate(@args).
Returns : a Bio::PrimarySeq object.
Args : same as the translate() function of Bio::PrimarySeqI
=cut
sub translate { shift->cds(-nogaps => 1, @_)->SUPER::translate(@_) };
=head2 protseq
Title : seq
Usage : $protseq = $obj->protseq();
Function: obtain the raw protein sequence encoded by the underlying
DNA sequence; This is the same as calling
$obj->translate()->seq();
Returns : a string of single-letter amino acid codes
Args : same as the seq() function of Bio::PrimarySeq; note that this
function may not be used to set the protein sequence; see
the dnaseq() function for that.
=cut
sub protseq { shift->cds(-nogaps => 1, @_)->SUPER::translate(@_)->seq };
=head2 dnaseq
Title : dnaseq
Usage : $dnaseq = $obj->dnaseq();
$obj->dnaseq("ACGTGTCGT", "CCCCCCCCC");
$obj->dnaseq(-seq => "ATG",
-encoding => "CCC",
-location => $loc );
@introns = $obj->$dnaseq(-encoding => 'I')
Function: get/set the underlying DNA sequence; will overwrite any
current DNA and/or encoding information present.
Returns : a string of single-letter nucleotide codes, including any
gaps implied by the encoding.
Args : seq - the DNA sequence to be used as a replacement
encoding - the encoding of the DNA sequence (see the new()
constructor); defaults to all 'C' if setting a
new DNA sequence. If no new DNA sequence is
being provided, then the encoding is used as a
"filter" for which to return fragments of
non-overlapping DNA that match the encoding.
location - optional, the location of the DNA sequence to
get/set; defaults to the entire sequence.
=cut
sub dnaseq {
my ($self, @args) = @_;
my ($seq, $enc, $loc) = $self->_rearrange([qw(DNASEQ ENCODING LOCATION)], @args);
return $self;
}
# need to overload this so that we truncate both the seq and the encoding!
sub trunc {
my ($self, $start, $end) = @_;
my $new = $self->SUPER::trunc($start, $end);
$start--;
my $enc = $self->{_encoding};
$enc = reverse $enc if $self->strand < 0;
$enc = substr($enc, $start, $end - $start);
$enc = reverse $enc if $self->strand < 0;
$new->encoding($enc);
return $new;
}
1;
( run in 1.836 second using v1.01-cache-2.11-cpan-364913b4093 )