Skip to content
Wendel Hime edited this page Dec 12, 2017 · 16 revisions

This section pretends to define Report_HTML_DB::Models packages, if I don't define models, developers which don't know how to read perl code gonna have some problems. All models have the should be an transfer object, this section list:

Report_HTML_DB::Models::Services

A service application can't have errors when running application, so you have to "try catch" every request from actions using the models that you want, so, every request, can return two possible responses:

Report_HTML_DB::Models::Services::BaseResponse

This class represents a simple response from Services application, that is, if you're returning a simple object, use this class, if you want a paginated response see Report_HTML_DB::Models::Services::PageResponse.

Properties:

Property Description
status_code a status from response
message message from response
elapsed_ms time in miliseconds from request
response a object response

Methods:

setResponse($self, $response)

Method used to set response
Returns response from Report_HTML_DB::Models::Services::BaseResponse object instance

getResponse($self)

Method used to get response
Returns response from Report_HTML_DB::Models::Services::BaseResponse object instance

setStatusCode($self, $status_code)

Method used to set status code
Returns status code from Report_HTML_DB::Models::Services::BaseResponse object instance

getStatusCode($self)

Method used to get status code
Returns status code from Report_HTML_DB::Models::Services::BaseResponse object instance

setMessage($self, $message)

Method used to set message
Returns message from Report_HTML_DB::Models::Services::BaseResponse object instance

getMessage($self)

Method used to get message
Returns message from Report_HTML_DB::Models::Services::BaseResponse object instance

setElapsedMs($self, $elapsed_ms)

Method used to set elapsed miliseconds from request
Returns elapsed time in ms from Report_HTML_DB::Models::Services::BaseResponse object instance

getElapsedMs($self)

Method used to get elapsed time from request in miliseconds
Returns elapsed time in ms from Report_HTML_DB::Models::Services::BaseResponse object instance

Report_HTML_DB::Models::Services::PagedResponse

This class represents a paginated response, something like,

you're running a SQL query, and you've 10000 results

if you return this shit in one shot, you're application section gonna be to busy to receive another request and your website application should send you to hell. So, if you want to do the right thing, separate your response by offsets and limits, in this way, you can process everything faster and in a clean way.

Properties:

Property Description
status_code a status from response
message message from response
elapsed_ms time in miliseconds from request
response a object response
total total number of response objects
offset offset number of responses
page_size page size number

Methods:

setResponse($self, $response)

Method used to set response
Returns response from Report_HTML_DB::Models::Services::PagedResponse object instance

getResponse($self)

Method used to get response
Returns response from Report_HTML_DB::Models::Services::PagedResponse object instance

setStatusCode($self, $status_code)

Method used to set status code
Returns status code from Report_HTML_DB::Models::Services::PagedResponse object instance

getStatusCode($self)

Method used to get status code
Returns status code from Report_HTML_DB::Models::Services::PagedResponse object instance

setMessage($self, $message)

Method used to set message
Returns message from Report_HTML_DB::Models::Services::PagedResponse object instance

getMessage($self)

Method used to get message
Returns message from Report_HTML_DB::Models::Services::PagedResponse object instance

setElapsedMs($self, $elapsed_ms)

Method used to set elapsed miliseconds from request
Returns elapsed time in ms from Report_HTML_DB::Models::Services::PagedResponse object instance

getElapsedMs($self)

Method used to get elapsed time from request in miliseconds
Returns elapsed time in ms from Report_HTML_DB::Models::Services::PagedResponse object instance

setTotal($self, $total)

Method used to set total number of responses
Returns total number of responses from Report_HTML_DB::Models::Services::PagedResponse object instance

getTotal($self)

Method used to get total number of responses
Returns total number of responses from Report_HTML_DB::Models::Services::PagedResponse object instance

setOffset($self, $offset)

Method used to set number of offsets Returns offset number of responses from Report_HTML_DB::Models::Services::PagedResponse object instance

getOffset($self)

Method used to get number of offsets Returns offset number of responses from Report_HTML_DB::Models::Services::PagedResponse object instance

setPageSize($self, $page_size)

Method used to set number of page size Returns page size from Report_HTML_DB::Models::Services::PagedResponse object instance

getPageSize($self)

Method used to get number of page size Returns page size from Report_HTML_DB::Models::Services::PagedResponse object instance

Report_HTML_DB::Models::Application

This package sets applications objects that can be used to communicate every application related to report_html_db. The following objects compose this package:

Report_HTML_DB::Models::Application::AlienHunterSearch

This model represents an AlienHunter result

Properties:

Property Description
id ID from object
contig Contig name
start Start of annotation sequence
end End of annotation sequence
length Length of annotation sequence
score Score from alienhunter annoatation
threshold Threshold from alienhunter annotation
feature_id Feature ID from database

Usage:

my $sourceObject = Report_HTML_DB::Models::Application::AlienHunterSearch->new(
    id          => 6058946,
    contig      => "Contig_1",
    start       => 538351,
    end         => 545571,
    length      => "7221",
    score       => "35.131",
    threshold   => "18.501",
    feature_id  => 6057173,
);

Report_HTML_DB::Models::Application::Feature

This class will be used like a model responsible of result of features

Properties:

Property Description
feature_id Feature ID from database
name contig name
uniquename feature name
fstart Start of annotated sequence
fend End of annotated sequence
type Type of the feature(CDS, rrna_prediction, trna)
predictor Predictor name(Glimmer, etc.)

Usage:

my $sourceObject = Report_HTML_DB::Models::Application::Feature->new(
    feature_id => 6060362,
    uniquename => "3-isopropylmalate dehydratase large subunit ",
    name       => "Csp_0032",
    fstart     => 31314,
    fend       => 32753,
    type       => "CDS",
    predictor  => "Glimmer3",
);

Report_HTML_DB::Models::Application::NcRNASearch

Class used to represent non coding RNA search result

Properties:

Property Description
id Feature ID
contig Contig name
start Start position
end End position
evalue Evalue from annotation
description Description annotated
target_ID Identifier of match
target_name Target name
target_class Target class
target_type Target type

Usage:

my $sourceObject = Report_HTML_DB::Models::Application::NcRNASearch->new(
    id           => 6058960,
    contig       => "Contig_1",
    description  => "transfer-messenger RNA",
    start        => 95320,
    end          => 94943,
    evalue       => "1.4e-39",
    target_ID    => "RF00023",
    target_name  => "tmRNA",
    target_type  => "Gene;",
    target_class => "other"
);

Report_HTML_DB::Models::Application::RBSSearch

This class will be used to represent ribosomal binding site results

Properties:

Property Description
feature_id Feature ID
contig Contig name
start Start position
end End position
site_pattern Site pattern
old_start Old start position
old_position Old position
position_shift Position shift
new_start New start position

Usage:

my $sourceObject = Report_HTML_DB::Models::Application::RBSSearch->new(
    feature_id     => 6057173,
    contig         => "Contig_1",
    start          => 2094,
    end            => 2098,
    site_pattern   => "GGTAG",
    old_start      => "ATG",
    old_position   => "2048",
    position_shift => "0"
    new_start      => "ATG",
);

Report_HTML_DB::Models::Application::Subevidence

Class used to represent subevidence data

Properties:

Property Description
id Feature ID
program Component name
program_description Component description
start Start position
end End position
strand Strand
number Feature number
is_obsolete Is obsolete?
type Type

Usage:

my $sourceObject = Report_HTML_DB::Models::Application::Subevidence->new(
    id                  => 6059271,
    program             => "annotation_tmhmm.pl",
    program_description => "TMHMM - Transmembrane domains",
    start               => 0,
    end                 => 692,
    strand              => 0,
    number              => "2723",
    is_obsolete         => 0,
    type                => "intervals"
);

Report_HTML_DB::Models::Application::TranscriptionalTerminator

This class will be used to represent transcriptional terminator results

Properties:

Property Description
feature_id Feature ID
contig Contig
start Start position
end End position
confidence Confidence score
hairpin_score Hairpin score
tail_score Tail score

Usage:

my $sourceObject = Report_HTML_DB::Models::Application::TranscriptionalTerminator->new(
    start         => 243,
    confidence    => "76",
    contig        => "Contig_1",
    end           => 276,
    feature_id    => 6057173,
    hairpin_score => "-19",
    tail_score    => "-2.52464"
);

Report_HTML_DB::Models::Application::TRFSearch

This class will be used like a model responsible of results from tandem repeats annotation

Properties:

Property Description
feature_id Feature ID
contig Contig
start Start position
end End position
length Sequence length
sequence Sequence
copy_number Copy number

Usage:

my $sourceObject = Report_HTML_DB::Models::Application::TRFSearch->new(
    contig      => "Contig_1",
    end         => 1827,
    length      => "6",
    start       => 1811,
    feature_id  => 6057173,
    sequence    => "GCGCCT",
    copy_number => "2.8"
);

Report_HTML_DB::Models::Application::TRNASearch

This class will be used like a model responsible of results from tRNA annotations

Properties:

Property Description
id Feature ID
codon Codon
amino_acid Amino acid
sequence Sequence

Usage:

my $sourceObject = Report_HTML_DB::Models::Application::TRFSearch->new(
    codon      => "CTG",
    sequence   => "TGGGGTATGGTGTAATTGGCAACACAGCGGTTTCTGGTACCGTCGtTCTTGGTTCGAGTCCAGGTACCCCAG",
    amino_acid => "Gln",
    id         => 6058916
);

Clone this wiki locally