| 1 | package Bio::Gonzales::PrimarySeqIX; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use Bio::Gonzales::Tools::SeqMask; | ||
| 6 | |||
| 7 | our $VERSION = '0.062'; # VERSION | ||
| 8 | |||
| 9 | sub Bio::PrimarySeqI::clone { | ||
| 10 | my ($self) = @_; | ||
| 11 | return clone($self); | ||
| 12 | } | ||
| 13 | |||
| 14 | sub clone { | ||
| 15 | my ($so) = @_; | ||
| 16 | my $seqclass; | ||
| 17 | if ( $so->can_call_new() ) { | ||
| 18 | $seqclass = ref($so); | ||
| 19 | } else { | ||
| 20 | $seqclass = 'Bio::PrimarySeq'; | ||
| 21 | $so->_attempt_to_load_Seq(); | ||
| 22 | } | ||
| 23 | |||
| 24 | my $out = $seqclass->new( | ||
| 25 | '-seq' => $so->seq, | ||
| 26 | '-display_id' => $so->display_id, | ||
| 27 | '-accession_number' => $so->accession_number, | ||
| 28 | '-alphabet' => $so->alphabet, | ||
| 29 | '-desc' => $so->desc(), | ||
| 30 | '-verbose' => $so->verbose | ||
| 31 | ); | ||
| 32 | |||
| 33 | return $out; | ||
| 34 | } | ||
| 35 | |||
| 36 | =head2 mask | ||
| 37 | |||
| 38 | Title : mask | ||
| 39 | Usage : $obj->mask(10,40,'Z'); | ||
| 40 | $obj->mask(10,40); | ||
| 41 | $obj->mask($bio_location_obj, 'Z'); | ||
| 42 | $obj->mask($bio_location_obj); | ||
| 43 | Function: masks a sequence region by replacing the respective part with a | ||
| 44 | custom character. If the character is omitted, 'X' in case of | ||
| 45 | protein and 'N' in case of DNA/RNA alphabet is used to mask the | ||
| 46 | sequence region. | ||
| 47 | Returns : the object it was invoked on | ||
| 48 | Args : integer for start position | ||
| 49 | integer for end position | ||
| 50 | custom character to use for masking | ||
| 51 | OR | ||
| 52 | Bio::LocationI location for sequence region (strand NOT honored) | ||
| 53 | custom character to use for masking | ||
| 54 | =cut | ||
| 55 | |||
| 56 | sub Bio::PrimarySeqI::mask { | ||
| 57 | my ( $self, @args ) = @_; | ||
| 58 | |||
| 59 | return Bio::Gonzales::Tools::SeqMask->new( -seq => $self )->mask(@args)->seq; | ||
| 60 | } | ||
| 61 | |||
| 62 | sub Bio::PrimarySeqI::trunc_masked_ends { | ||
| 63 | my ( $self, @args ) = @_; | ||
| 64 | |||
| 65 | return Bio::Gonzales::Tools::SeqMask->new( -seq => $self )->trunc_masked_ends(@args)->seq; | ||
| 66 | } | ||
| 67 | |||
| 68 | 1; |