Commit a8e3eeef authored by Keith Jolley's avatar Keith Jolley
Browse files

Various updates to use new run_query method.

parent c1349f07
......@@ -461,8 +461,7 @@ sub _get_row {
{
$tooltip = $self->_get_designation_tooltip( $isolate_id, $locus, 'clashing' );
}
my $seqbin_length =
$self->{'datastore'}->run_simple_query( "SELECT length(sequence) FROM sequence_bin WHERE id=?", $match->{'seqbin_id'} )->[0];
my $seqbin_length = $self->{'datastore'}->run_query( "SELECT length(sequence) FROM sequence_bin WHERE id=?", $match->{'seqbin_id'} );
my $off_end;
my $hunt_for_start_end = ( !$exact && $params->{'hunt'} ) ? 1 : 0;
my $original_start = $match->{'predicted_start'};
......@@ -504,14 +503,14 @@ sub _get_row {
$predicted_end =~ s/\*//;
my $predicted_length = $predicted_end - $predicted_start + 1;
$predicted_length = 1 if $predicted_length < 1;
my $seq_ref =
my $seq =
$self->{'datastore'}
->run_simple_query( "SELECT substring(sequence from $predicted_start for $predicted_length) FROM sequence_bin WHERE id=?",
->run_query( "SELECT substring(sequence from $predicted_start for $predicted_length) FROM sequence_bin WHERE id=?",
$match->{'seqbin_id'} );
if ( ref $seq_ref eq 'ARRAY' ) {
$seq_ref->[0] = BIGSdb::Utils::reverse_complement( $seq_ref->[0] ) if $match->{'reverse'};
( $complete_gene, $status ) = $self->is_complete_gene( $seq_ref->[0], { return_status => 1 } );
if ($seq) {
$seq = BIGSdb::Utils::reverse_complement($seq) if $match->{'reverse'};
( $complete_gene, $status ) = $self->is_complete_gene( $seq, { return_status => 1 } );
if ($complete_gene) {
$complete_tooltip = "<a class=\"cds\" title=\"CDS - this is a complete coding sequence including start and "
. "terminating stop codons with no internal stop codons.\">CDS</a>";
......@@ -567,7 +566,6 @@ sub _get_row {
. "end=$predicted_end&amp;reverse=$match->{'reverse'}&amp;translate=$translate&amp;orf=$orf\">extract&nbsp;&rarr;</a>"
. "$complete_tooltip</td>";
$buffer .= "<td style=\"font-size:2em\">" . ( $match->{'reverse'} ? '&larr;' : '&rarr;' ) . "</td><td>";
my $sender = $self->{'datastore'}->run_simple_query( "SELECT sender FROM sequence_bin WHERE id=?", $match->{'seqbin_id'} )->[0];
my $seq_disabled = 0;
$cleaned_locus = $self->clean_checkbox_id($locus);
$cleaned_locus =~ s/\\/\\\\/g;
......
......@@ -231,7 +231,7 @@ sub run {
my $length = abs( $end - $start + 1 );
my $qry = "SELECT substring(sequence from $start for $length) AS seq,substring(sequence from ($start-$flanking) "
. "for $flanking) AS upstream,substring(sequence from ($end+1) for $flanking) AS downstream FROM sequence_bin WHERE id=?";
my $seq_ref = $self->{'datastore'}->run_simple_query_hashref( $qry, $match->{'seqbin_id'} );
my $seq_ref = $self->{'datastore'}->run_query( $qry, $match->{'seqbin_id'}, { fetch => 'row_hashref' } );
$seq_ref->{'seq'} = BIGSdb::Utils::reverse_complement( $seq_ref->{'seq'} ) if $match->{'reverse'};
$seq_ref->{'upstream'} = BIGSdb::Utils::reverse_complement( $seq_ref->{'upstream'} ) if $match->{'reverse'};
$seq_ref->{'downstream'} = BIGSdb::Utils::reverse_complement( $seq_ref->{'downstream'} ) if $match->{'reverse'};
......
......@@ -278,8 +278,8 @@ sub _print_interface {
} else {
$selected_ids = [];
}
my $seqbin_values = $self->{'datastore'}->run_simple_query("SELECT EXISTS(SELECT id FROM sequence_bin)");
if ( !$seqbin_values->[0] ) {
my $seqbin_values = $self->{'datastore'}->run_query("SELECT EXISTS(SELECT id FROM sequence_bin)");
if ( !$seqbin_values ) {
say "<div class=\"box\" id=\"statusbad\"><p>There are no sequences in the sequence bin.</p></div>";
return;
}
......
......@@ -241,8 +241,7 @@ sub run {
my $datatype = $q->param('datatype');
my $listfile_clause = defined $list_file ? "&amp;list_file=$list_file" : '';
my $datatype_clause = defined $datatype ? "&amp;datatype=$datatype" : '';
say
"<p id=\"links\"><a href='$self->{'system'}->{'script_name'}?db=$self->{'instance'}&amp;page=plugin&amp;name=FieldBreakdown&amp;"
say "<p id=\"links\"><a href='$self->{'system'}->{'script_name'}?db=$self->{'instance'}&amp;page=plugin&amp;name=FieldBreakdown&amp;"
. "function=summary_table$query_clause$listfile_clause$datatype_clause&amp;field=$name&amp;format=html'>Display table</a> | "
. "<a href='$self->{'system'}->{'script_name'}?db=$self->{'instance'}&amp;page=plugin&amp;name=FieldBreakdown&amp;"
. "function=summary_table$query_clause$listfile_clause$datatype_clause&amp;field=$name&amp;format=text'>Tab-delimited text</a> | "
......@@ -310,7 +309,7 @@ sub _create_chartdirector_chart {
sub _is_composite_field {
my ( $self, $field ) = @_;
my $is_composite = $self->{'datastore'}->run_simple_query( "SELECT COUNT(*) FROM composite_fields WHERE id=?", $field )->[0];
my $is_composite = $self->{'datastore'}->run_query( "SELECT EXISTS(SELECT * FROM composite_fields WHERE id=?)", $field );
return $is_composite;
}
......
......@@ -153,7 +153,7 @@ sub _print_software_versions {
my ($self) = @_;
my $q = $self->{'cgi'};
say "<h2>Software versions</h2>";
my $pg_version = $self->{'datastore'}->run_simple_query("SELECT version()")->[0];
my $pg_version = $self->{'datastore'}->run_query("SELECT version()");
say "<ul>";
say "<li>Perl $]</li>";
say "<li>$pg_version</li>";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment