App-Sandy
view release on metacpan or search on metacpan
lib/App/Sandy/DB/Handle/Quality.pm view on Meta::CPAN
log_msg ":: Found '$quality_profile'";
if (($rs && !$rs->is_user_provided) || $default_profile{$quality_profile}) {
die "'$quality_profile' is not a user provided entry. Cannot be deleted\n";
}
log_msg ":: Removing '$quality_profile' entry ...";
# Begin transation
my $guard = $schema->txn_scope_guard;
$rs->delete;
# End transation
$guard->commit;
}
sub restoredb {
my $self = shift;
my $schema = App::Sandy::DB->schema;
log_msg ":: Searching for user-provided entries ...";
my $user_provided = $schema->resultset('QualityProfile')->search(
{ is_user_provided => 1 },
);
my $entry = $user_provided->next;
if ($entry) {
log_msg ":: Found:";
do {
log_msg ' ==> ' . $entry->name;
} while ($entry = $user_provided->next);
} else {
die "Not found user-provided entries. There is no need to restoring\n";
}
log_msg ":: Removing all user-provided entries ...";
# Begin transation
my $guard = $schema->txn_scope_guard;
$user_provided->delete;
# End transation
$guard->commit;
}
sub make_report {
my $self = shift;
my $schema = App::Sandy::DB->schema;
my %report = %{ &DEFAULT_PROFILE };
my $rs = $schema->resultset('QualityProfile')->search(undef);
while (my $quality = $rs->next) {
my %hash = (
'mean' => $quality->mean,
'stdd' => $quality->stdd,
'error' => $quality->error,
'type' => $quality->is_single_molecule ? 'single-molecule' : 'fragment',
'source' => $quality->source,
'provider' => $quality->is_user_provided ? "user" : "vendor",
'date' => $quality->date
);
$report{$quality->name} = \%hash;
}
return \%report;
}
__END__
=pod
=encoding UTF-8
=head1 NAME
App::Sandy::DB::Handle::Quality - Class to handle quality database schemas.
=head1 VERSION
version 0.25
=head1 AUTHORS
=over 4
=item *
Thiago L. A. Miller <tmiller@mochsl.org.br>
=item *
J. Leonel Buzzo <lbuzzo@mochsl.org.br>
=item *
Felipe R. C. dos Santos <fsantos@mochsl.org.br>
=item *
Helena B. Conceição <hconceicao@mochsl.org.br>
=item *
Rodrigo Barreiro <rbarreiro@mochsl.org.br>
=item *
Gabriela Guardia <gguardia@mochsl.org.br>
=item *
Fernanda Orpinelli <forpinelli@mochsl.org.br>
=item *
Rafael Mercuri <rmercuri@mochsl.org.br>
( run in 1.472 second using v1.01-cache-2.11-cpan-b16cb0d3907 )