From 3400dfdc9adf0857f53736dfc1709d168ca7acfc Mon Sep 17 00:00:00 2001 From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04> Date: Thu, 11 Sep 2008 10:26:30 +0000 Subject: [PATCH] add ncbi searches git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@8767 ee4ac58c-ac51-4696-9907-e4b3aa274f04 --- etc/options | 13 +++- uk/ac/sanger/artemis/components/RunMenu.java | 66 ++++++++++++++++---- 2 files changed, 65 insertions(+), 14 deletions(-) diff --git a/etc/options b/etc/options index 37d54acc1..b4997da16 100644 --- a/etc/options +++ b/etc/options @@ -2,7 +2,7 @@ # (Note that comment lines start with a hash (#) symbol) -# $Header: //tmp/pathsoft/artemis/etc/options,v 1.49 2008-08-01 12:41:46 tjc Exp $ +# $Header: //tmp/pathsoft/artemis/etc/options,v 1.50 2008-09-11 10:23:37 tjc Exp $ # This file should contain option settings that look like this: # @@ -405,7 +405,7 @@ extra_keys = \ TMM signalP # this list is added to the keys from the feature_keys_gff file -extra_keys_gff = +extra_keys_gff = CDS # Names of qualifiers to search when attempting to find the primary or display # name of a gene. These qualifiers names are searched in order when looking @@ -773,6 +773,15 @@ feature_dna_programs = \ application_programs = \ jalview +ncbi_dna_search = \ + blastn http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?PAGE=Nucleotides&PROGRAM=blastn&MEGABLAST=on&BLAST_PROGRAMS=blastn&PAGE_TYPE=BlastSearch&DATABASE=nr&SHOW_DEFAULTS=on&QUERY= \ + blastx http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?PAGE=Translations&PROGRAM=blastx&BLAST_PROGRAMS=blastx&PAGE_TYPE=BlastSearch&SHOW_DEFAULTS=on&QUERY= \ + tblastx http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?PAGE=Translations&PROGRAM=tblastx&BLAST_PROGRAMS=tblastx&PAGE_TYPE=BlastSearch&SHOW_DEFAULTS=on&QUERY= + +ncbi_protein_search = \ + blastp http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?PAGE=Proteins&PROGRAM=blastp&BLAST_PROGRAMS=blastp&PAGE_TYPE=BlastSearch&QUERY= \ + tblastn http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?PAGE=Translations&PROGRAM=tblastn&BLAST_PROGRAMS=tblastn&PAGE_TYPE=BlastSearch&SHOW_DEFAULTS=on&QUERY= + mess_fasta_hits = 10 # this is the list of keys that should be displayed by default in the edit diff --git a/uk/ac/sanger/artemis/components/RunMenu.java b/uk/ac/sanger/artemis/components/RunMenu.java index a0cbf87db..882821f64 100644 --- a/uk/ac/sanger/artemis/components/RunMenu.java +++ b/uk/ac/sanger/artemis/components/RunMenu.java @@ -20,13 +20,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/components/RunMenu.java,v 1.10 2008-07-24 13:49:00 tjc Exp $ + * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/components/RunMenu.java,v 1.11 2008-09-11 10:26:30 tjc Exp $ **/ package uk.ac.sanger.artemis.components; import uk.ac.sanger.artemis.*; import uk.ac.sanger.artemis.util.ReadOnlyException; +import uk.ac.sanger.artemis.editor.BrowserControl; import uk.ac.sanger.artemis.io.EntryInformationException; import uk.ac.sanger.artemis.io.InvalidKeyException; @@ -43,7 +44,7 @@ import javax.swing.JMenuItem; * A JMenu of external commands/functions. * * @author Kim Rutherford - * @version $Id: RunMenu.java,v 1.10 2008-07-24 13:49:00 tjc Exp $ + * @version $Id: RunMenu.java,v 1.11 2008-09-11 10:26:30 tjc Exp $ **/ public class RunMenu extends SelectionMenu @@ -68,20 +69,25 @@ public class RunMenu extends SelectionMenu { super(frame, menu_name, selection); - final ExternalProgramVector external_programs = - Options.getOptions().getExternalPrograms(); + addNCBISearches(selection); + + if(Options.isUnixHost()) + { + final ExternalProgramVector external_programs = Options.getOptions() + .getExternalPrograms(); - boolean sanger_options = - Options.getOptions().getPropertyTruthValue("sanger_options"); + boolean sanger_options = Options.getOptions().getPropertyTruthValue( + "sanger_options"); - final int external_programs_size = external_programs.size(); - for(int i = 0; i < external_programs_size; ++i) - makeMenuItem(external_programs.elementAt(i), sanger_options); + final int external_programs_size = external_programs.size(); + for(int i = 0; i < external_programs_size; ++i) + makeMenuItem(external_programs.elementAt(i), sanger_options); - addSeparator(); + addSeparator(); - for(int i = 0; i < external_programs_size; ++i) - makeOptionsMenuItem(external_programs.elementAt(i)); + for(int i = 0; i < external_programs_size; ++i) + makeOptionsMenuItem(external_programs.elementAt(i)); + } } /** @@ -96,7 +102,43 @@ public class RunMenu extends SelectionMenu this(frame, selection, "Run"); } + /** + * Add menu for NCBI web searches + * @param selection + */ + private void addNCBISearches(final Selection selection) + { + final JMenu ncbiSearchLinks = new JMenu("NCBI Searches"); + add(ncbiSearchLinks); + + final ExternalProgramVector ncbi_protein = + Options.getOptions().getNCBIPrograms(); + + for(int i = 0; i < ncbi_protein.size(); ++i) + { + final ExternalProgram program = (ExternalProgram)ncbi_protein.elementAt(i); + final String programName = program.getName(); + final JMenuItem programMenu = new JMenuItem(programName); + ncbiSearchLinks.add(programMenu); + programMenu.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + final FeatureVector features = selection.getAllFeatures(); + final String residues; + + if(program.getType() == ExternalProgram.AA_PROGRAM) + residues = features.elementAt(0).getTranslation().toString().toUpperCase(); + else + residues = features.elementAt(0).getBases(); + + BrowserControl.displayURL(program.getProgramOptions()+residues); + } + }); + } + } + /** * Make a new menu item for running the given ExternalProgram object. * @param program Create two menu items for this program. -- GitLab