Commit 0fd7a50e authored by Keith Jolley's avatar Keith Jolley
Browse files

Option to display isolate publication links in main results table.

parent 7357694e
#Written by Keith Jolley
#Copyright (c) 2010-2014, University of Oxford
#Copyright (c) 2010-2015, University of Oxford
#E-mail: keith.jolley@zoo.ox.ac.uk
#
#This file is part of Bacterial Isolate Genome Sequence Database (BIGSdb).
......@@ -1520,7 +1520,10 @@ sub get_citation_hash {
$citation .= "<i>$journal</i> <b>$volume</b>$pages";
$citation .= "</a>" if $options->{'link_pubmed'};
} else {
$citation = "$author $year $journal $volume$pages";
$citation = "$author $year ";
$citation .= "<a href=\"http://www.ncbi.nlm.nih.gov/pubmed/$pmid\">" if $options->{'link_pubmed'};
$citation .= "$journal $volume$pages";
$citation .= "</a>" if $options->{'link_pubmed'};
}
}
if ($citation) {
......
#Written by Keith Jolley
#Copyright (c) 2010-2013, University of Oxford
#Copyright (c) 2010-2015, University of Oxford
#E-mail: keith.jolley@zoo.ox.ac.uk
#
#This file is part of Bacterial Isolate Genome Sequence Database (BIGSdb).
......@@ -121,7 +121,7 @@ sub set_options {
if ( $self->{'system'}->{'dbtype'} eq 'isolates' ) {
foreach (
qw (mark_provisional_main mark_provisional sequence_details_main display_seqbin_main display_contig_count locus_alias
update_details sequence_details allele_flags sample_details)
update_details sequence_details allele_flags sample_details display_publications)
)
{
$prefstore->set_general( $guid, $dbname, $_, $prefs->{$_} ? 'on' : 'off' );
......@@ -246,7 +246,8 @@ sub _print_main_results_options {
-label => 'Display information about sequence bin records tagged with locus information (tooltip).'
},
{ -name => 'display_seqbin_main', -checked => $prefs->{'display_seqbin_main'}, -label => 'Display sequence bin size.' },
{ -name => 'display_contig_count', -checked => $prefs->{'display_contig_count'}, -label => 'Display contig count.' }
{ -name => 'display_contig_count', -checked => $prefs->{'display_contig_count'}, -label => 'Display contig count.' },
{ -name => 'display_publications', -checked => $prefs->{'display_publications'}, -label => 'Display publications.'}
];
say "<ul id=\"main_results\">";
......
......@@ -1856,7 +1856,7 @@ sub _initiate_isolatedb_prefs {
#Switches
foreach (
qw ( update_details sequence_details allele_flags mark_provisional mark_provisional_main sequence_details_main
display_seqbin_main display_contig_count locus_alias scheme_members_alias sample_details)
display_seqbin_main display_contig_count locus_alias scheme_members_alias sample_details display_publications)
)
{
$self->{'prefs'}->{$_} = $params->{$_} ? 1 : 0;
......@@ -1896,7 +1896,7 @@ sub _initiate_isolatedb_prefs {
#default off
foreach (
qw (update_details allele_flags scheme_members_alias sequence_details_main
display_seqbin_main display_contig_count locus_alias)
display_seqbin_main display_contig_count locus_alias display_publications)
)
{
$general_prefs->{$_} ||= 'off';
......
#Written by Keith Jolley
#Copyright (c) 2010-2014, University of Oxford
#Copyright (c) 2010-2015, University of Oxford
#E-mail: keith.jolley@zoo.ox.ac.uk
#
#This file is part of Bacterial Isolate Genome Sequence Database (BIGSdb).
......@@ -248,6 +248,7 @@ sub _print_delete_all_function {
$q->param( page => 'deleteAll' );
print $q->hidden($_) foreach qw (db page table query_file scheme_id list_file datatype);
if ( $table eq 'allele_designations' ) {
if ( $self->can_modify_table('allele_sequences') ) {
say "<ul><li>";
say $q->checkbox( -name => 'delete_tags', -label => 'Delete corresponding sequence tags' );
......@@ -501,6 +502,16 @@ sub _print_isolate_table {
print "<td>$stats->{'total_length'}</td>" if $self->{'prefs'}->{'display_seqbin_main'};
print "<td>$stats->{'contigs'}</td>" if $self->{'prefs'}->{'display_contig_count'};
}
if ( $self->{'prefs'}->{'display_publications'} ) {
my $pmids = $self->{'datastore'}->get_isolate_refs($id);
my $citations = $self->{'datastore'}->get_citation_hash( $pmids, { link_pubmed => 1 } );
my @formatted_list;
foreach my $pmid ( sort { $citations->{$a} cmp $citations->{$b} } @$pmids ) {
push @formatted_list, $citations->{$pmid};
}
local $" = '<br />';
print "<td>@formatted_list</td>";
}
#Print loci and scheme fields
my @scheme_ids;
......@@ -598,6 +609,7 @@ sub _print_isolate_table_header {
$fieldtype_header .= "</th>";
$fieldtype_header .= qq(<th rowspan="2">Seqbin size (bp)</th>) if $self->{'prefs'}->{'display_seqbin_main'};
$fieldtype_header .= qq(<th rowspan="2">Contigs</th>) if $self->{'prefs'}->{'display_contig_count'};
$fieldtype_header .= qq(<th rowspan="2">Publications</th>) if $self->{'prefs'}->{'display_publications'};
my $alias_sql = $self->{'db'}->prepare("SELECT alias FROM locus_aliases WHERE locus=?");
$logger->error($@) if $@;
local $" = '; ';
......@@ -697,7 +709,8 @@ sub _print_isolate_table_scheme {
$self->_initiate_urls_for_loci;
}
if ( !$self->{'designations_retrieved'}->{$isolate_id} ) {
$self->{'designations'}->{$isolate_id} = $self->{'datastore'}->get_all_allele_designations($isolate_id, {show_ignored => $self->{'curate'}});
$self->{'designations'}->{$isolate_id} =
$self->{'datastore'}->get_all_allele_designations( $isolate_id, { show_ignored => $self->{'curate'} } );
$self->{'designations_retrieved'}->{$isolate_id} = 1;
}
my $allele_designations = $self->{'designations'}->{$isolate_id};
......@@ -712,9 +725,9 @@ sub _print_isolate_table_scheme {
)
{
my $status;
if (( $allele_designations->{$locus}->{$allele_id} // '' ) eq 'provisional' && $self->{'prefs'}->{'mark_provisional_main'}){
if ( ( $allele_designations->{$locus}->{$allele_id} // '' ) eq 'provisional' && $self->{'prefs'}->{'mark_provisional_main'} ) {
$status = 'provisional';
} elsif (( $allele_designations->{$locus}->{$allele_id} // '' ) eq 'ignore'){
} elsif ( ( $allele_designations->{$locus}->{$allele_id} // '' ) eq 'ignore' ) {
$status = 'ignore';
}
my $display = '';
......@@ -1317,7 +1330,8 @@ sub _is_scheme_data_present {
#because even though the latter is faster, the former will need to be called to display
#the data in the table and the results can be cached.
if ( !$self->{'designations_retrieved'}->{$isolate_id} ) {
$self->{'designations'}->{$isolate_id} = $self->{'datastore'}->get_all_allele_designations($isolate_id,{show_ignored=>$self->{'curate'}});
$self->{'designations'}->{$isolate_id} =
$self->{'datastore'}->get_all_allele_designations( $isolate_id, { show_ignored => $self->{'curate'} } );
$self->{'designations_retrieved'}->{$isolate_id} = 1;
}
my $allele_designations = $self->{'designations'}->{$isolate_id};
......
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