action.remove = Remove
action.remove_redundancy = Remove Redundancy...
action.pairwise_alignment = Pairwise Alignment
-action.by_rna_helixes = By RNA Helices
action.user_defined = User Defined...
action.by_conservation = By Conservation
action.wrap = Wrap
label.score_model_enhconservation = Physicochemical property conservation
label.status_bar = Status bar
label.out_to_textbox = Output to Textbox
-label.clustalx = Clustalx
+# delete Clustal - use FileFormat name instead
label.clustal = Clustal
-label.zappo = Zappo
-label.taylor = Taylor
+# label.colourScheme_<schemeName> as in JalviewColourScheme
+label.colourScheme_clustal = Clustalx
+label.colourScheme_blosum62 = BLOSUM62 Score
+label.colourScheme_%_identity = Percentage Identity
+label.colourScheme_zappo = Zappo
+label.colourScheme_taylor = Taylor
+label.colourScheme_hydrophobic = Hydrophobicity
+label.colourScheme_helix_propensity = Helix Propensity
+label.colourScheme_strand_propensity = Strand Propensity
+label.colourScheme_turn_propensity = Turn Propensity
+label.colourScheme_buried_index = Buried Index
+label.colourScheme_purine/pyrimidine = Purine/Pyrimidine
+label.colourScheme_nucleotide = Nucleotide
+label.colourScheme_t-coffee_scores = T-Coffee Scores
+label.colourScheme_rna_helices = By RNA Helices
label.blc = BLC
label.fasta = Fasta
label.msf = MSF
label.pfam = PFAM
label.pileup = Pileup
label.pir = PIR
-label.hydrophobicity = Hydrophobicity
-label.helix_propensity = Helix Propensity
-label.strand_propensity = Strand Propensity
-label.turn_propensity = Turn Propensity
-label.buried_index = Buried Index
-label.purine_pyrimidine = Purine/Pyrimidine
-label.percentage_identity = Percentage Identity
-label.blosum62_score = BLOSUM62 Score
-label.tcoffee_scores = T-Coffee Scores
-label.average_distance_bloslum62 = Average Distance Using BLOSUM62
+label.average_distance_blosum62 = Average Distance Using BLOSUM62
label.neighbour_blosum62 = Neighbour Joining Using BLOSUM62
label.show_annotations = Show annotations
label.hide_annotations = Hide annotations
error.implementation_error_cannot_have_null_alignment = Implementation error: Cannot have null alignment property key
error.implementation_error_null_fileparse = Implementation error. Null FileParse in copy constructor
error.implementation_error_cannot_map_alignment_sequences = IMPLEMENTATION ERROR: Cannot map an alignment of sequences from different datasets into a single alignment in the vamsas document.
-error.implementation_error_cannot_duplicate_colour_scheme = Serious implementation error: cannot duplicate colourscheme {0}
error.implementation_error_structure_selection_manager_null = Implementation error. Structure selection manager's context is 'null'
exception.ssm_context_is_null = SSM context is null
error.idstring_seqstrings_only_one_per_sequence = idstrings and seqstrings contain one string each per sequence
exception.bad_pattern_to_regex_perl_code = bad pattern to Regex.perlCode: {0}
exception.no_stub_implementation_for_interface = There is no stub implementation for the interface: {0}
exception.cannot_set_endpoint_address_unknown_port = Cannot set Endpoint Address for Unknown Port {0}
-exception.querying_matching_opening_parenthesis_for_non_closing_parenthesis = Querying matching opening parenthesis for non-closing parenthesis character {0}
exception.mismatched_unseen_closing_char = Mismatched (unseen) closing character {0}
exception.mismatched_closing_char = Mismatched closing character {0}
exception.mismatched_opening_char = Mismatched opening character {0} at {1}
exception.application_test_npe = Application test: throwing an NullPointerException It should arrive at the console
exception.overwriting_vamsas_id_binding = Overwriting vamsas id binding
exception.overwriting_jalview_id_binding = Overwriting jalview id binding
-error.implementation_error_unknown_file_format_string = Implementation error: Unknown file format string
exception.failed_to_resolve_gzip_stream = Failed to resolve GZIP stream
exception.problem_opening_file_also_tried = Problem opening {0} (also tried {1}) : {2}
exception.problem_opening_file = Problem opening {0} : {1}
action.export_hidden_sequences = Export Hidden Sequences
action.export_features = Export Features
label.export_settings = Export Settings
-label.save_as_biojs_html = Save as BioJs HTML
label.pdb_web-service_error = PDB Web-service Error
label.structure_chooser_manual_association = Structure Chooser - Manual association
label.structure_chooser_filter_time = Structure Chooser - Filter time ({0})
action.remove = Eliminar
action.remove_redundancy = Eliminar redundancia...
action.pairwise_alignment = Alineamiento de pares...
-action.by_rna_helixes = Por hélices de RNA
action.user_defined = Definido por el usuario...
action.by_conservation = Por conservación
action.wrap = Envolver
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.clustalx = Clustalx
label.clustal = Clustal
-label.zappo = Zappo
-label.taylor = Taylor
+# label.colourScheme_<schemeName> as in JalviewColourScheme
+label.colourScheme_clustal = Clustalx
+label.colourScheme_blosum62 = Puntuación del BLOSUM62
+label.colourScheme_%_identity = Porcentaje de identidad
+label.colourScheme_zappo = Zappo
+label.colourScheme_taylor = Taylor
+label.colourScheme_hydrophobic = Hidrofobicidad
+label.colourScheme_helix_propensity = Tendencia de la hélice
+label.colourScheme_strand_propensity = Tendencia de la hebra
+label.colourScheme_turn_propensity = Tendencia de giro
+label.colourScheme_buried_index = Índice de encubrimiento
+label.colourScheme_purine/pyrimidine = Purina/Pirimidina
+label.colourScheme_nucleotide = Nucleótido
+label.colourScheme_t-coffee_scores = Puntuación del T-Coffee
+label.colourScheme_rna_helices = Por hélices de RNA
label.blc = BLC
label.fasta = Fasta
label.msf = MSF
label.pfam = PFAM
label.pileup = Pileup
label.pir = PIR
-label.hydrophobicity = Hidrofobicidad
-label.helix_propensity = Tendencia de la hélice
-label.strand_propensity = Tendencia de la hebra
-label.turn_propensity = Tendencia de giro
-label.buried_index = Índice de encubrimiento
-label.purine_pyrimidine = Purina/Pirimidina
-label.percentage_identity = Porcentaje de identidad
-label.blosum62_score = Puntuación del BLOSUM62
-label.tcoffee_scores = Puntuación del T-Coffee
-label.average_distance_bloslum62 = Distancia Media Usando BLOSUM62
+label.average_distance_blosum62 = Distancia Media Usando BLOSUM62
label.neighbour_blosum62 = Neighbour Joining usando BLOSUM62
label.show_annotations = Mostrar anotaciones
label.colour_text = Color del texto
error.implementation_error_cannot_have_null_alignment = Error de implementación: no es posible tener una clave nula en el alineamiento
error.implementation_error_null_fileparse = Error de implementación. FileParse nulo en el construictor de copia
error.implementation_error_cannot_map_alignment_sequences = Error de implementación: no es posible maper un alineamiento de secuencias desde distintos conjuntos de datos en un único alineamiento en el documento VAMSAS.
-error.implementation_error_cannot_duplicate_colour_scheme = Error grave de implementación: no es posible duplicar el esquema cromático {0}
error.implementation_error_structure_selection_manager_null = Error de implementación. El contexto structure selection manager's es nulo
exception.ssm_context_is_null = El contexto SSM es nulo
error.idstring_seqstrings_only_one_per_sequence = idstrings y seqstrings contienen una cadena por cada secuencia
exception.bad_pattern_to_regex_perl_code = patrón erróneo en Regex.perlCode: {0}
exception.no_stub_implementation_for_interface = No existe una implementación del stub para la interfaz: {0}
exception.cannot_set_endpoint_address_unknown_port = No es posible estabelcer la dirección de punto final para el puerto desconocido {0}
-exception.querying_matching_opening_parenthesis_for_non_closing_parenthesis = Consultando la coincidencia de apertura de paréntesis para paréntesis sin cerrar (?)
exception.mismatched_unseen_closing_char = Discordancia (no vista) en el carácter de cierre {0}
exception.mismatched_closing_char = Carácter de cierre discordante {0}
exception.mismatched_opening_char = Carácter de apertura discordante {0} en {1}
exception.application_test_npe = Prueba de aplicación: lanzando un NullPointerException que debe aparecer en la consola
exception.overwriting_vamsas_id_binding = Sobreescribiendo la asociación al VAMSAS id
exception.overwriting_jalview_id_binding = Sobreescribiendo la asociación al Jalview id
-error.implementation_error_unknown_file_format_string = Error de implementación: cadena de formato de fichero desconocido
exception.failed_to_resolve_gzip_stream = Fallo al resolver el flujo GZIP
exception.problem_opening_file_also_tried = Problema abriendo {0} (también se intentó {1}) : {2}
exception.problem_opening_file = Problema abriendo {0} : {1}
info.select_filter_option=Escoger Opción de Filtro / Entrada Manual
info.invalid_msa_input_mininfo=Necesita por lo menos dos secuencias con al menos 3 residuos cada una, sin regiones ocultas entre ellas.
label.chimera_missing=Visualizador de estructura Chimera no encontrado.<br/>Por favor, introduzca la ruta de Chimera,<br/>o descargar e instalar la UCSF Chimera.
-label.save_as_biojs_html=Guardar como HTML BioJs
exception.fts_server_unreachable=Jalview no puede conectar con el servidor {0}. \nPor favor asegúrese de que está conectado a Internet y vuelva a intentarlo.
exception.outofmemory_loading_mmcif_file=Sin memoria al cargar el fichero mmCIF
label.hide_columns_not_containing=Ocultar las columnas que no contengan
zbuffer.addItemListener(this);
charge.setLabel(MessageManager.getString("label.charge_cysteine"));
charge.addActionListener(this);
- hydro.setLabel(MessageManager.getString("label.hydrophobicity"));
+ hydro.setLabel(MessageManager
+ .getString("label.colourScheme_hydrophobic"));
hydro.addActionListener(this);
chain.setLabel(MessageManager.getString("action.by_chain"));
chain.addActionListener(this);
.setLabel(MessageManager.getString("label.all_chains_visible"));
allchains.addItemListener(this);
viewMenu.setLabel(MessageManager.getString("action.view"));
- zappo.setLabel(MessageManager.getString("label.zappo"));
+ zappo.setLabel(MessageManager.getString("label.colourScheme_zappo"));
zappo.addActionListener(this);
- taylor.setLabel(MessageManager.getString("label.taylor"));
+ taylor.setLabel(MessageManager.getString("label.colourScheme_taylor"));
taylor.addActionListener(this);
- helix.setLabel(MessageManager.getString("label.helix_propensity"));
+ helix.setLabel(MessageManager
+ .getString("label.colourScheme_helix_propensity"));
helix.addActionListener(this);
- strand.setLabel(MessageManager.getString("label.strand_propensity"));
+ strand.setLabel(MessageManager
+ .getString("label.colourScheme_strand_propensity"));
strand.addActionListener(this);
- turn.setLabel(MessageManager.getString("label.turn_propensity"));
+ turn.setLabel(MessageManager
+ .getString("label.colourScheme_turn_propensity"));
turn.addActionListener(this);
- buried.setLabel(MessageManager.getString("label.buried_index"));
+ buried.setLabel(MessageManager
+ .getString("label.colourScheme_buried_index"));
buried.addActionListener(this);
user.setLabel(MessageManager.getString("action.user_defined"));
user.addActionListener(this);
allchains_itemStateChanged(e);
}
});
- zappo.setText(MessageManager.getString("label.zappo"));
+ zappo.setText(MessageManager.getString("label.colourScheme_zappo"));
zappo.addActionListener(new ActionListener()
{
@Override
zappo_actionPerformed(e);
}
});
- taylor.setText(MessageManager.getString("label.taylor"));
+ taylor.setText(MessageManager.getString("label.colourScheme_taylor"));
taylor.addActionListener(new ActionListener()
{
@Override
taylor_actionPerformed(e);
}
});
- hydro.setText(MessageManager.getString("label.hydrophobicity"));
+ hydro.setText(MessageManager
+ .getString("label.colourScheme_hydrophobic"));
hydro.addActionListener(new ActionListener()
{
@Override
hydro_actionPerformed(e);
}
});
- helix.setText(MessageManager.getString("label.helix_propensity"));
+ helix.setText(MessageManager
+ .getString("label.colourScheme_helix_propensity"));
helix.addActionListener(new ActionListener()
{
@Override
helix_actionPerformed(e);
}
});
- strand.setText(MessageManager.getString("label.strand_propensity"));
+ strand.setText(MessageManager
+ .getString("label.colourScheme_strand_propensity"));
strand.addActionListener(new ActionListener()
{
@Override
strand_actionPerformed(e);
}
});
- turn.setText(MessageManager.getString("label.turn_propensity"));
+ turn.setText(MessageManager
+ .getString("label.colourScheme_turn_propensity"));
turn.addActionListener(new ActionListener()
{
@Override
turn_actionPerformed(e);
}
});
- buried.setText(MessageManager.getString("label.buried_index"));
+ buried.setText(MessageManager
+ .getString("label.colourScheme_buried_index"));
buried.addActionListener(new ActionListener()
{
@Override
.getString("action.create_group"));
createGroupMenuItem.addActionListener(this);
- nucleotideMenuItem.setLabel(MessageManager
- .getString("label.nucleotide"));
- nucleotideMenuItem.addActionListener(this);
- purinePyrimidineMenuItem.setLabel(MessageManager
- .getString("label.purine_pyrimidine"));
- purinePyrimidineMenuItem.addActionListener(this);
- conservationMenuItem.addItemListener(this);
- abovePIDColour.addItemListener(this);
colourMenu.setLabel(MessageManager.getString("label.group_colour"));
showBoxes.setLabel(MessageManager.getString("action.boxes"));
showBoxes.setState(true);
noColourmenuItem.setLabel(MessageManager.getString("label.none"));
noColourmenuItem.addActionListener(this);
- clustalColour.setLabel(MessageManager.getString("label.clustalx"));
+ clustalColour.setLabel(MessageManager
+ .getString("label.colourScheme_clustal"));
clustalColour.addActionListener(this);
- zappoColour.setLabel(MessageManager.getString("label.zappo"));
+ zappoColour.setLabel(MessageManager
+ .getString("label.colourScheme_zappo"));
zappoColour.addActionListener(this);
- taylorColour.setLabel(MessageManager.getString("label.taylor"));
+ taylorColour.setLabel(MessageManager
+ .getString("label.colourScheme_taylor"));
taylorColour.addActionListener(this);
hydrophobicityColour.setLabel(MessageManager
- .getString("label.hydrophobicity"));
+ .getString("label.colourScheme_hydrophobic"));
hydrophobicityColour.addActionListener(this);
- helixColour
- .setLabel(MessageManager.getString("label.helix_propensity"));
+ helixColour.setLabel(MessageManager
+ .getString("label.colourScheme_helix_propensity"));
helixColour.addActionListener(this);
strandColour.setLabel(MessageManager
- .getString("label.strand_propensity"));
+ .getString("label.colourScheme_strand_propensity"));
strandColour.addActionListener(this);
- turnColour.setLabel(MessageManager.getString("label.turn_propensity"));
+ turnColour.setLabel(MessageManager
+ .getString("label.colourScheme_turn_propensity"));
turnColour.addActionListener(this);
- buriedColour.setLabel(MessageManager.getString("label.buried_index"));
+ buriedColour.setLabel(MessageManager
+ .getString("label.colourScheme_buried_index"));
buriedColour.addActionListener(this);
abovePIDColour.setLabel(MessageManager
.getString("label.above_identity_threshold"));
.getString("action.user_defined"));
userDefinedColour.addActionListener(this);
PIDColour.setLabel(MessageManager
- .getString("label.percentage_identity"));
+ .getString("label.colourScheme_%_identity"));
PIDColour.addActionListener(this);
BLOSUM62Colour.setLabel(MessageManager
- .getString("label.blosum62_score"));
+ .getString("label.colourScheme_blosum62"));
BLOSUM62Colour.addActionListener(this);
conservationMenuItem.setLabel(MessageManager
.getString("label.conservation"));
+ nucleotideMenuItem.setLabel(MessageManager
+ .getString("label.colourScheme_nucleotide"));
+ nucleotideMenuItem.addActionListener(this);
+ purinePyrimidineMenuItem.setLabel(MessageManager
+ .getString("label.colourScheme_purine/pyrimidine"));
+ purinePyrimidineMenuItem.addActionListener(this);
+ conservationMenuItem.addItemListener(this);
+ abovePIDColour.addItemListener(this);
editMenu.add(copy);
copy.addActionListener(this);
import jalview.schemes.NucleotideColourScheme;
import jalview.schemes.PIDColourScheme;
import jalview.schemes.PurinePyrimidineColourScheme;
+import jalview.schemes.RNAHelicesColour;
import jalview.schemes.RNAHelicesColourChooser;
import jalview.schemes.StrandColourScheme;
import jalview.schemes.TCoffeeColourScheme;
// }
else if (source == RNAHelixColour)
{
- new RNAHelicesColourChooser(viewport, alignPanel);
+ changeColour(new RNAHelicesColour(viewport.getAlignment()));
+ // new RNAHelicesColourChooser(viewport, alignPanel);
}
else if (source == modifyPID)
{
.getString("label.apply_colour_to_all_groups"));
applyToAllGroups.setState(true);
applyToAllGroups.addItemListener(this);
- clustalColour.setLabel(MessageManager.getString("label.clustalx"));
+ clustalColour.setLabel(MessageManager
+ .getString("label.colourScheme_clustal"));
clustalColour.addActionListener(this);
- zappoColour.setLabel(MessageManager.getString("label.zappo"));
+ zappoColour.setLabel(MessageManager
+ .getString("label.colourScheme_zappo"));
zappoColour.addActionListener(this);
- taylorColour.setLabel(MessageManager.getString("label.taylor"));
+ taylorColour.setLabel(MessageManager
+ .getString("label.colourScheme_taylor"));
taylorColour.addActionListener(this);
hydrophobicityColour.setLabel(MessageManager
- .getString("label.hydrophobicity"));
+ .getString("label.colourScheme_hydrophobic"));
hydrophobicityColour.addActionListener(this);
- helixColour
- .setLabel(MessageManager.getString("label.helix_propensity"));
+ helixColour.setLabel(MessageManager
+ .getString("label.colourScheme_helix_propensity"));
helixColour.addActionListener(this);
strandColour.setLabel(MessageManager
- .getString("label.strand_propensity"));
+ .getString("label.colourScheme_strand_propensity"));
strandColour.addActionListener(this);
- turnColour.setLabel(MessageManager.getString("label.turn_propensity"));
+ turnColour.setLabel(MessageManager
+ .getString("label.colourScheme_turn_propensity"));
turnColour.addActionListener(this);
- buriedColour.setLabel(MessageManager.getString("label.buried_index"));
+ buriedColour.setLabel(MessageManager
+ .getString("label.colourScheme_buried_index"));
buriedColour.addActionListener(this);
purinePyrimidineColour.setLabel(MessageManager
- .getString("label.purine_pyrimidine"));
+ .getString("label.colourScheme_purine/pyrimidine"));
purinePyrimidineColour.addActionListener(this);
// RNAInteractionColour.setLabel(MessageManager
// .getString("label.rna_interaction"));
// RNAInteractionColour.addActionListener(this);
RNAHelixColour.setLabel(MessageManager
- .getString("action.by_rna_helixes"));
+ .getString("label.colourScheme_rna_helices"));
RNAHelixColour.addActionListener(this);
userDefinedColour.setLabel(MessageManager
.getString("action.user_defined"));
userDefinedColour.addActionListener(this);
PIDColour.setLabel(MessageManager
- .getString("label.percentage_identity"));
+ .getString("label.colourScheme_%_identity"));
PIDColour.addActionListener(this);
BLOSUM62Colour.setLabel(MessageManager
- .getString("label.blosum62_score"));
+ .getString("label.colourScheme_blosum62"));
BLOSUM62Colour.addActionListener(this);
- tcoffeeColour
- .setLabel(MessageManager.getString("label.tcoffee_scores"));
+ tcoffeeColour.setLabel(MessageManager
+ .getString("label.colourScheme_t-coffee_scores"));
// it will be enabled only if a score file is provided
tcoffeeColour.setEnabled(false);
tcoffeeColour.addActionListener(this);
abovePIDThreshold.setLabel(MessageManager
.getString("label.above_identity_threshold"));
abovePIDThreshold.addItemListener(this);
- nucleotideColour.setLabel(MessageManager.getString("label.nucleotide"));
+ nucleotideColour.setLabel(MessageManager
+ .getString("label.colourScheme_nucleotide"));
nucleotideColour.addActionListener(this);
modifyPID.setLabel(MessageManager
.getString("label.modify_identity_threshold"));
.getString("label.neighbour_joining_identity"));
neighbourTreeMenuItem.addActionListener(this);
avDistanceTreeBlosumMenuItem.setLabel(MessageManager
- .getString("label.average_distance_bloslum62"));
+ .getString("label.average_distance_blosum62"));
avDistanceTreeBlosumMenuItem.addActionListener(this);
njTreeBlosumMenuItem.setLabel(MessageManager
.getString("label.neighbour_blosum62"));
import jalview.datamodel.AlignmentI;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
-import jalview.io.FileParse;
import jalview.io.DataSourceType;
+import jalview.io.FileParse;
import jalview.io.StructureFile;
import jalview.schemes.BuriedColourScheme;
import jalview.schemes.HelixColourScheme;
MenuItem charge = new MenuItem(
MessageManager.getString("label.charge_cysteine"));
- MenuItem zappo = new MenuItem(MessageManager.getString("label.zappo"));
+ MenuItem zappo = new MenuItem(
+ MessageManager.getString("label.colourScheme_zappo"));
- MenuItem taylor = new MenuItem(MessageManager.getString("label.taylor"));
+ MenuItem taylor = new MenuItem(
+ MessageManager.getString("label.colourScheme_taylor"));
MenuItem hydro = new MenuItem(
- MessageManager.getString("label.hydrophobicity"));
+ MessageManager.getString("label.colourScheme_hydrophobic"));
MenuItem helix = new MenuItem(
- MessageManager.getString("label.helix_propensity"));
+ MessageManager.getString("label.colourScheme_helix_propensity"));
MenuItem strand = new MenuItem(
- MessageManager.getString("label.strand_propensity"));
+ MessageManager.getString("label.colourScheme_strand_propensity"));
MenuItem turn = new MenuItem(
- MessageManager.getString("label.turn_propensity"));
+ MessageManager.getString("label.colourScheme_turn_propensity"));
MenuItem buried = new MenuItem(
- MessageManager.getString("label.buried_index"));
+ MessageManager.getString("label.colourScheme_buried_index"));
MenuItem purinepyrimidine = new MenuItem(
- MessageManager.getString("label.purine_pyrimidine"));
+ MessageManager.getString("label.colourScheme_purine/pyrimidine"));
MenuItem user = new MenuItem(
MessageManager.getString("label.user_defined_colours"));
import jalview.io.NewickFile;
import jalview.io.TCoffeeScoreFile;
import jalview.jbgui.GAlignFrame;
-import jalview.schemes.Blosum62ColourScheme;
-import jalview.schemes.BuriedColourScheme;
-import jalview.schemes.ClustalxColourScheme;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ColourSchemeProperty;
-import jalview.schemes.HelixColourScheme;
-import jalview.schemes.HydrophobicColourScheme;
-import jalview.schemes.NucleotideColourScheme;
-import jalview.schemes.PIDColourScheme;
-import jalview.schemes.PurinePyrimidineColourScheme;
-import jalview.schemes.RNAHelicesColour;
-import jalview.schemes.RNAHelicesColourChooser;
+import jalview.schemes.ColourSchemes;
import jalview.schemes.ResidueColourScheme;
import jalview.schemes.ResidueProperties;
-import jalview.schemes.StrandColourScheme;
import jalview.schemes.TCoffeeColourScheme;
-import jalview.schemes.TaylorColourScheme;
-import jalview.schemes.TurnColourScheme;
import jalview.schemes.UserColourScheme;
-import jalview.schemes.ZappoColourScheme;
import jalview.util.MessageManager;
import jalview.viewmodel.AlignmentViewport;
import jalview.ws.DBRefFetcher;
import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.print.PageFormat;
import java.awt.print.PrinterJob;
import java.util.List;
import java.util.Vector;
+import javax.swing.ButtonGroup;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JEditorPane;
import javax.swing.JInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
+import javax.swing.JRadioButtonMenuItem;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
alignPanel);
if (viewport.getAlignmentConservationAnnotation() == null)
{
- BLOSUM62Colour.setEnabled(false);
+ // BLOSUM62Colour.setEnabled(false);
conservationMenuItem.setEnabled(false);
modifyConservation.setEnabled(false);
// PIDColour.setEnabled(false);
sortPairwiseMenuItem_actionPerformed(null);
}
- if (Desktop.desktop != null)
- {
- this.setDropTarget(new java.awt.dnd.DropTarget(this, this));
- addServiceListeners();
- setGUINucleotide(viewport.getAlignment().isNucleotide());
- }
-
this.alignPanel.av
.setShowAutocalculatedAbove(isShowAutoCalculatedAbove());
setMenusFromViewport(viewport);
buildSortByAnnotationScoresMenu();
buildTreeMenu();
+ buildColourMenu();
+
+ if (Desktop.desktop != null)
+ {
+ this.setDropTarget(new java.awt.dnd.DropTarget(this, this));
+ addServiceListeners();
+ setGUINucleotide();
+ }
if (viewport.getWrapAlignment())
{
/**
* Configure menu items that vary according to whether the alignment is
* nucleotide or protein
- *
- * @param nucleotide
*/
- public void setGUINucleotide(boolean nucleotide)
+ public void setGUINucleotide()
{
+ boolean nucleotide = viewport.getAlignment().isNucleotide();
+
showTranslation.setVisible(nucleotide);
showReverse.setVisible(nucleotide);
showReverseComplement.setVisible(nucleotide);
modifyConservation.setEnabled(!nucleotide);
showGroupConservation.setEnabled(!nucleotide);
+ AlignmentI al = getViewport().getAlignment();
+
/*
- * enable / disable colour schemes
- * - the old, simple way (based on the nucleotide flag), or
- * - the new, generic way (interrogate the colour scheme)
+ * enable / disable colour schemes by querying whether they
+ * are applicable to the alignment data (for example, peptide or
+ * nucleotide specific, or require certain annotation present)
*/
- AlignmentI al = getViewport().getAlignment();
- clustalColour.setEnabled(!nucleotide);
- zappoColour.setEnabled(!nucleotide);
- taylorColour.setEnabled(!nucleotide);
- hydrophobicityColour.setEnabled(!nucleotide);
- helixColour.setEnabled(!nucleotide);
- strandColour.setEnabled(!nucleotide);
- turnColour.setEnabled(!nucleotide);
- // buriedColour.setEnabled(!nucleotide);
- // TODO make isApplicableTo static in ColourSchemeI in Java 8
- buriedColour.setEnabled(new BuriedColourScheme().isApplicableTo(al));
- rnahelicesColour.setEnabled(nucleotide);
- nucleotideColour.setEnabled(nucleotide);
- // purinePyrimidineColour.setEnabled(nucleotide);
- purinePyrimidineColour.setEnabled(new PurinePyrimidineColourScheme()
- .isApplicableTo(al));
- tcoffeeColour
- .setEnabled(new TCoffeeColourScheme(al).isApplicableTo(al));
- // RNAInteractionColour.setEnabled(nucleotide);
+ for (Component menuItem : colourMenu.getMenuComponents())
+ {
+ if (menuItem instanceof JRadioButtonMenuItem)
+ {
+ String colourName = ((JRadioButtonMenuItem) menuItem).getName();
+ ColourSchemeI cs = ColourSchemes.getInstance().getColourScheme(
+ colourName, viewport);
+ if (cs != null)
+ {
+ ((JRadioButtonMenuItem) menuItem).setEnabled(cs
+ .isApplicableTo(al));
+ }
+ }
+ }
+
showComplementMenuItem.setText(nucleotide ? MessageManager
.getString("label.protein") : MessageManager
.getString("label.nucleotide"));
autoCalculate.setSelected(av.autoCalculateConsensus);
sortByTree.setSelected(av.sortByTree);
listenToViewSelections.setSelected(av.followSelection);
- // rnahelicesColour.setEnabled(av.getAlignment().hasRNAStructure());
- rnahelicesColour.setEnabled(new RNAHelicesColour(av.getAlignment())
- .isApplicableTo(av.getAlignment()));
- rnahelicesColour
- .setSelected(av.getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
showProducts.setEnabled(canShowProducts());
setGroovyEnabled(Desktop.getGroovyConsole() != null);
changeColour(null);
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void clustalColour_actionPerformed()
- {
- changeColour(new ClustalxColourScheme(viewport.getAlignment(),
- viewport.getHiddenRepSequences()));
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void zappoColour_actionPerformed()
- {
- changeColour(new ZappoColourScheme());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void taylorColour_actionPerformed()
- {
- changeColour(new TaylorColourScheme());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void hydrophobicityColour_actionPerformed()
- {
- changeColour(new HydrophobicColourScheme());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void helixColour_actionPerformed()
- {
- changeColour(new HelixColourScheme());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void strandColour_actionPerformed()
- {
- changeColour(new StrandColourScheme());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void turnColour_actionPerformed()
- {
- changeColour(new TurnColourScheme());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void buriedColour_actionPerformed()
- {
- changeColour(new BuriedColourScheme());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void nucleotideColour_actionPerformed()
- {
- changeColour(new NucleotideColourScheme());
- }
-
- @Override
- public void purinePyrimidineColour_actionPerformed()
- {
- changeColour(new PurinePyrimidineColourScheme());
- }
-
/*
* public void covariationColour_actionPerformed() {
* changeColour(new
new AnnotationColumnChooser(viewport, alignPanel);
}
+ /**
+ * Action on the user checking or unchecking the option to apply the selected
+ * colour scheme to all groups. If unchecked, groups may have their own
+ * independent colour schemes.
+ *
+ */
@Override
- public void rnahelicesColour_actionPerformed()
+ protected void applyToAllGroups_actionPerformed()
{
- new RNAHelicesColourChooser(viewport, alignPanel);
+ viewport.setColourAppliesToAllGroups(applyToAllGroups.isSelected());
}
/**
- * DOCUMENT ME!
+ * Action on user selecting a colour from the colour menu
*
+ * @param name
+ * the name (not the menu item label!) of the colour scheme
*/
- @Override
- protected void applyToAllGroups_actionPerformed()
+ public void changeColour_actionPerformed(String name)
{
- viewport.setColourAppliesToAllGroups(applyToAllGroups.isSelected());
+ ColourSchemeI cs = ColourSchemes.getInstance().getColourScheme(name,
+ viewport);
+ changeColour(cs);
}
/**
- * DOCUMENT ME!
+ * Actions on setting or changing the alignment colour scheme
*
* @param cs
- * DOCUMENT ME!
*/
@Override
public void changeColour(ColourSchemeI cs)
cs.setConservationInc(SliderPanel.setConservationSlider(alignPanel,
cs, "Background"));
}
- if (cs instanceof TCoffeeColourScheme)
- {
- tcoffeeColour.setEnabled(true);
- tcoffeeColour.setSelected(true);
- }
}
viewport.setGlobalColourScheme(cs);
}
/**
- * Action on the user selecting either a named user-defined colour from the
- * colour menu, or the option "User Defined" to create or load a new colour
- * scheme.
+ * Action on the user selecting the option "User Defined" to create or load a
+ * new colour scheme
*
* @param e
*/
@Override
public void userDefinedColour_actionPerformed(ActionEvent e)
{
- if (e.getActionCommand().equals(
- MessageManager.getString("action.user_defined")))
- {
- /*
- * User Defined... option; open panel to
- * load / create / apply / save user defined colour
- */
- new UserDefinedColours(alignPanel, null);
- }
- else
- {
- /*
- * User chose an existing user defined colour
- */
- UserColourScheme udc = UserDefinedColours
- .getUserColourSchemes().get(e.getActionCommand());
- changeColour(udc);
- }
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void PIDColour_actionPerformed()
- {
- changeColour(new PIDColourScheme());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void BLOSUM62Colour_actionPerformed()
- {
- changeColour(new Blosum62ColourScheme());
+ new UserDefinedColours(alignPanel, null);
}
/**
}
}
- @Override
- protected void tcoffeeColorScheme_actionPerformed()
- {
- changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));
- }
-
public TreePanel ShowNewickTree(NewickFile nf, String title)
{
return ShowNewickTree(nf, title, 600, 500, 4, 5);
{
if (tcf.annotateAlignment(viewport.getAlignment(), true))
{
- tcoffeeColour.setEnabled(true);
- tcoffeeColour.setSelected(true);
+ // tcoffeeColour.setEnabled(true);
+ // tcoffeeColour.setSelected(true);
+ for (Component menuItem : colourMenu.getMenuComponents())
+ {
+ if (menuItem instanceof JRadioButtonMenuItem
+ && ((JRadioButtonMenuItem) menuItem).getText()
+ .equals("T-Coffee Scores"))
+ {
+ ((JRadioButtonMenuItem) menuItem).setSelected(true);
+ }
+ }
+ buildColourMenu();
changeColour(new TCoffeeColourScheme(viewport.getAlignment()));
isAnnotation = true;
statusBar
true,
(actionEvent.getModifiers() & (ActionEvent.META_MASK | ActionEvent.CTRL_MASK)) != 0);
}
+
+ /**
+ * Rebuilds the Colour menu, including any user-defined colours which have
+ * been loaded either on startup or during the session
+ */
+ public void buildColourMenu()
+ {
+ colourMenu.removeAll();
+
+ /*
+ * ButtonGroup groups those items whose
+ * selection is mutually exclusive
+ */
+ ButtonGroup colours = new ButtonGroup();
+
+ colourMenu.add(applyToAllGroups);
+ colourMenu.add(textColour);
+ colourMenu.addSeparator();
+ colourMenu.add(noColourmenuItem);
+ colours.add(noColourmenuItem);
+
+ /*
+ * scan registered colour schemes (built-in or user-defined
+ * and add them to the menu (in the order they were added)
+ */
+ Iterable<ColourSchemeI> colourSchemes = ColourSchemes.getInstance()
+ .getColourSchemes();
+ for (ColourSchemeI scheme : colourSchemes)
+ {
+ /*
+ * button text is i18n'd but the name is the canonical name of
+ * the colour scheme (inspected in changeColour_actionPerformed)
+ */
+ final String name = scheme.getSchemeName();
+ String label = MessageManager.getString("label.colourScheme_"
+ + name.toLowerCase().replace(" ", "_"));
+ final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(label);
+ radioItem.setName(name);
+ if (scheme instanceof UserColourScheme)
+ {
+ /*
+ * user-defined colour scheme loaded on startup or during the
+ * Jalview session; right-click on this offers the option to
+ * remove it as a colour choice
+ */
+ radioItem.setText(((UserColourScheme) scheme).getName());
+ radioItem.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mousePressed(MouseEvent evt)
+ {
+ if (evt.isPopupTrigger()) // Mac
+ {
+ offerRemoval();
+ }
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent evt)
+ {
+ if (evt.isPopupTrigger()) // Windows
+ {
+ offerRemoval();
+ }
+ }
+
+ void offerRemoval()
+ {
+ ActionListener al = radioItem.getActionListeners()[0];
+ radioItem.removeActionListener(al);
+ int option = JvOptionPane.showInternalConfirmDialog(
+ Desktop.desktop, MessageManager
+ .getString("label.remove_from_default_list"),
+ MessageManager
+ .getString("label.remove_user_defined_colour"),
+ JvOptionPane.YES_NO_OPTION);
+ if (option == JvOptionPane.YES_OPTION)
+ {
+ UserDefinedColours.removeColourFromDefaults(radioItem
+ .getName());
+ ColourSchemes.getInstance().removeColourScheme(
+ radioItem.getName());
+ colourMenu.remove(radioItem);
+ }
+ else
+ {
+ radioItem.addActionListener(al);
+ }
+ }
+ });
+ }
+ radioItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent evt)
+ {
+ changeColour_actionPerformed(name);
+ }
+ });
+ colourMenu.add(radioItem);
+ colours.add(radioItem);
+ }
+
+ colourMenu.add(userDefinedColour);
+ colours.add(userDefinedColour);
+
+ colourMenu.addSeparator();
+ colourMenu.add(conservationMenuItem);
+ colourMenu.add(modifyConservation);
+ colourMenu.add(abovePIDThreshold);
+ colourMenu.add(modifyPID);
+ colourMenu.add(annotationColour);
+
+ setColourSelected(Cache.getDefault(Preferences.DEFAULT_COLOUR,
+ ResidueColourScheme.NONE));
+
+ setGUINucleotide();
+ }
}
class PrintThread extends Thread
}
});
- clustalColour.setText(MessageManager.getString("label.clustalx"));
+ clustalColour.setText(MessageManager
+ .getString("label.colourScheme_clustal"));
clustalColour.setName(JalviewColourScheme.Clustal.toString());
clustalColour.addActionListener(new ActionListener()
{
clustalColour_actionPerformed();
}
});
- zappoColour.setText(MessageManager.getString("label.zappo"));
+ zappoColour.setText(MessageManager
+ .getString("label.colourScheme_zappo"));
zappoColour.setName(JalviewColourScheme.Zappo.toString());
zappoColour.addActionListener(new ActionListener()
{
zappoColour_actionPerformed();
}
});
- taylorColour.setText(MessageManager.getString("label.taylor"));
+ taylorColour.setText(MessageManager
+ .getString("label.colourScheme_taylor"));
taylorColour.setName(JalviewColourScheme.Taylor.toString());
taylorColour.addActionListener(new ActionListener()
{
}
});
hydrophobicityColour.setText(MessageManager
- .getString("label.hydrophobicity"));
+ .getString("label.colourScheme_hydrophobic"));
hydrophobicityColour
.setName(JalviewColourScheme.Hydrophobic.toString());
hydrophobicityColour.addActionListener(new ActionListener()
hydrophobicityColour_actionPerformed();
}
});
- helixColour.setText(MessageManager.getString("label.helix_propensity"));
+ helixColour.setText(MessageManager
+ .getString("label.colourScheme_helix_propensity"));
helixColour.setName(JalviewColourScheme.Helix.toString());
helixColour.addActionListener(new ActionListener()
{
}
});
strandColour.setText(MessageManager
- .getString("label.strand_propensity"));
+ .getString("label.colourScheme_strand_propensity"));
strandColour.setName(JalviewColourScheme.Strand.toString());
strandColour.addActionListener(new ActionListener()
{
strandColour_actionPerformed();
}
});
- turnColour.setText(MessageManager.getString("label.turn_propensity"));
+ turnColour.setText(MessageManager
+ .getString("label.colourScheme_turn_propensity"));
turnColour.setName(JalviewColourScheme.Turn.toString());
turnColour.addActionListener(new ActionListener()
{
turnColour_actionPerformed();
}
});
- buriedColour.setText(MessageManager.getString("label.buried_index"));
+ buriedColour.setText(MessageManager
+ .getString("label.colourScheme_buried_index"));
buriedColour.setName(JalviewColourScheme.Buried.toString());
buriedColour.addActionListener(new ActionListener()
{
});
userDefinedColour.setText(MessageManager
.getString("action.user_defined"));
- userDefinedColour.setName(JalviewColourScheme.UserDefined.toString());
userDefinedColour.addActionListener(new ActionListener()
{
@Override
}
});
PIDColour
- .setText(MessageManager.getString("label.percentage_identity"));
+.setText(MessageManager
+ .getString("label.colourScheme_%_identity"));
PIDColour.setName(JalviewColourScheme.PID.toString());
PIDColour.addActionListener(new ActionListener()
{
}
});
BLOSUM62Colour
- .setText(MessageManager.getString("label.blosum62_score"));
+.setText(MessageManager
+ .getString("label.colourScheme_blosum62"));
BLOSUM62Colour.setName(JalviewColourScheme.Blosum62.toString());
BLOSUM62Colour.addActionListener(new ActionListener()
{
BLOSUM62Colour_actionPerformed();
}
});
- nucleotideColour.setText(MessageManager.getString("label.nucleotide"));
+ nucleotideColour.setText(MessageManager
+ .getString("label.colourScheme_nucleotide"));
nucleotideColour.setName(JalviewColourScheme.Nucleotide.toString());
nucleotideColour.addActionListener(new ActionListener()
{
}
});
purinePyrimidineColour.setText(MessageManager
- .getString("label.purine_pyrimidine"));
+ .getString("label.colourScheme_purine/pyrimidine"));
purinePyrimidineColour.setName(JalviewColourScheme.PurinePyrimidine
.toString());
purinePyrimidineColour.addActionListener(new ActionListener()
}
});
- tcoffeeColour.setText(MessageManager.getString("label.tcoffee_scores"));
+ tcoffeeColour.setText(MessageManager
+ .getString("label.colourScheme_t-coffee_scores"));
tcoffeeColour.setName(JalviewColourScheme.TCoffee.toString());
tcoffeeColour.addActionListener(new ActionListener()
{
import jalview.io.JalviewFileView;
import jalview.jbgui.GPreferences;
import jalview.jbgui.GSequenceLink;
-import jalview.schemes.JalviewColourScheme;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ColourSchemes;
import jalview.schemes.ResidueColourScheme;
import jalview.util.MessageManager;
import jalview.util.Platform;
*/
protColour.addItem(ResidueColourScheme.NONE);
nucColour.addItem(ResidueColourScheme.NONE);
- for (JalviewColourScheme cs : JalviewColourScheme.values())
+ for (ColourSchemeI cs : ColourSchemes.getInstance().getColourSchemes())
{
- if (cs != JalviewColourScheme.UserDefined)
- {
- protColour.addItem(cs.toString());
- nucColour.addItem(cs.toString());
- }
+ String name = cs.getSchemeName();
+ protColour.addItem(name);
+ nucColour.addItem(name);
}
String oldProp = Cache.getDefault(DEFAULT_COLOUR,
ResidueColourScheme.NONE);
import jalview.schemabinding.version2.Colour;
import jalview.schemabinding.version2.JalviewUserColours;
import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ColourSchemes;
import jalview.schemes.ResidueProperties;
import jalview.schemes.UserColourScheme;
import jalview.util.ColorUtils;
/*
* add to the cache in this object
*/
- userColourSchemes.put(schemeName.getText(), getSchemeFromButtons());
+ UserColourScheme ucs = getSchemeFromButtons();
+ String name = schemeName.getText();
+ userColourSchemes.put(name, ucs);
+
+ ColourSchemes.getInstance().registerColourScheme(ucs);
/*
* update the Colour menu items
coloursFound.append("|");
}
coloursFound.append(file);
- userColourSchemes.put(ucs.getSchemeName(), ucs);
+ String name = ucs.getName();
+ userColourSchemes.put(name, ucs);
+ ColourSchemes.getInstance().registerColourScheme(ucs);
}
} catch (Exception ex)
{
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.api.SplitContainerI;
import jalview.bin.Cache;
-import jalview.gui.Desktop;
-import jalview.gui.JvOptionPane;
import jalview.gui.JvSwingUtils;
import jalview.gui.Preferences;
-import jalview.gui.UserDefinedColours;
import jalview.io.FileFormat;
-import jalview.schemes.JalviewColourScheme;
-import jalview.schemes.ResidueColourScheme;
-import jalview.schemes.UserColourScheme;
import jalview.util.MessageManager;
import jalview.util.Platform;
protected JRadioButtonMenuItem textColour;
- protected JRadioButtonMenuItem clustalColour;
-
- protected JRadioButtonMenuItem zappoColour;
-
- protected JRadioButtonMenuItem taylorColour;
-
- protected JRadioButtonMenuItem hydrophobicityColour;
-
- protected JRadioButtonMenuItem helixColour;
-
- protected JRadioButtonMenuItem strandColour;
-
- protected JRadioButtonMenuItem turnColour;
-
- protected JRadioButtonMenuItem buriedColour;
-
protected JRadioButtonMenuItem userDefinedColour;
- protected JRadioButtonMenuItem PIDColour;
-
- protected JRadioButtonMenuItem BLOSUM62Colour;
-
- protected JRadioButtonMenuItem nucleotideColour;
-
- protected JRadioButtonMenuItem purinePyrimidineColour;
-
- protected JRadioButtonMenuItem RNAInteractionColour;
-
- // protected JRadioButtonMenuItem covariationColour;
-
- protected JRadioButtonMenuItem tcoffeeColour;
-
protected JCheckBoxMenuItem annotationPanelMenuItem = new JCheckBoxMenuItem();
protected JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem();
protected JCheckBoxMenuItem conservationMenuItem;
- JRadioButtonMenuItem noColourmenuItem;
+ protected JRadioButtonMenuItem noColourmenuItem;
protected JCheckBoxMenuItem wrapMenuItem = new JCheckBoxMenuItem();
protected JCheckBoxMenuItem showDbRefsMenuitem = new JCheckBoxMenuItem();
- protected ButtonGroup colours = new ButtonGroup();
-
protected JMenuItem showTranslation = new JMenuItem();
protected JMenuItem showReverse = new JMenuItem();
protected JMenuItem runGroovy = new JMenuItem();
- protected JMenuItem rnahelicesColour;
-
protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem();
protected JCheckBoxMenuItem sortByTree = new JCheckBoxMenuItem();
private void jbInit() throws Exception
{
initColourMenu();
- buildColourMenu();
JMenuItem saveAs = new JMenuItem(
MessageManager.getString("action.save_as"));
JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem(
- MessageManager.getString("label.average_distance_bloslum62"));
+ MessageManager.getString("label.average_distance_blosum62"));
avDistanceTreeBlosumMenuItem.addActionListener(new ActionListener()
{
@Override
}
/**
- * Rebuilds the Colour menu, including any user-defined colours which have
- * been loaded either on startup or during the session
- */
- public void buildColourMenu()
- {
- colourMenu.removeAll();
- colours = new ButtonGroup();
-
- colourMenu.add(applyToAllGroups);
- colourMenu.add(textColour);
- colourMenu.addSeparator();
- colourMenu.add(noColourmenuItem);
- colourMenu.add(clustalColour);
- colourMenu.add(BLOSUM62Colour);
- colourMenu.add(PIDColour);
- colourMenu.add(zappoColour);
- colourMenu.add(taylorColour);
- colourMenu.add(hydrophobicityColour);
- colourMenu.add(helixColour);
- colourMenu.add(strandColour);
- colourMenu.add(turnColour);
- colourMenu.add(buriedColour);
- colourMenu.add(nucleotideColour);
- colourMenu.add(purinePyrimidineColour);
- // colourMenu.add(RNAInteractionColour);
- // colourMenu.add(covariationColour);
- colourMenu.add(tcoffeeColour);
-
- /*
- * add any user-defined colours
- */
- Map<String, UserColourScheme> userColourSchemes = UserDefinedColours
- .getUserColourSchemes();
- if (userColourSchemes != null)
- {
- for (String userColour : userColourSchemes.keySet())
- {
- final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(
- userColour);
- radioItem.setName(userColour);
- radioItem.addMouseListener(new MouseAdapter()
- {
- @Override
- public void mousePressed(MouseEvent evt)
- {
- if (evt.isPopupTrigger()) // Mac
- {
- offerRemoval();
- }
- }
-
- @Override
- public void mouseReleased(MouseEvent evt)
- {
- if (evt.isPopupTrigger()) // Windows
- {
- offerRemoval();
- }
- }
-
- void offerRemoval()
- {
- radioItem.removeActionListener(radioItem.getActionListeners()[0]);
-
- int option = JvOptionPane.showInternalConfirmDialog(
- Desktop.desktop, MessageManager
- .getString("label.remove_from_default_list"),
- MessageManager
- .getString("label.remove_user_defined_colour"),
- JvOptionPane.YES_NO_OPTION);
- if (option == JvOptionPane.YES_OPTION)
- {
- UserDefinedColours.removeColourFromDefaults(radioItem
- .getText());
- colourMenu.remove(radioItem);
- }
- else
- {
- radioItem.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent evt)
- {
- userDefinedColour_actionPerformed(evt);
- }
- });
- }
- }
- });
- radioItem.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent evt)
- {
- userDefinedColour_actionPerformed(evt);
- }
- });
- colourMenu.add(radioItem);
- colours.add(radioItem);
- }
- }
-
- colourMenu.add(userDefinedColour);
- colourMenu.addSeparator();
- colourMenu.add(conservationMenuItem);
- colourMenu.add(modifyConservation);
- colourMenu.add(abovePIDThreshold);
- colourMenu.add(modifyPID);
- colourMenu.add(annotationColour);
- colourMenu.add(rnahelicesColour);
-
- /*
- * add colours to a ButtonGroup to make their
- * selection mutually exclusive
- */
- colours.add(noColourmenuItem);
- colours.add(clustalColour);
- colours.add(zappoColour);
- colours.add(taylorColour);
- colours.add(hydrophobicityColour);
- colours.add(helixColour);
- colours.add(strandColour);
- colours.add(turnColour);
- colours.add(buriedColour);
- colours.add(userDefinedColour);
- colours.add(PIDColour);
- colours.add(BLOSUM62Colour);
- colours.add(nucleotideColour);
- colours.add(purinePyrimidineColour);
- // colours.add(covariationColour);
- colours.add(tcoffeeColour);
- // colours.add(RNAInteractionColour);
- setColourSelected(Cache.getDefault(Preferences.DEFAULT_COLOUR,
- ResidueColourScheme.NONE));
-
- }
-
- /**
* Constructs the entries on the Colour menu (but does not add them to the
* menu). The 'name' property of each item is set to the canonical name of the
* corresponding colour scheme (may not match the display name), to allow
textColour_actionPerformed();
}
});
- clustalColour = new JRadioButtonMenuItem(
- MessageManager.getString("label.clustalx"));
- clustalColour.setName(JalviewColourScheme.Clustal.toString());
- clustalColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- clustalColour_actionPerformed();
- }
- });
- zappoColour = new JRadioButtonMenuItem(
- MessageManager.getString("label.zappo"));
- zappoColour.setName(JalviewColourScheme.Zappo.toString());
- zappoColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- zappoColour_actionPerformed();
- }
- });
- taylorColour = new JRadioButtonMenuItem(
- MessageManager.getString("label.taylor"));
- taylorColour.setName(JalviewColourScheme.Taylor.toString());
- taylorColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- taylorColour_actionPerformed();
- }
- });
- hydrophobicityColour = new JRadioButtonMenuItem(
- MessageManager
- .getString("label.hydrophobicity"));
- hydrophobicityColour
- .setName(JalviewColourScheme.Hydrophobic.toString());
- hydrophobicityColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- hydrophobicityColour_actionPerformed();
- }
- });
- helixColour = new JRadioButtonMenuItem(
- MessageManager.getString("label.helix_propensity"));
- helixColour.setName(JalviewColourScheme.Helix.toString());
- helixColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- helixColour_actionPerformed();
- }
- });
- strandColour = new JRadioButtonMenuItem(
- MessageManager
- .getString("label.strand_propensity"));
- strandColour.setName(JalviewColourScheme.Strand.toString());
- strandColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- strandColour_actionPerformed();
- }
- });
- turnColour = new JRadioButtonMenuItem(
- MessageManager.getString("label.turn_propensity"));
- turnColour.setName(JalviewColourScheme.Turn.toString());
- turnColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- turnColour_actionPerformed();
- }
- });
- buriedColour = new JRadioButtonMenuItem(
- MessageManager.getString("label.buried_index"));
- buriedColour.setName(JalviewColourScheme.Buried.toString());
- buriedColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- buriedColour_actionPerformed();
- }
- });
+
userDefinedColour = new JRadioButtonMenuItem(
MessageManager
.getString("action.user_defined"));
- userDefinedColour.setName(JalviewColourScheme.UserDefined.toString());
userDefinedColour.addActionListener(new ActionListener()
{
@Override
userDefinedColour_actionPerformed(e);
}
});
- PIDColour = new JRadioButtonMenuItem(
- MessageManager.getString("label.percentage_identity"));
- PIDColour.setName(JalviewColourScheme.PID.toString());
- PIDColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- PIDColour_actionPerformed();
- }
- });
- BLOSUM62Colour = new JRadioButtonMenuItem(
- MessageManager.getString("label.blosum62_score"));
- BLOSUM62Colour.setName(JalviewColourScheme.Blosum62.toString());
- BLOSUM62Colour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- BLOSUM62Colour_actionPerformed();
- }
- });
- nucleotideColour = new JRadioButtonMenuItem(
- MessageManager.getString("label.nucleotide"));
- nucleotideColour.setName(JalviewColourScheme.Nucleotide.toString());
- nucleotideColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- nucleotideColour_actionPerformed();
- }
- });
- purinePyrimidineColour = new JRadioButtonMenuItem(
- MessageManager.getString("label.purine_pyrimidine"));
- purinePyrimidineColour.setName(JalviewColourScheme.PurinePyrimidine.toString());
- purinePyrimidineColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- purinePyrimidineColour_actionPerformed();
- }
- });
-
- tcoffeeColour = new JRadioButtonMenuItem(
- MessageManager.getString("label.tcoffee_scores"));
- tcoffeeColour.setName(JalviewColourScheme.TCoffee.toString());
- tcoffeeColour.setEnabled(false);
- tcoffeeColour.addActionListener(new ActionListener()
- {
-
- @Override
- public void actionPerformed(ActionEvent e)
- {
- tcoffeeColorScheme_actionPerformed();
- }
- });
-
- // RNAInteractionColour = new JRadioButtonMenuItem("RNA Interaction type");
- // RNAInteractionColour.setName("RNA Interaction");
- // RNAInteractionColour.addActionListener(new ActionListener()
- // {
- // @Override
- // public void actionPerformed(ActionEvent e)
- // {
- // RNAInteractionColour_actionPerformed();
- // }
- // });
- /*
- * covariationColour = new JRadioButtonMenuItem("Covariation");
- * covariationColour.addActionListener(new ActionListener() { public void
- * actionPerformed(ActionEvent e) { covariationColour_actionPerformed(); }
- * });
- */
conservationMenuItem = new JCheckBoxMenuItem(
MessageManager.getString("action.by_conservation"));
annotationColour_actionPerformed();
}
});
-
- rnahelicesColour = new JMenuItem(
- MessageManager.getString("action.by_rna_helixes"));
- rnahelicesColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- rnahelicesColour_actionPerformed();
- }
- });
}
protected void selectHighlightedColumns_actionPerformed(
{
}
- protected void clustalColour_actionPerformed()
- {
- }
-
- protected void zappoColour_actionPerformed()
- {
- }
-
- protected void taylorColour_actionPerformed()
- {
- }
-
- protected void hydrophobicityColour_actionPerformed()
- {
- }
-
- protected void helixColour_actionPerformed()
- {
- }
-
- protected void strandColour_actionPerformed()
- {
- }
-
- protected void turnColour_actionPerformed()
- {
- }
-
- protected void buriedColour_actionPerformed()
- {
- }
-
protected void userDefinedColour_actionPerformed(ActionEvent e)
{
}
- protected void PIDColour_actionPerformed()
- {
- }
-
- protected void BLOSUM62Colour_actionPerformed()
- {
- }
-
- protected void purinePyrimidineColour_actionPerformed()
- {
- }
-
- protected void RNAInteractionColour_actionPerformed()
- {
- }
+
/*
* protected void covariationColour_actionPerformed() { }
{
}
- protected void nucleotideColour_actionPerformed()
- {
- }
-
protected void deleteGroups_actionPerformed(ActionEvent e)
{
}
}
- /**
- * Template method to handle the 'Color T-Coffee scores' menu event.
- * <p>
- * Subclasses override this method to provide a custom action.
- */
- protected void tcoffeeColorScheme_actionPerformed()
- {
-
- }
-
protected void jpred_actionPerformed(ActionEvent e)
{
}
{
}
- public void rnahelicesColour_actionPerformed()
- {
-
- }
-
public void associatedData_actionPerformed(ActionEvent e)
{
}
});
zappoColour = new JRadioButtonMenuItem();
- zappoColour.setText(MessageManager.getString("label.zappo"));
+ zappoColour.setText(MessageManager
+ .getString("label.colourScheme_zappo"));
zappoColour.addActionListener(new ActionListener()
{
@Override
}
});
taylorColour = new JRadioButtonMenuItem();
- taylorColour.setText(MessageManager.getString("label.taylor"));
+ taylorColour.setText(MessageManager
+ .getString("label.colourScheme_taylor"));
taylorColour.addActionListener(new ActionListener()
{
@Override
}
});
hydroColour = new JRadioButtonMenuItem();
- hydroColour.setText(MessageManager.getString("label.hydrophobicity"));
+ hydroColour.setText(MessageManager
+ .getString("label.colourScheme_hydrophobic"));
hydroColour.addActionListener(new ActionListener()
{
@Override
});
strandColour = new JRadioButtonMenuItem();
strandColour.setText(MessageManager
- .getString("label.strand_propensity"));
+ .getString("label.colourScheme_strand_propensity"));
strandColour.addActionListener(new ActionListener()
{
@Override
}
});
helixColour = new JRadioButtonMenuItem();
- helixColour.setText(MessageManager.getString("label.helix_propensity"));
+ helixColour.setText(MessageManager
+ .getString("label.colourScheme_helix_propensity"));
helixColour.addActionListener(new ActionListener()
{
@Override
}
});
turnColour = new JRadioButtonMenuItem();
- turnColour.setText(MessageManager.getString("label.turn_propensity"));
+ turnColour.setText(MessageManager
+ .getString("label.colourScheme_turn_propensity"));
turnColour.addActionListener(new ActionListener()
{
@Override
}
});
buriedColour = new JRadioButtonMenuItem();
- buriedColour.setText(MessageManager.getString("label.buried_index"));
+ buriedColour.setText(MessageManager
+ .getString("label.colourScheme_buried_index"));
buriedColour.addActionListener(new ActionListener()
{
@Override
}
});
nucleotideColour = new JRadioButtonMenuItem();
- nucleotideColour.setText(MessageManager.getString("label.nucleotide"));
+ nucleotideColour.setText(MessageManager
+ .getString("label.colourScheme_nucleotide"));
nucleotideColour.addActionListener(new ActionListener()
{
@Override
});
purinePyrimidineColour = new JRadioButtonMenuItem();
purinePyrimidineColour.setText(MessageManager
- .getString("label.purine_pyrimidine"));
+ .getString("label.colourScheme_purine/pyrimidine"));
purinePyrimidineColour.addActionListener(new ActionListener()
{
@Override
IdentityHashMap<SequenceI, AlignmentAnnotation> seqannot = null;
@Override
- public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ public ColourSchemeI getInstance(AnnotatedCollectionI sg,
Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
AnnotationColourGradient acg = new AnnotationColourGradient(annotation,
*/
package jalview.schemes;
+import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceI;
super();
}
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new Blosum62ColourScheme();
+ }
+
@Override
public Color findColour(char res, int j, SequenceI seq)
{
}
@Override
- public ColourSchemeI applyTo(AnnotatedCollectionI sg,
- Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
- {
- ColourSchemeI newcs = super.applyTo(sg, hiddenRepSequences);
- return newcs;
- }
-
- @Override
public boolean isPeptideSpecific()
{
return true;
{
return JalviewColourScheme.Blosum62.toString();
}
+
+ /**
+ * Answers true if Conservation annotation is present, else false
+ */
+ @Override
+ public boolean isApplicableTo(AnnotatedCollectionI ac)
+ {
+ AlignmentAnnotation[] anns = ac.getAlignmentAnnotation();
+ if (anns == null)
+ {
+ return false;
+ }
+ for (AlignmentAnnotation ann : anns)
+ {
+ if ("Conservation".equals(ann.label))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
}
*/
package jalview.schemes;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+
import java.awt.Color;
+import java.util.Map;
/**
* DOCUMENT ME!
{
return JalviewColourScheme.Buried.toString();
}
+
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new BuriedColourScheme();
+ }
}
private boolean includeGaps = true;
+ /**
+ * Default constructor (required for Class.newInstance())
+ */
+ public ClustalxColourScheme()
+ {
+
+ }
+
public ClustalxColourScheme(AnnotatedCollectionI alignment,
Map<SequenceI, SequenceCollectionI> hiddenReps)
{
}
@Override
- public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ public ColourSchemeI getInstance(AnnotatedCollectionI sg,
Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
ClustalxColourScheme css = new ClustalxColourScheme(sg,
/**
* Creates and returns a new instance of the colourscheme configured to colour
- * the given connection
+ * the given collection. Note that even simple colour schemes should return a
+ * new instance for each call to this method, as different instances may have
+ * differing shading by consensus or percentage identity applied.
*
* @param sg
* @param hiddenRepSequences
- * @return copy of current scheme with any inherited settings transfered
+ * @return copy of current scheme with any inherited settings transferred
*/
- ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ ColourSchemeI getInstance(AnnotatedCollectionI sg,
Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
/**
return null;
}
- JalviewColourScheme scheme = JalviewColourScheme.forName(name);
+
+ /*
+ * if this is the name of a registered colour scheme, just
+ * create a new instance of it
+ */
+ ColourSchemeI scheme = ColourSchemes.getInstance().getColourScheme(
+ name, forData);
if (scheme != null)
{
- return scheme.getColourScheme(forData);
+ return scheme;
}
/*
* e.g. "red" or "ff00ed",
* or failing that hash the name to a colour
*/
- UserColourScheme ucs = null;
- try
- {
- ucs = new UserColourScheme(name);
- } catch (Exception e)
- {
- // System.err.println("Ignoring exception when parsing colourscheme as applet-parameter");
- }
+ UserColourScheme ucs = new UserColourScheme(name);
return ucs;
}
--- /dev/null
+package jalview.schemes;
+
+import jalview.api.AlignViewportI;
+import jalview.datamodel.AnnotatedCollectionI;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class ColourSchemes
+{
+ /*
+ * singleton instance of this class
+ */
+ private static ColourSchemes instance = new ColourSchemes();
+
+ /*
+ * a map from scheme name to an instance of it
+ */
+ private Map<String, ColourSchemeI> schemes;
+
+ /**
+ * Returns the singleton instance of this class
+ *
+ * @return
+ */
+ public static ColourSchemes getInstance()
+ {
+ return instance;
+ }
+
+ private ColourSchemes()
+ {
+ loadColourSchemes();
+ }
+
+ /**
+ * Loads an instance of each standard or user-defined colour scheme
+ *
+ * @return
+ */
+ void loadColourSchemes()
+ {
+ /*
+ * store in an order-preserving map, so items can be added to menus
+ * in the order in which they are 'discovered'
+ */
+ schemes = new LinkedHashMap<String, ColourSchemeI>();
+
+ for (JalviewColourScheme cs : JalviewColourScheme.values())
+ {
+ try
+ {
+ registerColourScheme(cs.getSchemeClass().newInstance());
+ } catch (InstantiationException | IllegalAccessException e)
+ {
+ System.err.println("Error instantiating colour scheme for "
+ + cs.toString() + " " + e.getMessage());
+ }
+ }
+ }
+
+ /**
+ * Registers a colour scheme
+ *
+ * @param cs
+ */
+ public void registerColourScheme(ColourSchemeI cs)
+ {
+ String name = cs.getSchemeName();
+ if (name == null)
+ {
+ System.err.println("ColourScheme name may not be null");
+ return;
+ }
+
+ /*
+ * name is lower-case for non-case-sensitive lookup
+ * (name in the colour keeps its true case)
+ */
+ String lower = name.toLowerCase();
+ if (schemes.containsKey(lower))
+ {
+ System.err
+ .println("Warning: overwriting colour scheme named " + name);
+ }
+ schemes.put(lower, cs);
+ }
+
+ /**
+ * Removes a colour scheme by name
+ *
+ * @param name
+ */
+ public void removeColourScheme(String name)
+ {
+ schemes.remove(name);
+ }
+
+ /**
+ * Returns an instance of the colour scheme with which the given view may be
+ * coloured
+ *
+ * @param name
+ * name of the colour scheme
+ * @param viewport
+ * @return
+ */
+ public ColourSchemeI getColourScheme(String name, AlignViewportI viewport)
+ {
+ if (name == null)
+ {
+ return null;
+ }
+ ColourSchemeI cs = schemes.get(name.toLowerCase());
+ return cs == null ? null : cs.getInstance(viewport.getAlignment(),
+ viewport.getHiddenRepSequences());
+ }
+
+ /**
+ * Returns an instance of the colour scheme with which the given data may be
+ * coloured
+ *
+ * @param name
+ * @param forData
+ * @return
+ */
+ public ColourSchemeI getColourScheme(String name,
+ AnnotatedCollectionI forData)
+ {
+ ColourSchemeI cs = schemes.get(name.toLowerCase());
+ return cs == null ? null : cs.getInstance(forData, null);
+ }
+
+ /**
+ * Returns an iterable set of the colour schemes, in the order in which they
+ * were added
+ *
+ * @return
+ */
+ public Iterable<ColourSchemeI> getColourSchemes()
+ {
+ return schemes.values();
+ }
+}
package jalview.schemes;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
import java.awt.Color;
import java.util.Hashtable;
+import java.util.Map;
/**
* Became RNAHelicesColour.java. Placeholder for true covariation color scheme
public AlignmentAnnotation annotation;
/**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new CovariationColourScheme(coll.getAlignmentAnnotation()[0]);
+ }
+
+ /**
* Creates a new CovariationColourScheme object.
*/
public CovariationColourScheme(AlignmentAnnotation annotation)
package jalview.schemes;
import jalview.analysis.Conservation;
+import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.ProfilesI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+
+import java.util.Map;
/**
* Colourscheme that takes its colours from some other colourscheme
return "Follower";
}
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new FollowerColourScheme();
+ }
+
}
*/
package jalview.schemes;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+
import java.awt.Color;
+import java.util.Map;
public class HelixColourScheme extends ScoreColourScheme
{
{
return JalviewColourScheme.Helix.toString();
}
+
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new HelixColourScheme();
+ }
}
*/
package jalview.schemes;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+
import java.awt.Color;
+import java.util.Map;
/**
* DOCUMENT ME!
{
return JalviewColourScheme.Hydrophobic.toString();
}
+
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new HydrophobicColourScheme();
+ }
}
package jalview.schemes;
-import jalview.datamodel.AnnotatedCollectionI;
-
-import java.util.HashMap;
-import java.util.Map;
/**
* An enum with the colour schemes supported by Jalview.
*/
public enum JalviewColourScheme
{
- Clustal("Clustal")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new ClustalxColourScheme(coll, null);
- }
- },
- Blosum62("Blosum62")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new Blosum62ColourScheme();
- }
- },
- PID("% Identity")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new PIDColourScheme();
- }
- },
- Zappo("Zappo")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new ZappoColourScheme();
- }
- },
- Taylor("Taylor")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new TaylorColourScheme();
- }
- },
- Hydrophobic("Hydrophobic")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new HydrophobicColourScheme();
- }
- },
- Helix("Helix Propensity")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new HelixColourScheme();
- }
- },
- Strand("Strand Propensity")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new StrandColourScheme();
- }
- },
- Turn("Turn Propensity")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new TurnColourScheme();
- }
- },
- Buried("Buried Index")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new BuriedColourScheme();
- }
- },
- Nucleotide("Nucleotide")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new NucleotideColourScheme();
- }
- },
- PurinePyrimidine("Purine/Pyrimidine")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new PurinePyrimidineColourScheme();
- }
- },
- TCoffee("T-Coffee Scores")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new TCoffeeColourScheme(coll);
- }
- },
- RNAHelices("RNA Helices")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new RNAHelicesColour(coll);
- }
- },
- // RNAInteraction("RNA Interaction type")
- // {
- // @Override
- // public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- // {
- // return new RNAInteractionColourScheme();
- // }
- // },
- UserDefined("User Defined")
- {
- @Override
- public ColourSchemeI getColourScheme(AnnotatedCollectionI coll)
- {
- return new UserColourScheme("white");
- }
- };
-
- static Map<String, JalviewColourScheme> names = new HashMap<String, JalviewColourScheme>();
+ /*
+ * the order of declaration is the default order in which
+ * items are added to Colour menus
+ */
+ Clustal("Clustal", ClustalxColourScheme.class), Blosum62("Blosum62",
+ Blosum62ColourScheme.class), PID("% Identity",
+ PIDColourScheme.class), Zappo("Zappo", ZappoColourScheme.class),
+ Taylor("Taylor", TaylorColourScheme.class), Hydrophobic("Hydrophobic",
+ HydrophobicColourScheme.class), Helix("Helix Propensity",
+ HelixColourScheme.class), Strand("Strand Propensity",
+ StrandColourScheme.class), Turn("Turn Propensity",
+ TurnColourScheme.class), Buried("Buried Index",
+ BuriedColourScheme.class), Nucleotide("Nucleotide",
+ NucleotideColourScheme.class), PurinePyrimidine(
+ "Purine/Pyrimidine", PurinePyrimidineColourScheme.class),
+ RNAHelices("RNA Helices", RNAHelicesColour.class), TCoffee(
+ "T-Coffee Scores", TCoffeeColourScheme.class);
+ // RNAInteraction("RNA Interaction type", RNAInteractionColourScheme.class)
private String name;
- static
- {
- for (JalviewColourScheme scheme : values())
- {
- names.put(scheme.name.toLowerCase(), scheme);
- }
- }
-
- /**
- * Answers the colour scheme with the 'given name', or null if name is invalid
- * or null. The name is not case-sensitive.
- *
- * @param name
- * @return
- */
- public static JalviewColourScheme forName(String name)
- {
- return name == null ? null : names.get(name.toLowerCase());
- }
+ private Class<? extends ColourSchemeI> myClass;
/**
* Constructor given the name of the colour scheme (as used in Jalview
*
* @param s
*/
- JalviewColourScheme(String s)
+ JalviewColourScheme(String s, Class<? extends ColourSchemeI> cl)
{
name = s;
+ myClass = cl;
}
/**
- * Returns an instance of the colour scheme with which to colour the given
- * data
+ * Returns the class of the colour scheme
*
- * @param coll
* @return
*/
- public abstract ColourSchemeI getColourScheme(AnnotatedCollectionI coll);
+ public Class<? extends ColourSchemeI> getSchemeClass()
+ {
+ return myClass;
+ }
/**
* Returns the 'official' name of this colour scheme. This is the name that
*/
package jalview.schemes;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceI;
import java.awt.Color;
+import java.util.Map;
/**
* DOCUMENT ME!
{
return JalviewColourScheme.Nucleotide.toString();
}
+
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new NucleotideColourScheme();
+ }
}
*/
package jalview.schemes;
+import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.ProfileI;
+import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.util.Comparison;
import java.awt.Color;
+import java.util.Map;
public class PIDColourScheme extends ResidueColourScheme
{
{
return JalviewColourScheme.PID.toString();
}
+
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new PIDColourScheme();
+ }
}
*/
package jalview.schemes;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+
import java.awt.Color;
+import java.util.Map;
/**
* Class is based off of NucleotideColourScheme
{
return JalviewColourScheme.PurinePyrimidine.toString();
}
+
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new PurinePyrimidineColourScheme();
+ }
}
public AlignmentAnnotation annotation;
/**
+ * Default constructor (required for ColourSchemes cache)
+ */
+ public RNAHelicesColour()
+ {
+
+ }
+
+ /**
* Creates a new RNAHelicesColour object.
*/
public RNAHelicesColour(AlignmentAnnotation annotation)
}
@Override
- public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ public ColourSchemeI getInstance(AnnotatedCollectionI sg,
Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
- return new RNAHelicesColour(this);
+ return new RNAHelicesColour(sg);
}
@Override
@Override
public boolean isApplicableTo(AnnotatedCollectionI ac)
{
+ if (ac instanceof AlignmentI && ((AlignmentI) ac).hasRNAStructure())
+ {
+ return true;
+ }
+
+ /*
+ * check dataset
+ */
AnnotatedCollectionI context = ac.getContext();
if (context == null)
{
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.SequenceGroup;
-import java.awt.event.ActionEvent;
import java.util.Hashtable;
+import java.util.Map;
import java.util.Vector;
/**
* change colors based on covariation.
*
* @author Lauren Michelle Lui
- *
+ * @deprecated this seems to be unfinished - just use RNAHelicesColour
*/
+@Deprecated
public class RNAHelicesColourChooser
{
ColourSchemeI oldcs;
- Hashtable oldgroupColours;
+ Map<SequenceGroup, ColourSchemeI> oldgroupColours;
- jalview.datamodel.AlignmentAnnotation currentAnnotation;
+ AlignmentAnnotation currentAnnotation;
boolean adjusting = false;
oldcs = av.getGlobalColourScheme();
if (av.getAlignment().getGroups() != null)
{
- oldgroupColours = new Hashtable();
+ oldgroupColours = new Hashtable<SequenceGroup, ColourSchemeI>();
for (SequenceGroup sg : ap.getAlignment().getGroups())
{
if (sg.cs != null)
this.av = av;
this.ap = ap;
- if (oldcs instanceof RNAHelicesColour)
- {
- RNAHelicesColour rhc = (RNAHelicesColour) oldcs;
-
- }
-
adjusting = true;
- Vector list = new Vector();
+ Vector<String> list = new Vector<String>();
int index = 1;
AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation();
if (anns != null)
}
adjusting = false;
-
changeColour();
-
}
void changeColour()
{
return;
}
- RNAHelicesColour rhc = null;
-
- rhc = new RNAHelicesColour(av.getAlignment());
+ RNAHelicesColour rhc = new RNAHelicesColour(av.getAlignment());
av.setGlobalColourScheme(rhc);
ap.paintAlignment(true);
}
-
- void reset()
- {
- av.setGlobalColourScheme(oldcs);
- if (av.getAlignment().getGroups() != null)
- {
- for (SequenceGroup sg : ap.getAlignment().getGroups())
- {
- sg.cs = (ColourSchemeI) oldgroupColours.get(sg);
- }
- }
- }
-
- public void annotations_actionPerformed(ActionEvent e)
- {
- changeColour();
- }
-
}
*/
package jalview.schemes;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceI;
import java.awt.Color;
+import java.util.Map;
public class RNAInteractionColourScheme extends ResidueColourScheme
{
{
return "RNA Interaction type";
}
+
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new RNAInteractionColourScheme();
+ }
}
import jalview.datamodel.SequenceI;
import jalview.util.ColorUtils;
import jalview.util.Comparison;
-import jalview.util.MessageManager;
import java.awt.Color;
import java.util.Map;
/**
* Base class for residue-based colour schemes
*/
-public class ResidueColourScheme implements ColourSchemeI
+public abstract class ResidueColourScheme implements ColourSchemeI
{
public static final String NONE = "None";
@Override
public Color findColour()
{
+ // TODO delete this method in favour of ColorUtils.parseColourString()?
return findColour('A');
}
{
}
- @Override
- public ColourSchemeI applyTo(AnnotatedCollectionI sg,
- Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
- {
- try
- {
- return getClass().newInstance();
- } catch (Exception q)
- {
- throw new Error(MessageManager.formatMessage(
- "error.implementation_error_cannot_duplicate_colour_scheme",
- new String[] { getClass().getName() }), q);
- }
- }
-
/**
* Answers false if the colour scheme is nucleotide or peptide specific, and
- * the data does not match, else false. Override to modify or extend this test
+ * the data does not match, else true. Override to modify or extend this test
* as required.
*/
@Override
{
return false;
}
-
- @Override
- public String getSchemeName()
- {
- return "Residue";
- }
}
*/
package jalview.schemes;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceI;
import java.awt.Color;
+import java.util.Map;
/**
* DOCUMENT ME!
{
return "Score";
}
+
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new ScoreColourScheme(symbolIndex, scores, min, max);
+ }
}
*/
package jalview.schemes;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+
import java.awt.Color;
+import java.util.Map;
/**
* DOCUMENT ME!
{
return JalviewColourScheme.Strand.toString();
}
+
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new StrandColourScheme();
+ }
}
IdentityHashMap<SequenceI, Color[]> seqMap;
/**
+ * Default constructor (required for Class.newInstance())
+ */
+ public TCoffeeColourScheme()
+ {
+
+ }
+
+ /**
* the color scheme needs to look at the alignment to get and cache T-COFFEE
* scores
*
}
@Override
- public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ public ColourSchemeI getInstance(AnnotatedCollectionI sg,
Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
return new TCoffeeColourScheme(sg);
*/
package jalview.schemes;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+
+import java.util.Map;
+
public class TaylorColourScheme extends ResidueColourScheme
{
public TaylorColourScheme()
{
return JalviewColourScheme.Taylor.toString();
}
+
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new TaylorColourScheme();
+ }
}
*/
package jalview.schemes;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+
import java.awt.Color;
+import java.util.Map;
/**
* DOCUMENT ME!
{
return JalviewColourScheme.Turn.toString();
}
+
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new TurnColourScheme();
+ }
}
}
@Override
- public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ public ColourSchemeI getInstance(AnnotatedCollectionI sg,
Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
UserColourScheme usc = new UserColourScheme(colors);
{
return schemeName;
}
- return JalviewColourScheme.UserDefined.toString();
+ return "User Defined";
}
/**
*/
package jalview.schemes;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+
+import java.util.Map;
+
/**
* DOCUMENT ME!
*
{
return JalviewColourScheme.Zappo.toString();
}
+
+ /**
+ * Returns a new instance of this colour scheme with which the given data may
+ * be coloured
+ */
+ @Override
+ public ColourSchemeI getInstance(AnnotatedCollectionI coll,
+ Map<SequenceI, SequenceCollectionI> hrs)
+ {
+ return new ZappoColourScheme();
+ }
}
sg.cs = null;
continue;
}
- sg.cs = cs.applyTo(sg, getHiddenRepSequences());
+ sg.cs = cs.getInstance(sg, getHiddenRepSequences());
sg.setConsPercGaps(ConsPercGaps);
if (getAbovePIDThreshold() || cs instanceof PIDColourScheme
|| cs instanceof Blosum62ColourScheme)
import jalview.schemes.AnnotationColourGradient;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.JalviewColourScheme;
+import jalview.schemes.RNAHelicesColour;
import jalview.schemes.TCoffeeColourScheme;
import jalview.structure.StructureImportSettings;
import jalview.viewmodel.AlignmentViewport;
assertTrue("Didn't read input file " + inFile, af != null);
int olddsann = countDsAnn(af.getViewport());
assertTrue("Didn't find any dataset annotations", olddsann > 0);
- af.rnahelicesColour_actionPerformed();
- assertTrue(
- "Couldn't apply RNA helices colourscheme",
- af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
+ af.changeColour_actionPerformed(JalviewColourScheme.RNAHelices
+ .toString());
+ assertTrue("Couldn't apply RNA helices colourscheme", af.getViewport()
+ .getGlobalColourScheme() instanceof RNAHelicesColour);
assertTrue("Failed to store as a project.",
af.saveAlignment(tfile, FileFormat.Jalview));
af.closeMenuItem_actionPerformed(true);
+ olddsann + ")");
assertTrue(
"RNA helices colourscheme was not applied on import.",
- af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
+ af.getViewport().getGlobalColourScheme() instanceof RNAHelicesColour);
}
@Test(groups = { "Functional" })
// 'None' is a special value
assertNull(ColourSchemeProperty.getColourScheme(al, "None"));
assertNull(ColourSchemeProperty.getColourScheme(al, "none"));
- // default is to convert the name into a fixed coloour
+ // default is to convert the name into a fixed colour
assertTrue(ColourSchemeProperty.getColourScheme(al, "elephants") instanceof UserColourScheme);
/*
--- /dev/null
+package jalview.schemes;
+
+import static org.testng.Assert.assertTrue;
+
+import java.util.Iterator;
+
+import org.testng.annotations.Test;
+
+public class ColourSchemesTest
+{
+ @Test(groups = "Functional")
+ public void testGetColourSchemes()
+ {
+ /*
+ * this just verifies that built-in colour schemes are loaded into ColourSchemes
+ * in the order in which they are declared in the JalviewColourScheme enum
+ * (this also determines their order in Colour menus)
+ */
+ Iterator<ColourSchemeI> schemes = ColourSchemes.getInstance().getColourSchemes().iterator();
+ JalviewColourScheme[] jalviewSchemes = JalviewColourScheme.values();
+ int i = 0;
+ while (schemes.hasNext()) {
+ assertTrue(schemes.next().getSchemeName()
+ .equals(jalviewSchemes[i].toString()));
+ i++;
+ }
+ }
+}
package jalview.schemes;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertSame;
+import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
-import jalview.datamodel.Alignment;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.Sequence;
-import jalview.datamodel.SequenceI;
-
import org.testng.annotations.Test;
public class JalviewColourSchemeTest
{
@Test(groups = "Functional")
- public void testForName()
+ public void testGetSchemeClass()
{
- assertSame(JalviewColourScheme.Clustal,
- JalviewColourScheme.forName("Clustal"));
- assertSame(JalviewColourScheme.Clustal,
- JalviewColourScheme.forName("CLUSTAL"));
- assertSame(JalviewColourScheme.Blosum62,
- JalviewColourScheme.forName("Blosum62"));
- assertSame(JalviewColourScheme.PID,
- JalviewColourScheme.forName("% Identity"));
- assertSame(JalviewColourScheme.Hydrophobic,
- JalviewColourScheme.forName("Hydrophobic"));
- assertSame(JalviewColourScheme.Zappo,
- JalviewColourScheme.forName("Zappo"));
- assertSame(JalviewColourScheme.Taylor,
- JalviewColourScheme.forName("Taylor"));
- assertSame(JalviewColourScheme.Helix,
- JalviewColourScheme.forName("Helix Propensity"));
- assertSame(JalviewColourScheme.Strand,
- JalviewColourScheme.forName("Strand Propensity"));
- assertSame(JalviewColourScheme.Turn,
- JalviewColourScheme.forName("Turn Propensity"));
- assertSame(JalviewColourScheme.Buried,
- JalviewColourScheme.forName("Buried Index"));
- assertSame(JalviewColourScheme.Nucleotide,
- JalviewColourScheme.forName("Nucleotide"));
- assertSame(JalviewColourScheme.PurinePyrimidine,
- JalviewColourScheme.forName("Purine/Pyrimidine"));
- assertSame(JalviewColourScheme.TCoffee,
- JalviewColourScheme.forName("T-Coffee Scores"));
- assertSame(JalviewColourScheme.RNAHelices,
- JalviewColourScheme.forName("RNA Helices"));
- // assertSame(JalviewColourScheme.RNAInteraction,
- // JalviewColourScheme.forName("RNA Interaction type"));
- assertSame(JalviewColourScheme.UserDefined,
- JalviewColourScheme.forName("User Defined"));
-
- assertNull(JalviewColourScheme.forName("PID"));
- assertNull(JalviewColourScheme.forName(""));
- assertNull(JalviewColourScheme.forName(null));
+ assertTrue(JalviewColourScheme.Clustal.getSchemeClass() == ClustalxColourScheme.class);
+ assertTrue(JalviewColourScheme.Blosum62.getSchemeClass() == Blosum62ColourScheme.class);
+ assertTrue(JalviewColourScheme.PID.getSchemeClass() == PIDColourScheme.class);
+ assertTrue(JalviewColourScheme.Hydrophobic.getSchemeClass() == HydrophobicColourScheme.class);
+ assertTrue(JalviewColourScheme.Zappo.getSchemeClass() == ZappoColourScheme.class);
+ assertTrue(JalviewColourScheme.Taylor.getSchemeClass() == TaylorColourScheme.class);
+ assertTrue(JalviewColourScheme.Helix.getSchemeClass() == HelixColourScheme.class);
+ assertTrue(JalviewColourScheme.Strand.getSchemeClass() == StrandColourScheme.class);
+ assertTrue(JalviewColourScheme.Turn.getSchemeClass() == TurnColourScheme.class);
+ assertTrue(JalviewColourScheme.Buried.getSchemeClass() == BuriedColourScheme.class);
+ assertTrue(JalviewColourScheme.Nucleotide.getSchemeClass() == NucleotideColourScheme.class);
+ assertTrue(JalviewColourScheme.PurinePyrimidine.getSchemeClass() == PurinePyrimidineColourScheme.class);
+ assertTrue(JalviewColourScheme.TCoffee.getSchemeClass() == TCoffeeColourScheme.class);
+ assertTrue(JalviewColourScheme.RNAHelices.getSchemeClass() == RNAHelicesColour.class);
}
@Test(groups = "Functional")
- public void testGetColourScheme()
+ public void testToString()
{
- SequenceI seq = new Sequence("Seq1", "abcd");
- AlignmentI al = new Alignment(new SequenceI[] { seq });
- assertTrue(JalviewColourScheme.Clustal.getColourScheme(al) instanceof ClustalxColourScheme);
- assertTrue(JalviewColourScheme.Blosum62.getColourScheme(al) instanceof Blosum62ColourScheme);
- assertTrue(JalviewColourScheme.PID.getColourScheme(al) instanceof PIDColourScheme);
- assertTrue(JalviewColourScheme.Hydrophobic.getColourScheme(al) instanceof HydrophobicColourScheme);
- assertTrue(JalviewColourScheme.Zappo.getColourScheme(al) instanceof ZappoColourScheme);
- assertTrue(JalviewColourScheme.Taylor.getColourScheme(al) instanceof TaylorColourScheme);
- assertTrue(JalviewColourScheme.Helix.getColourScheme(al) instanceof HelixColourScheme);
- assertTrue(JalviewColourScheme.Strand.getColourScheme(al) instanceof StrandColourScheme);
- assertTrue(JalviewColourScheme.Turn.getColourScheme(al) instanceof TurnColourScheme);
- assertTrue(JalviewColourScheme.Buried.getColourScheme(al) instanceof BuriedColourScheme);
- assertTrue(JalviewColourScheme.Nucleotide.getColourScheme(al) instanceof NucleotideColourScheme);
- assertTrue(JalviewColourScheme.PurinePyrimidine.getColourScheme(al) instanceof PurinePyrimidineColourScheme);
- assertTrue(JalviewColourScheme.TCoffee.getColourScheme(al) instanceof TCoffeeColourScheme);
- assertTrue(JalviewColourScheme.RNAHelices.getColourScheme(al) instanceof RNAHelicesColour);
- // assertTrue(JalviewColourScheme.RNAInteraction.getColourScheme(al)
- // instanceof RNAInteractionColourScheme);
- assertTrue(JalviewColourScheme.UserDefined.getColourScheme(al) instanceof UserColourScheme);
+ assertEquals(JalviewColourScheme.Clustal.toString(), "Clustal");
+ assertEquals(JalviewColourScheme.Blosum62.toString(), "Blosum62");
+ assertEquals(JalviewColourScheme.PID.toString(), "% Identity");
+ assertEquals(JalviewColourScheme.Zappo.toString(), "Zappo");
+ assertEquals(JalviewColourScheme.Taylor.toString(), "Taylor");
+ assertEquals(JalviewColourScheme.Hydrophobic.toString(), "Hydrophobic");
+ assertEquals(JalviewColourScheme.Helix.toString(), "Helix Propensity");
+ assertEquals(JalviewColourScheme.Strand.toString(), "Strand Propensity");
+ assertEquals(JalviewColourScheme.Turn.toString(), "Turn Propensity");
+ assertEquals(JalviewColourScheme.Buried.toString(), "Buried Index");
+ assertEquals(JalviewColourScheme.Nucleotide.toString(), "Nucleotide");
+ assertEquals(JalviewColourScheme.PurinePyrimidine.toString(),
+ "Purine/Pyrimidine");
+ assertEquals(JalviewColourScheme.TCoffee.toString(), "T-Coffee Scores");
+ assertEquals(JalviewColourScheme.RNAHelices.toString(), "RNA Helices");
}
}
public class ResidueColourSchemeTest
{
+ @BeforeClass(alwaysRun = true)
+ public void setUp()
+ {
+
+ }
@BeforeClass(alwaysRun = true)
public void setUpJvOptionPane()
profiles[1] = new Profile(4, 0, 4, "R");
profiles[2] = new Profile(4, 4, 0, "");
profiles[3] = new Profile(4, 1, 2, "T");
- ResidueColourScheme rcs = new ResidueColourScheme();
+ ResidueColourScheme rcs = new PIDColourScheme();
rcs.setConsensus(new Profiles(profiles));
/*
@Test(groups = "Functional")
public void testApplyConservation()
{
- ResidueColourScheme rcs = new ResidueColourScheme();
+ ResidueColourScheme rcs = new PIDColourScheme();
// no conservation present - no fading
assertEquals(Color.RED, rcs.applyConservation(Color.RED, 12));
.isApplicableTo(peptide));
assertFalse(new ClustalxColourScheme(nucleotide, null)
.isApplicableTo(nucleotide));
- assertTrue(new Blosum62ColourScheme().isApplicableTo(peptide));
+ // Blosum requires presence of Conservation annotation
+ assertFalse(new Blosum62ColourScheme().isApplicableTo(peptide));
assertFalse(new Blosum62ColourScheme().isApplicableTo(nucleotide));
assertTrue(new BuriedColourScheme().isApplicableTo(peptide));
assertFalse(new BuriedColourScheme().isApplicableTo(nucleotide));
assertTrue(new ZappoColourScheme().isApplicableTo(peptide));
assertFalse(new ZappoColourScheme().isApplicableTo(nucleotide));
+ peptide.addAnnotation(new AlignmentAnnotation("Conservation",
+ "Conservation", new Annotation[1], 0f, 11f,
+ AlignmentAnnotation.BAR_GRAPH));
+ assertTrue(new Blosum62ColourScheme().isApplicableTo(peptide));
+
/*
* nucleotide-specific colour schemes
*/
.isApplicableTo(peptide));
assertTrue(new ScoreColourScheme(new int[] {}, new double[] {}, 0, 0d)
.isApplicableTo(nucleotide));
- assertTrue(new ResidueColourScheme().isApplicableTo(peptide));
- assertTrue(new ResidueColourScheme().isApplicableTo(nucleotide));
+ ResidueColourScheme rcs = new PIDColourScheme();
+ assertTrue(rcs.isApplicableTo(peptide));
+ assertTrue(rcs.isApplicableTo(nucleotide));
assertTrue(new PIDColourScheme().isApplicableTo(peptide));
assertTrue(new PIDColourScheme().isApplicableTo(nucleotide));
assertTrue(new FollowerColourScheme().isApplicableTo(peptide));
assertTrue(cs.isApplicableTo(peptide));
}
- @Test
+ @Test(groups = "Functional")
public void testGetName()
{
SequenceI pep1 = new Sequence("pep1", "APQTWLS");
assertEquals("User Defined", new UserColourScheme().getSchemeName());
assertEquals("Score", new ScoreColourScheme(new int[] {},
new double[] {}, 0, 0d).getSchemeName());
- assertEquals("Residue", new ResidueColourScheme().getSchemeName());
assertEquals("% Identity", new PIDColourScheme().getSchemeName());
assertEquals("Follower", new FollowerColourScheme().getSchemeName());
assertEquals("T-Coffee Scores",