- AUTHOR - Heikki Lehvaslaiho
Bio::SeqUtils - Additional methods for PrimarySeq objects
use Bio::SeqUtils; # get a Bio::PrimarySeqI compliant object, $seq, somehow $util = new Bio::SeqUtils; $polypeptide_3char = $util->seq3($seq); # or $polypeptide_3char = Bio::SeqUtils->seq3($seq); # set the sequence string (stored in one char code in the object) Bio::SeqUtils->seq3($seq, $polypeptide_3char); # translate a sequence in all six frames @seqs = Bio::SeqUtils->translate_6frames($seq); # inplace editing of the sequence Bio::SeqUtils->mutate($seq, Bio::LiveSeq::Mutation->new(-seq => 'c', -pos => 3 )); # mutate a sequence to desired similarity% $newseq = Bio::SeqUtils-> evolve ($seq, $similarity, $transition_transversion_rate); # concatenate two or more sequences with annotations and features, # the first sequence will be modified Bio::SeqUtils->cat(@seqs); # truncate a sequence, retaining features and adjusting their # coordinates if necessary my $truncseq = Bio::SeqUtils->trunc_with_features($seq, 100, 200); # reverse complement a sequence and its features my $revcomseq = Bio::SeqUtils->revcom_with_features($seq);
This class is a holder of methods that work on Bio::PrimarySeqI- compliant sequence objects, e.g. Bio::PrimarySeq and Bio::Seq. These methods are not part of the Bio::PrimarySeqI interface and should in general not be essential to the primary function of sequence objects. If you are thinking of adding essential functions, it might be better to create your own sequence class. See Bio::PrimarySeqI, Bio::PrimarySeq, and Bio::Seq for more.
The methods take as their first argument a sequence object. It is possible to use methods without first creating a SeqUtils object, i.e. use it as an anonymous hash.
The first two methods, seq3() and seq3in(), give out or read in protein sequences coded in three letter IUPAC amino acid codes.
The next two methods, translate_3frames() and translate_6frames(), wrap around the standard translate method to give back an array of three forward or all six frame translations.
The mutate() method mutates the sequence string with a mutation description object.
The cat() method concatenates two or more sequences. The first sequence is modified by addition of the remaining sequences. All annotations and sequence features will be transferred.
The revcom_with_features() and trunc_with_features() methods are similar to the revcom() and trunc() methods from Bio::Seq, but also adjust any features associated with the sequence as appropriate.
User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated.
email@example.com - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists
Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web:
Roy Chaudhuri, roy at colibase d bham d ac d uk
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
Title : seq3 Usage : $string = Bio::SeqUtils->seq3($seq) Function: Read only method that returns the amino acid sequence as a string of three letter codes. alphabet has to be 'protein'. Output follows the IUPAC standard plus 'Ter' for terminator. Any unknown character, including the default unknown character 'X', is changed into 'Xaa'. A noncoded aminoacid selenocystein is recognized (Sec, U). Returns : A scalar Args : character used for stop in the protein sequence optional, defaults to '*' string used to separate the output amino acid codes, optional, defaults to ''
Title : seq3in Usage : $seq = Bio::SeqUtils->seq3in($seq, 'MetGlyTer') Function: Method for changing of the sequence of a Bio::PrimarySeqI sequence object. The three letter amino acid input string is converted into one letter code. Any unknown character triplet, including the default 'Xaa', is converted into 'X'. Returns : Bio::PrimarySeq object Args : sequence string optional character to be used for stop in the protein sequence, defaults to '*' optional character to be used for unknown in the protein sequence, defaults to 'X'
Title : translate_3frames Usage : @prots = Bio::SeqUtils->translate_3frames($seq) Function: Translate a nucleotide sequence in three forward frames. The IDs of the sequences are appended with '-0F', '-1F', '-2F'. Returns : An array of seq objects Args : sequence object same arguments as to Bio::PrimarySeqI::translate
Title : translate_6frames Usage : @prots = Bio::SeqUtils->translate_6frames($seq) Function: translate a nucleotide sequence in all six frames The IDs of the sequences are appended with '-0F', '-1F', '-2F', '-0R', '-1R', '-2R'. Returns : An array of seq objects Args : sequence object same arguments as to Bio::PrimarySeqI::translate
Title : valid_aa Usage : my @aa = $table->valid_aa Function: Retrieves a list of the valid amino acid codes. The list is ordered so that first 21 codes are for unique amino acids. The rest are ['B', 'Z', 'X', '*']. Returns : array of all the valid amino acid codes Args : [optional] $code => [0 -> return list of 1 letter aa codes, 1 -> return list of 3 letter aa codes, 2 -> return associative array of both ]
Title : mutate Usage : Bio::SeqUtils->mutate($seq,$mutation1, $mutation2); Function: Inplace editing of the sequence. The second argument can be a Bio::LiveSeq::Mutation object or an array of them. The mutations are applied sequentially checking only that their position is within the current sequence. Insertions are inserted before the given position. Returns : boolean Args : sequence object mutation, a Bio::LiveSeq::Mutation object, or an array of them
Title : cat Usage : my $catseq = Bio::SeqUtils->cat(@seqs) Function: Concatenates an array of Bio::Seq objects, using the first sequence as a target. Annotations and sequence features are copied over from any additional objects. Adjusts the coordinates of copied features. Returns : a boolean Args : array of sequence objects
Note that annotations have no sequence locations. If you concatenate sequences with the same annotations they will all be added.
Title : trunc_with_features Usage : $trunc=Bio::SeqUtils->trunc_with_features($seq, $start, $end); Function: Like Bio::Seq::trunc, but keeps features (adjusting coordinates where necessary. Features that partially overlap the region have their location changed to a Bio::Location::Fuzzy. Returns : A new sequence object Args : A sequence object, start coordinate, end coordinate (inclusive)
Title : _coord_adjust Usage : my $newfeat=Bio::SeqUtils->_coord_adjust($feature, 100, $seq->length); Function: Recursive subroutine to adjust the coordinates of a feature and all its subfeatures. If a sequence length is specified, then any adjusted features that have locations beyond the boundaries of the sequence are converted to Bio::Location::Fuzzy objects. Returns : A Bio::SeqFeatureI compliant object. Args : A Bio::SeqFeatureI compliant object, the number of bases to add to the coordinates (optional) the length of the parent sequence
Title : revcom_with_features Usage : $revcom=Bio::SeqUtils->revcom_with_features($seq); Function: Like Bio::Seq::revcom, but keeps features (adjusting coordinates as appropriate. Returns : A new sequence object Args : A sequence object
Title : _feature_revcom Usage : my $newfeat=Bio::SeqUtils->_feature_revcom($feature, $seq->length); Function: Recursive subroutine to reverse complement a feature and all its subfeatures. The length of the parent sequence must be specified. Returns : A Bio::SeqFeatureI compliant object. Args : A Bio::SeqFeatureI compliant object, the length of the parent sequence
Title : evolve Usage : my $newseq = Bio::SeqUtils-> evolve($seq, $similarity, $transition_transversion_rate); Function: Mutates the sequence by point mutations until the similarity of the new sequence has decreased to the required level. Transition/transversion rate is adjustable. Returns : A new Bio::PrimarySeq object Args : sequence object percentage similarity (e.g. 80) tr/tv rate, optional, defaults to 1 (= 1:1)
Set the verbosity of the Bio::SeqUtils object to positive integer to see the mutations as they happen.
This method works only on nucleotide sequences. It prints a warning if you set the target similarity to be less than 25%.
Transition/transversion ratio is an observed attribute of an sequence comparison. We are dealing here with the transition/transversion rate that we set for our model of sequence evolution.