Bio::Seq::QualI(3) Interface definition for a Bio::Seq::Qual

SYNOPSIS


# get a Bio::Seq::Qual compliant object somehow
# to test this is a seq object
$obj->isa("Bio::Seq::QualI")
|| $obj->throw("$obj does not implement the Bio::Seq::QualI interface");
# accessors
$string = $obj->qual();
$substring = $obj->subqual(12,50);
$display = $obj->display_id(); # for human display
$id = $obj->primary_id(); # unique id for this object,
# implementation defined
$unique_key= $obj->accession_number();
# unique biological id

DESCRIPTION

This object defines an abstract interface to basic quality information. PrimaryQual is an object just for the quality and its name(s), nothing more. There is a pure perl implementation of this in Bio::Seq::PrimaryQual. If you just want to use Bio::Seq::PrimaryQual objects, then please read that module first. This module defines the interface, and is of more interest to people who want to wrap their own Perl Objects/RDBs/FileSystems etc in way that they ``are'' bioperl quality objects, even though it is not using Perl to store the sequence etc.

This interface defines what bioperl consideres necessary to ``be'' a sequence of qualities, without providing an implementation of this. (An implementation is provided in Bio::Seq::PrimaryQual). If you want to provide a Bio::Seq::PrimaryQual 'compliant' object which in fact wraps another object/database/out-of-perl experience, then this is the correct thing to wrap, generally by providing a wrapper class which would inherit from your object and this Bio::Seq::QualI interface. The wrapper class then would have methods lists in the ``Implementation Specific Functions'' which would provide these methods for your object.

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 discussion
  http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

Support

Please direct usage questions or support issues to the mailing list:

[email protected]

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

AUTHOR - Chad Matsalla

This module is heavily based on Bio::Seq::PrimarySeq and is modeled after or outright copies sections of it. Thanks Ewan!

Email [email protected]

APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

Implementation Specific Functions

These functions are the ones that a specific implementation must define.

qual()

 Title   : qual()
 Usage   : @quality_values  = @{$obj->qual()};
 Function: Returns the quality as a reference to an array containing the
        quality values. The individual elements of the quality array are
        not validated and can be any numeric value.
 Returns : A reference to an array.
 Status  :

subqual($start,$end)

 Title   : subqual($start,$end)
 Usage   : @subset_of_quality_values = @{$obj->subseq(10,40)};
 Function: returns the quality values from $start to $end, where the
        first value is 1 and the number is inclusive, ie 1-2 are the first
        two bases of the sequence. Start cannot be larger than end but can
        be equal.
 Returns : A reference to an array.
 Args    : a start position and an end position

display_id()

 Title   : display_id()
 Usage   : $id_string = $obj->display_id() _or_
           $id_string = $obj->display_id($new_display_id);
 Function: Returns the display id, aka the common name of the Quality 
        object.
        The semantics of this is that it is the most likely string to be
        used as an identifier of the quality sequence, and likely to have
        "human" readability.  The id is equivalent to the ID field of the
        GenBank/EMBL databanks and the id field of the Swissprot/sptrembl
        database. In fasta format, the >(\S+) is presumed to be the id,
        though some people overload the id to embed other information.
        Bioperl does not use any embedded information in the ID field,
        and people are encouraged to use other mechanisms (accession field
        for example, or extending the sequence object) to solve this.
        Notice that $seq->id() maps to this function, mainly for 
        legacy/convience issues
 Returns : A string
 Args    : If an arg is provided, it will replace the existing display_id
        in the object.

accession_number()

 Title   : accession_number()
 Usage   : $unique_biological_key = $obj->accession_number(); _or_
           $unique_biological_key = $obj->accession_number($new_acc_num);
 Function: Returns the unique biological id for a sequence, commonly 
        called the accession_number. For sequences from established 
        databases, the implementors should try to use the correct 
        accession number. Notice that primary_id() provides the unique id 
        for the implemetation, allowing multiple objects to have the same
        accession number in a particular implementation. For sequences
        with no accession number, this method should return "unknown".
 Returns : A string.
 Args    : If an arg is provided, it will replace the existing
        accession_number in the object.

primary_id()

 Title   : primary_id()
 Usage   : $unique_implementation_key = $obj->primary_id(); _or_
           $unique_implementation_key = $obj->primary_id($new_prim_id);
 Function: Returns the unique id for this object in this implementation.
        This allows implementations to manage their own object ids in a
        way the implementaiton can control clients can expect one id to
        map to one object. For sequences with no accession number, this
        method should return a stringified memory location.
 Returns : A string
 Args    : If an arg is provided, it will replace the existing
        primary_id in the object.

can_call_new()

 Title   : can_call_new()
 Usage   : if( $obj->can_call_new ) {
             $newobj = $obj->new( %param );
         }
 Function: can_call_new returns 1 or 0 depending on whether an
        implementation allows new constructor to be called. If a new
        constructor is allowed, then it should take the followed hashed
        constructor list.
           $myobject->new( -qual => $quality_as_string,
                           -display_id  => $id,
                           -accession_number => $accession,
                           );
 Example :
 Returns : 1 or 0
 Args    :

qualat($position)

 Title   : qualat($position)
 Usage   : $quality = $obj->qualat(10);
 Function: Return the quality value at the given location, where the
        first value is 1 and the number is inclusive, ie 1-2 are the first
        two bases of the sequence. Start cannot be larger than end but can
        be equal.
 Returns : A scalar.
 Args    : A position.

Optional Implementation Functions

The following functions rely on the above functions. A implementing class does not need to provide these functions, as they will be provided by this class, but is free to override these functions.

All of revcom(), trunc(), and translate() create new sequence objects. They will call new() on the class of the sequence object instance passed as argument, unless can_call_new() returns FALSE. In the latter case a Bio::PrimarySeq object will be created. Implementors which really want to control how objects are created (eg, for object persistence over a database, or objects in a CORBA framework), they are encouraged to override these methods

revcom

 Title   : revcom
 Usage   : @rev = @{$qual->revcom()};
 Function: Produces a new Bio::Seq::QualI implementing object which
        is reversed from the original quality array.
        The id is the same id as the orginal sequence, and the accession number
        is also indentical. If someone wants to track that this sequence has
        been reversed, it needs to define its own extensions
        To do an inplace edit of an object you can go:
        $qual = $qual->revcom();
        This of course, causes Perl to handle the garbage collection of the old
        object, but it is roughly speaking as efficient as an inplace edit.
 Returns : A new (fresh) Bio::Seq::PrimaryQualI object
 Args    : none

trunc()

 Title   : trunc
 Usage   : $subseq = $myseq->trunc(10,100);
 Function: Provides a truncation of a sequence,
 Returns : a fresh Bio::Seq::QualI implementing object
 Args    : Two integers denoting first and last base of the sub-sequence.

translate()

 Title   : translate()
 Usage   : $protein_seq_obj = $dna_seq_obj->translate
           #if full CDS expected:
           $protein_seq_obj = $cds_seq_obj->translate(undef,undef,undef,undef,1);
 Function: Completely useless in this interface.
 Returns : Nothing.
 Args    : Nothing.

id()

 Title   : id()
 Usage   : $id = $qual->id()
 Function: ID of the quality. This should normally be (and actually is in
           the implementation provided here) just a synonym for display_id().
 Example :
 Returns : A string.
 Args    :

length()

 Title   : length()
 Usage   : $length = $qual->length();
 Function: Return the length of the array holding the quality values.
        Under most circumstances, this should match the number of quality
        values but no validation is done when the PrimaryQual object is
        constructed and non-digits could be put into this array. Is this a
        bug? Just enough rope...
 Returns : A scalar (the number of elements in the quality array).
 Args    : None.

desc()

 Title   : desc()
 Usage   : $qual->desc($newval);
           $description = $seq->desc();
 Function: Get/set description text for a qual object
 Example :
 Returns : value of desc
 Args    : newvalue (optional)

Private functions

These are some private functions for the PrimarySeqI interface. You do not need to implement these functions

_attempt_to_load_Seq

 Title   : _attempt_to_load_Seq
 Usage   :
 Function:
 Example :
 Returns :
 Args    :

qualtype()

 Title   : qualtype()
 Usage   : if( $obj->qualtype eq 'phd' ) { /Do Something/ }
 Function: At this time, this function is not used for 
        Bio::Seq::PrimaryQual objects. In fact, now it is a month later and
        I just completed the Bio::Seq::SeqWithQuality object and this is
        definitely deprecated.
 Returns : Nothing. (not implemented)
 Args    : none
 Status  : Virtual