From: Jim Procter Date: Thu, 4 May 2017 13:09:44 +0000 (+0100) Subject: Merge branch 'features/JAL-2393customMatrices' into develop X-Git-Tag: Release_2_10_2~3^2~105^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e67e5f3a5b922e8a7729a0e9e9b174f46b11456c;hp=-c;p=jalview.git Merge branch 'features/JAL-2393customMatrices' into develop --- e67e5f3a5b922e8a7729a0e9e9b174f46b11456c diff --combined resources/lang/Messages.properties index 922f482,5ac4269..e63752d --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@@ -68,6 -68,7 +68,6 @@@ action.user_defined = User Defined.. action.by_conservation = By Conservation action.wrap = Wrap action.show_gaps = Show Gaps -action.show_occupancy = Show Occupancy action.show_hidden_markers = Show Hidden Markers action.find = Find action.undefine_groups = Undefine Groups @@@ -80,7 -81,8 +80,8 @@@ action.scale_left = Scale Lef action.scale_right = Scale Right action.by_tree_order = By Tree Order action.sort = Sort - action.calculate_tree = Calculate Tree + action.calculate_tree = Calculate Tree... + action.calculate_tree_pca = Calculate Tree or PCA... action.help = Help action.by_annotation = By Annotation... action.invert_sequence_selection = Invert Sequence Selection @@@ -170,6 -172,7 +171,7 @@@ label.redo_command = Redo {0 label.principal_component_analysis = Principal Component Analysis label.average_distance_identity = Average Distance Using % Identity label.neighbour_joining_identity = Neighbour Joining Using % Identity + label.choose_calculation = Choose Calculation label.treecalc_title = {0} Using {1} label.tree_calc_av = Average Distance label.tree_calc_nj = Neighbour Joining @@@ -177,6 -180,8 +179,8 @@@ label.select_score_model = Select scor label.score_model_pid = % Identity label.score_model_blosum62 = BLOSUM62 label.score_model_pam250 = PAM 250 + label.score_model_smithwatermanscore = Score between two sequences aligned with Smith-Waterman with default Peptide/Nucleotide matrix + label.score_model_sequencefeaturesimilarity = Distance measure of average number of features not shared at sequence positions label.score_model_conservation = Physicochemical property conservation label.score_model_enhconservation = Physicochemical property conservation label.status_bar = Status bar @@@ -333,6 -338,7 +337,7 @@@ label.colour_residues_above_occurrence label.set_this_label_text = set this label text label.sequences_from = Sequences from {0} label.successfully_loaded_file = Successfully loaded file {0} + label.successfully_loaded_matrix = Successfully loaded score matrix {0} label.successfully_saved_to_file_in_format = Successfully saved to file: {0} in {1} format. label.copied_sequences_to_clipboard = Copied {0} sequences to clipboard. label.check_file_matches_sequence_ids_alignment = Check that the file matches sequence IDs in the alignment. @@@ -379,11 -385,10 +384,10 @@@ label.invalid_selection = Invalid Selec label.principal_component_analysis_must_take_least_four_input_sequences = Principal component analysis must take\nat least 4 input sequences. label.sequence_selection_insufficient = Sequence selection insufficient label.you_need_more_two_sequences_selected_build_tree = You need to have more than two sequences selected to build a tree! + label.you_need_more_than_n_sequences = You need to have more than {0} sequences label.not_enough_sequences = Not enough sequences label.selected_region_to_tree_may_only_contain_residues_or_gaps = The selected region to create a tree may\nonly contain residues or gaps.\nTry using the Pad function in the edit menu,\nor one of the multiple sequence alignment web services. label.sequences_selection_not_aligned = Sequences in selection are not aligned - label.sequences_must_be_aligned_before_creating_tree = The sequences must be aligned before creating a tree.\nTry using the Pad function in the edit menu,\n or one of the multiple sequence alignment web services. - label.sequences_not_aligned = Sequences not aligned label.problem_reading_tree_file = Problem reading tree file label.possible_problem_with_tree_file = Possible problem with tree file label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation = Please select at least three bases in at least one sequence in order to perform a cDNA translation. @@@ -712,7 -717,6 +716,6 @@@ label.set_as_default = Set as Defaul label.show_labels = Show labels action.background_colour = Background Colour... label.associate_nodes_with = Associate Nodes With - label.jalview_pca_calculation = Jalview PCA Calculation label.link_name = Link Name label.pdb_file = PDB file label.colour_with_jmol = Colour with Jmol @@@ -855,7 -859,6 +858,6 @@@ label.couldnt_save_project = Couldn't s label.error_whilst_saving_current_state_to = Error whilst saving current state to {0} label.error_whilst_loading_project_from = Error whilst loading project from {0} label.couldnt_load_project = Couldn't load project - label.pca_sequences_not_aligned = The sequences must be aligned before calculating PCA.\nTry using the Pad function in the edit menu,\nor one of the multiple sequence alignment web services. label.invalid_name_preset_exists = Invalid name - preset already exists. label.invalid_name = Invalid name label.set_proxy_settings = Please set up your proxy settings in the 'Connections' tab of the Preferences window @@@ -899,6 -902,7 +901,7 @@@ label.choose_filename_for_param_file = label.save_as_html = Save as HTML label.recently_opened = Recently Opened label.blasting_for_unidentified_sequence_jobs_running = BLASTing for unidentified sequences - {0} jobs running. + label.tree = Tree label.tree_from = Tree from {0} label.webservice_job_title = {0} using {1} label.select_visible_region_of = selected {0} region of {1} @@@ -1299,9 -1303,3 +1302,9 @@@ warn.name_cannot_be_duplicate = User-de label.invalid_name = Invalid Name ! label.output_seq_details = Output Sequence Details to list all database references label.urllinks = Links +label.quality_descr = Alignment Quality based on Blosum62 scores +label.conservation_descr = Conservation of total alignment less than {0}% gaps +label.consensus_descr = PID +label.complement_consensus_descr = PID for cDNA +label.strucconsensus_descr = PID for base pairs +label.occupancy_descr = Number of aligned positions diff --combined resources/lang/Messages_es.properties index e6e1872,e959afd..6ddbb44 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@@ -78,7 -78,8 +78,8 @@@ action.scale_left = Escala izquierd action.scale_right = Escala derecha action.by_tree_order = Por orden del árbol action.sort = Ordenar - action.calculate_tree = Calcular árbol + action.calculate_tree = Calcular árbol... + action.calculate_tree_pca = Calcular árbol o ACP... action.help = Ayuda action.by_annotation = Por anotación... action.invert_sequence_selection = Invertir selección de secuencias @@@ -167,6 -168,7 +168,7 @@@ label.redo_command = Rehacer {0 label.principal_component_analysis = Análisis del Componente Principal label.average_distance_identity = Distancia Media Usando % de Identidad label.neighbour_joining_identity = Unir vecinos utilizando % de Identidad + label.choose_calculation = Elegir el cálculo label.treecalc_title = {0} utilizando {1} label.tree_calc_av = Distancia media label.tree_calc_nj = Unir vecinos @@@ -174,11 -176,12 +176,13 @@@ label.select_score_model = Selecciones label.score_model_pid = % Identidad label.score_model_blosum62 = BLOSUM62 label.score_model_pam250 = PAM 250 + label.score_model_smithwatermanscore = Puntuación entre secuencias alineadas por Smith-Waterman con matriz por defecto proteica / nucleotídica + label.score_model_sequencefeaturesimilarity = Medida de distancia por cuenta promedia de características no compartidas at sequence positions label.score_model_conservation = Conservación de las propiedades físico-químicas label.score_model_enhconservation = Conservación de las propiedades físico-químicas label.status_bar = Barra de estado label.out_to_textbox = Generar cuadro de texto +label.occupancy = Ocupación label.clustal = Clustal # label.colourScheme_ as in JalviewColourScheme label.colourScheme_clustal = Clustalx @@@ -302,6 -305,7 +306,7 @@@ label.colour_residues_above_occurrence label.set_this_label_text = fijar como etiqueta label.sequences_from = Secuencias de {0} label.successfully_loaded_file = Fichero cargado exitosamente {0} + label.successfully_loaded_matrix = Matriz cargada exitosamente {0} label.successfully_saved_to_file_in_format = Guardado exitosamente en el fichero: {0} en formato {1}. label.copied_sequences_to_clipboard = Copiadas {0} secuencias en el portapapeles. label.check_file_matches_sequence_ids_alignment = Comprobar que el fichero coincide con el ID de la secuencia en el alineamiento. @@@ -350,8 -354,6 +355,6 @@@ label.you_need_more_two_sequences_selec label.not_enough_sequences = No suficientes secuencias label.selected_region_to_tree_may_only_contain_residues_or_gaps = La regi\u00F3n seleccionada para construir un \u00E1rbol puede\ncontener s\u00F3lo residuos o espacios.\nPrueba usando la funci\u00F3n Pad en el men\u00FA de edici\u00F3n,\n o uno de los m\u00FAltiples servicios web de alineamiento de secuencias. label.sequences_selection_not_aligned = Las secuencias seleccionadas no están alineadas - label.sequences_must_be_aligned_before_creating_tree = Las secuencias deben estar alineadas antes de crear el \u00E1rbol.\nPrueba usando la funci\u00F3n Pad en el men\u00FA de editar,\n o uno de los m\u00FAltiples servicios web de alineamiento de secuencias. - label.sequences_not_aligned = Secuencias no alineadas label.problem_reading_tree_file = Problema al leer el fichero del árbol label.possible_problem_with_tree_file = Posible problema con el fichero del árbol label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation = Por favor seleccionar al menos tres bases de al menos una secuencia para poder realizar la traducción de cDNA. @@@ -414,7 -416,7 +417,7 @@@ label.colour_by_annotation = Color por label.selection_output_command = Seleccionar salida - {0} label.annotation_for_displayid =

Anotación para {0}

label.pdb_sequence_mapping = PDB - Mapeado de secuencia - label.pca_details = detalles de la PCA + label.pca_details = detalles de la ACP label.redundancy_threshold_selection = Selección del umbral de redundancia label.user_defined_colours = Colores definidos del usuario label.jalviewLite_release = JalviewLite - versión {0} @@@ -435,7 -437,7 +438,7 @@@ label.label = Etiquet label.no_features_added_to_this_alignment = No hay funciones asociadas a este alineamiento!! label.features_can_be_added_from_searches_1 = (Las funciones pueden ser añadidas de búsquedas o label.features_can_be_added_from_searches_2 = de ficheros de funciones Jalview / GFF) - label.calculating_pca= Calculando PCA + label.calculating_pca= Calculando ACP label.jalview_cannot_open_file = Jalview no puede abrir el fichero label.jalview_applet = Aplicación Jalview label.loading_data = Cargando datos @@@ -657,11 -659,9 +660,9 @@@ label.add_local_source = Añadir fuente label.set_as_default = Establecer por defecto label.show_labels = Mostrar etiquetas label.associate_nodes_with = Asociar nodos con label.link_name = Nombre del enalce label.pdb_file = Fichero PDB label.colour_with_jmol = Colorear con Jmol - label.align_structures = Alinear estructuras label.jmol = Jmol label.sort_alignment_by_tree = Ordenar alineamiento por árbol label.mark_unlinked_leaves = Marcar las hojas como no enlazadas @@@ -781,7 -781,6 +782,6 @@@ label.couldnt_save_project = No es posi label.error_whilst_saving_current_state_to = Error mientras se guardaba el estado a {0} label.error_whilst_loading_project_from = Error cargando el proyecto desde {0} label.couldnt_load_project = No es posible cargar el proyecto - label.pca_sequences_not_aligned = Las secuencias deben estar alineadas antes de calcular el PCA.\nPruebe a utilizar la funci\u00F3n de rellenar huecos en el men\u00FA Editar,\no cualquiera de los servicios web de alineamiento m\u00FAltiple. label.invalid_name_preset_exists = Nombre no válido - esta preconfiguración ya existe. label.invalid_name = Nombre no válido label.set_proxy_settings = Por favor, configure su proxy en la pestaña 'Conexiones' de la ventana de Preferencia @@@ -825,6 -824,7 +825,7 @@@ label.choose_filename_for_param_file = label.save_as_html = Guardar como HTML label.recently_opened = Abiertos recientemente label.blasting_for_unidentified_sequence_jobs_running = Ejecutando BLAST de las secuencias no indentificadas - {0} trabajos en marcha. + label.tree = Árbol label.tree_from = Árbol de {0} label.webservice_job_title = {0} usando {1} label.select_visible_region_of = seleccionada {0} región de {1} @@@ -835,7 -835,6 +836,7 @@@ label.webservice_job_title_on = {0} usa label.updating_vamsas_session = Actualizando sesión VAMSAS label.loading_file = Cargando fichero: {0} label.edit_params = Editar {0} +label.as_percentage = Como Porcentaje error.not_implemented = No implementado error.no_such_method_as_clone1_for = No existe ese método como un clone1 de {0} error.null_from_clone1 = Nulo de clone1! @@@ -942,8 -941,8 +943,8 @@@ label.submission_params = Envío {0 label.empty_alignment_job = Trabajo de alineamiento vacío label.add_new_sbrs_service = Añadir un nuevo SBRS label.edit_sbrs_entry = Editar entrada SBRS - label.pca_recalculating = Recalculando PCA - label.pca_calculating = Calculando PCA + label.pca_recalculating = Recalculando ACP + label.pca_calculating = Calculando ACP label.select_foreground_colour = Escoger color del primer plano label.select_colour_for_text = Seleccione el color del texto label.adjunst_foreground_text_colour_threshold = Ajustar el umbral del color del texto en primer plano @@@ -1230,7 -1229,7 +1231,7 @@@ label.select_all=Seleccionar Todo label.alpha_helix=Hélice Alfa label.chimera_help=Ayuda para Chimera label.find_tip=Buscar alineamiento, selección o IDs de secuencia para una subsecuencia (sin huecos) - label.structure_viewer=Visualizador de estructura for defecto + label.structure_viewer=Visualizador de estructura por defecto label.embbed_biojson=Incrustar BioJSON al exportar HTML label.transparency_tip=Ajustar la transparencia a "ver a través" los colores de las características. label.choose_annotations=Escoja anotaciones diff --combined src/jalview/gui/PCAPanel.java index 5b1aa37,0675cdf..e9ba1e7 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@@ -20,21 -20,22 +20,23 @@@ */ package jalview.gui; + import jalview.analysis.scoremodels.ScoreModels; + import jalview.analysis.scoremodels.SimilarityParams; + import jalview.api.analysis.ScoreModelI; + import jalview.api.analysis.SimilarityParamsI; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentView; import jalview.datamodel.ColumnSelection; - import jalview.datamodel.SeqCigar; import jalview.datamodel.SequenceI; import jalview.jbgui.GPCAPanel; - import jalview.schemes.ResidueProperties; import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; import jalview.viewmodel.PCAModel; import java.awt.BorderLayout; import java.awt.Color; +import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@@ -71,33 -72,50 +73,54 @@@ public class PCAPanel extends GPCAPane PCAModel pcaModel; + private static final int MIN_WIDTH = 470; + + private static final int MIN_HEIGHT = 250; + int top = 0; /** - * Creates a new PCAPanel object. + * Creates a new PCAPanel object using default score model and parameters * - * @param av - * DOCUMENT ME! - * @param s - * DOCUMENT ME! + * @param alignPanel + */ + public PCAPanel(AlignmentPanel alignPanel) + { + this(alignPanel, ScoreModels.getInstance() + .getDefaultModel(!alignPanel.av.getAlignment().isNucleotide()) + .getName(), SimilarityParams.SeqSpace); + } + + /** + * Constructor given sequence data, a similarity (or distance) score model + * name, and score calculation parameters + * + * @param alignPanel + * @param modelName + * @param params */ - public PCAPanel(AlignmentPanel ap) + public PCAPanel(AlignmentPanel alignPanel, String modelName, + SimilarityParamsI params) { super(); - this.av = ap.av; - this.ap = ap; + this.av = alignPanel.av; + this.ap = alignPanel; + boolean nucleotide = av.getAlignment().isNucleotide(); progressBar = new ProgressBar(statusPanel, statusBar); - boolean sameLength = true; + addInternalFrameListener(new InternalFrameAdapter() + { + @Override + public void internalFrameClosed(InternalFrameEvent e) + { + close_actionPerformed(); + } + }); + boolean selected = av.getSelectionGroup() != null && av.getSelectionGroup().getSize() > 0; AlignmentView seqstrings = av.getAlignmentView(selected); - boolean nucleotide = av.getAlignment().isNucleotide(); SequenceI[] seqs; if (!selected) { @@@ -107,41 -125,14 +130,14 @@@ { seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment()); } - SeqCigar sq[] = seqstrings.getSequences(); - int length = sq[0].getWidth(); - - for (int i = 0; i < seqs.length; i++) - { - if (sq[i].getWidth() != length) - { - sameLength = false; - break; - } - } - if (!sameLength) - { - JvOptionPane.showMessageDialog(Desktop.desktop, - MessageManager.getString("label.pca_sequences_not_aligned"), - MessageManager.getString("label.sequences_not_aligned"), - JvOptionPane.WARNING_MESSAGE); - - return; - } - - addInternalFrameListener(new InternalFrameAdapter() - { - @Override - public void internalFrameClosed(InternalFrameEvent e) - { - close_actionPerformed(); - } - }); - - pcaModel = new PCAModel(seqstrings, seqs, nucleotide); + ScoreModelI scoreModel = ScoreModels.getInstance().getScoreModel( + modelName, ap); + pcaModel = new PCAModel(seqstrings, seqs, nucleotide, scoreModel, + params); PaintRefresher.Register(this, av.getSequenceSetId()); - rc = new RotatableCanvas(ap); + rc = new RotatableCanvas(alignPanel); this.getContentPane().add(rc, BorderLayout.CENTER); Thread worker = new Thread(this); worker.start(); @@@ -156,40 -147,52 +152,52 @@@ pcaModel = null; } + /** + * Repopulate the options and actions under the score model menu when it is + * selected. Options will depend on whether 'nucleotide' or 'peptide' + * modelling is selected (and also possibly on whether any additional score + * models have been added). + */ @Override - protected void scoreMatrix_menuSelected() + protected void scoreModel_menuSelected() { - scoreMatrixMenu.removeAll(); - for (final String sm : ResidueProperties.scoreMatrices.keySet()) + scoreModelMenu.removeAll(); + for (final ScoreModelI sm : ScoreModels.getInstance().getModels()) { - if (ResidueProperties.getScoreMatrix(sm) != null) + final String name = sm.getName(); + JCheckBoxMenuItem jm = new JCheckBoxMenuItem(name); + + /* + * if the score model doesn't provide a description, try to look one + * up in the text bundle, falling back on its name + */ + String tooltip = sm.getDescription(); + if (tooltip == null) + { + tooltip = MessageManager.getStringOrReturn("label.score_model_", + name); + } + jm.setToolTipText(tooltip); + jm.setSelected(pcaModel.getScoreModelName().equals(name)); + if ((pcaModel.isNucleotide() && sm.isDNA()) + || (!pcaModel.isNucleotide() && sm.isProtein())) { - // create an entry for this score matrix for use in PCA - JCheckBoxMenuItem jm = new JCheckBoxMenuItem(); - jm.setText(MessageManager.getStringOrReturn("label.score_model_", - sm)); - jm.setSelected(pcaModel.getScore_matrix().equals(sm)); - if ((ResidueProperties.scoreMatrices.get(sm).isDNA() && ResidueProperties.scoreMatrices - .get(sm).isProtein()) - || pcaModel.isNucleotide() == ResidueProperties.scoreMatrices - .get(sm).isDNA()) + jm.addActionListener(new ActionListener() { - final PCAPanel us = this; - jm.addActionListener(new ActionListener() + @Override + public void actionPerformed(ActionEvent e) { - @Override - public void actionPerformed(ActionEvent e) + if (!pcaModel.getScoreModelName().equals(name)) { - if (!pcaModel.getScore_matrix().equals(sm)) - { - pcaModel.setScore_matrix(sm); - Thread worker = new Thread(us); - worker.start(); - } + ScoreModelI sm2 = ScoreModels.getInstance().getScoreModel( + name, ap); + pcaModel.setScoreModel(sm2); + Thread worker = new Thread(PCAPanel.this); + worker.start(); } - }); - scoreMatrixMenu.add(jm); - } + } + }); + scoreModelMenu.add(jm); } } } @@@ -236,7 -239,6 +244,6 @@@ // rc.invalidate(); nuclSetting.setSelected(pcaModel.isNucleotide()); protSetting.setSelected(!pcaModel.isNucleotide()); - jvVersionSetting.setSelected(pcaModel.isJvCalcMode()); top = pcaModel.getTop(); } catch (OutOfMemoryError er) @@@ -254,7 -256,6 +261,7 @@@ addKeyListener(rc); Desktop.addInternalFrame(this, MessageManager .getString("label.principal_component_analysis"), 475, 450); + this.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); } } @@@ -264,7 -265,8 +271,8 @@@ if (!pcaModel.isNucleotide()) { pcaModel.setNucleotide(true); - pcaModel.setScore_matrix("DNA"); + pcaModel.setScoreModel(ScoreModels.getInstance().getDefaultModel( + false)); Thread worker = new Thread(this); worker.start(); } @@@ -278,20 -280,13 +286,13 @@@ if (pcaModel.isNucleotide()) { pcaModel.setNucleotide(false); - pcaModel.setScore_matrix("BLOSUM62"); + pcaModel.setScoreModel(ScoreModels.getInstance() + .getDefaultModel(true)); Thread worker = new Thread(this); worker.start(); } } - @Override - protected void jvVersionSetting_actionPerfomed(ActionEvent arg0) - { - pcaModel.setJvCalcMode(jvVersionSetting.isSelected()); - Thread worker = new Thread(this); - worker.start(); - } - /** * DOCUMENT ME! */