NAME
Bio::LocatableSeq - A Bio::PrimarySeq object with start/end points on it that can be projected into a MSA or have coordinates relative to another seq.
SYNOPSIS
use Bio::LocatableSeq;my $seq = Bio::LocatableSeq->new(-seq => "CAGT-GGT",-id => "seq1",-start => 1,-end => 7);# a normal sequence object$locseq->seq();$locseq->id();# has start,end points$locseq->start();$locseq->end();# inherits off RangeI, so range operations possible
DESCRIPTION
The LocatableSeq sequence object was developed mainly because the SimpleAlign object requires this functionality, and in the rewrite of the Sequence object we had to decide what to do with this.
It is, to be honest, not well integrated with the rest of bioperl. For example, the trunc() function does not return a LocatableSeq object, as some might have thought. Also, the sequence is not a Bio::SeqI, so the location is simply inherited from Bio::RangeI and is not stored in a Bio::Location.
There are all sorts of nasty gotcha's about interactions between coordinate systems when these sort of objects are used. Some mapping now occurs to deal with HSP data, however it can probably be integrated in better and most methods do not implement it correctly yet. Also, several PrimarySeqI methods (subseq(), trunc(), etc.) do not behave as expected and must be used with care. Due to this, LocatableSeq functionality is to be refactored in a future BioPerl release. However, for alignment functionality it works adequately for the time being.
If you do not need alignment functionality, Bio::SeqfeatureI-implementing modules may be a suitable alternative to Bio::LocatableSeq. For example, Bio::SeqFeature::Generic and Bio::SeqFeature::Lite provide methods to attach a sequence to a specific region of a parent sequence and to set other useful attributes.
FEEDBACK
Mailing Lists
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 protected] - General discussionhttp://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.
Reporting Bugs
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:
https://github.com/bioperl/bioperl-live/issues
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
start
Title : startUsage : $obj->start($newval)Function: Get/set the 1-based start position of this sequence in the originalsequence. '0' means before the original sequence starts.Returns : value of startArgs : newvalue (optional)
end
Title : endUsage : $obj->end($newval)Function: Get/set the 1-based end position of this sequence in the originalsequence. '0' means before the original sequence starts.Returns : value of endArgs : newvalue (optional)Note : although this is a get/set, it checks passed values against thecalculated end point ( derived from the sequence and based on$GAP_SYMBOLS and possible frameshifts() ). If there is no match,it will warn and set the proper value. Probably best used fordebugging proper sequence calculations.
strand
Title : strandUsage : $obj->strand($newval)Function: return or set the strandednessReturns : the value of the strandedness (-1, 0 or 1)Args : the value of the strandedness (-1, 0 or 1)
mapping
Title : mappingUsage : $obj->mapping($newval)Function: return or set the mapping indices (indicates # symbols/positions inthe source string mapping to # of coordinate positions)Returns : two-element array (# symbols => # coordinate pos)Args : two elements (# symbols => # coordinate pos); this can also bepassed in as an array reference of the two elements (as might bepassed upon Bio::LocatableSeq instantiation, for instance).
frameshifts
Title : frameshiftsUsage : $obj->frameshifts($newval)Function: get/set the frameshift hash, which contains sequence positions askeys and the shift (-2, -1, 1, 2) as the valueReturns : hashArgs : hash or hash reference
get_nse
Title : get_nseUsage :Function: read-only name of form id/start-endExample :Returns :Args :
force_nse
Title : force_nseUsage : $ls->force_nse()Function: Boolean which forces get_nse() to build an NSE, regardlessof whether id(), start(), or end() is setReturns : Boolean valueArgs : (optional) Boolean (1 or 0)Note : This will convert any passed value evaluating as TRUE/FALSE to 1/0respectively
num_gaps
Title : num_gapsUsage :$self->num_gaps('.')Function:Gets number of gaps in the sequence. The count excludesleading or trailing gap characters.Valid bioperl sequence characters are [A-Za-z\-\.\*]. Ofthese, '.' and '-' are counted as gap characters unless anoptional argument specifies one of them.Returns : number of internal gaps in the sequence.Args : a gap character (optional)Status : StableNote : replaces no_gaps
column_from_residue_number
Title : column_from_residue_numberUsage : $col = $seq->column_from_residue_number($resnumber)Function:This function gives the position in the alignment(i.e. column number) of the given residue number in thesequence. For example, for the sequenceSeq1/91-97 AC..DEF.GHcolumn_from_residue_number(94) returns 6.An exception is thrown if the residue number would lieoutside the length of the aligment(e.g. column_from_residue_number( "Seq2", 22 )Returns : A column number for the position of thegiven residue in the given sequence (1 = first column)Args : A residue number in the whole sequence (not just thatsegment of it in the alignment)
location_from_column
Title : location_from_columnUsage : $loc = $ali->location_from_column($column_number)Function:This function gives the residue number for a given positionin the alignment (i.e. column number) of the given. Gapscomplicate this process and force the output to be aL<Bio::Location::Simple> where values can be undefined.For example, for the sequence:Seq/91-96 .AC..DEF.G.location_from_column( 3 ) position 92location_from_column( 4 ) position 92^93location_from_column( 9 ) position 95^96location_from_column( 1 ) position undefAn exact position returns a Bio::Location::Simple objectwhere where location_type() returns 'EXACT', if a positionis between bases location_type() returns 'IN-BETWEEN'.Column before the first residue returns undef. Note that ifthe position is after the last residue in the alignment,that there is no guarantee that the original sequence hasresidues after that position.An exception is thrown if the column number is not withinthe sequence.Returns : Bio::Location::Simple or undefArgs : A column numberThrows : If column is not within the sequence
See Bio::Location::Simple for more.
revcom
Title : revcomUsage : $rev = $seq->revcom()Function: Produces a new Bio::LocatableSeq object whichhas the reversed complement of the sequence. For proteinsequences this throws an exception of "Sequence is aprotein. Cannot revcom"Returns : A new Bio::LocatableSeq objectArgs : none
trunc
Title : truncUsage : $subseq = $myseq->trunc(10,100);Function: Provides a truncation of a sequence,Returns : a fresh Bio::PrimarySeqI implementing objectArgs : Two integers denoting first and last columns of thesequence to be included into sub-sequence.
validate_seq
Title : validate_seqUsage : if(! $seqobj->validate_seq($seq_str) ) {print "sequence $seq_str is not valid for an object ofalphabet ",$seqobj->alphabet, "\n";}Function: Test that the given sequence is valid, i.e. contains only validcharacters. The allowed characters are all letters (A-Z) and '-','.','*','?','=' and '~'. Spaces are not valid. Note that thisimplementation does not take alphabet() into account.Returns : 1 if the supplied sequence string is valid, 0 otherwise.Args : - Sequence string to be validated- Boolean to throw an error if the sequence is invalid