import jalview.schemes.PIDColourScheme;
import jalview.schemes.PurinePyrimidineColourScheme;
import jalview.schemes.RNAHelicesColourChooser;
+import jalview.schemes.RNAInteractionColourScheme;\r
import jalview.schemes.ResidueProperties;
import jalview.schemes.StrandColourScheme;
import jalview.schemes.TCoffeeColourScheme;
{
changeColour(new PurinePyrimidineColourScheme());
}
+ else if (source == RNAInteractionColour)\r
+ {\r
+ changeColour(new RNAInteractionColourScheme());\r
+ }\r
else if (source == RNAHelixColour)
{
new RNAHelicesColourChooser(viewport, alignPanel);
MenuItem purinePyrimidineColour = new MenuItem();
+ MenuItem RNAInteractionColour = new MenuItem();\r
+\r
MenuItem RNAHelixColour = new MenuItem();
MenuItem userDefinedColour = new MenuItem();
buriedColour.addActionListener(this);
purinePyrimidineColour.setLabel(MessageManager.getString("label.purine_pyrimidine"));
purinePyrimidineColour.addActionListener(this);
+ RNAInteractionColour.setLabel(MessageManager.getString("label.rna_interaction"));\r
+ RNAInteractionColour.addActionListener(this);\r
RNAHelixColour.setLabel(MessageManager.getString("action.by_rna_helixes"));
RNAHelixColour.addActionListener(this);
userDefinedColour.setLabel(MessageManager.getString("action.user_defined"));
menu1.setLabel(MessageManager.getString("action.show"));
showColumns.setLabel(MessageManager.getString("label.all_columns"));
showSeqs.setLabel(MessageManager.getString("label.all_sequences"));
- menu2.setLabel(MessageManager.getString("aciton.hide"));
+ menu2.setLabel(MessageManager.getString("action.hide"));
hideColumns.setLabel(MessageManager.getString("label.selected_columns"));
hideSequences.setLabel(MessageManager.getString("label.selected_sequences"));
hideAllButSelection.setLabel(MessageManager.getString("label.all_but_selected_region"));
colourMenu.add(buriedColour);
colourMenu.add(nucleotideColour);
colourMenu.add(purinePyrimidineColour);
+ // colourMenu.add(RNAInteractionColour);\r
colourMenu.add(tcoffeeColour);
colourMenu.add(userDefinedColour);
colourMenu.addSeparator();
protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem RNAInteractionColour = new JRadioButtonMenuItem();
// protected JRadioButtonMenuItem covariationColour = new
// JRadioButtonMenuItem();
JMenu pdbMenu = new JMenu();
JMenuItem pdbFromFile = new JMenuItem();
-
+ // JBPNote: Commented these out - Should add these services via the web services menu system.
+ // JMenuItem ContraFold = new JMenuItem();
+
+ // JMenuItem RNAFold = new JMenuItem();
+
JMenuItem enterPDB = new JMenuItem();
JMenuItem discoverPDB = new JMenuItem();
colours.add(PIDColour);
colours.add(BLOSUM62Colour);
colours.add(purinePyrimidineColour);
+ colours.add(RNAInteractionColour);
// colours.add(covariationColour);
for (int i = 0; i < jalview.io.FormatAdapter.WRITEABLE_FORMATS.length; i++)
menuItem = new JMenuItem();
menuItem.setText(MessageManager.formatMessage("label.2d_rna_structure_line", new String[]{structureLine}));\r
menuItem.addActionListener(new java.awt.event.ActionListener()
+
{
public void actionPerformed(ActionEvent e)
{
- new AppVarna(structureLine, seq, seq.getSequenceAsString(),
- rnastruc, seq.getName(), ap);
+ //System.out.println("1:"+structureLine);
+ System.out.println("1:sname"+seq.getName());
+ System.out.println("2:seq"+seq);
+
+ //System.out.println("3:"+seq.getSequenceAsString());
+ System.out.println("3:strucseq"+rnastruc);
+ //System.out.println("4:struc"+seq.getRNA());
+ System.out.println("5:name"+seq.getName());
+ System.out.println("6:ap"+ap);
+ new AppVarna(structureLine, seq, seq.getSequenceAsString(), rnastruc, seq
+ .getName(), ap);
+ //new AppVarna(seq.getName(),seq,rnastruc,seq.getRNA(), seq.getName(), ap);
+ System.out.println("end");
}
});
viewStructureMenu.add(menuItem);
public void actionPerformed(ActionEvent e)
{
// TODO: VARNA does'nt print gaps in the sequence
+
new AppVarna(seq.getName() + " structure", seq, seq
.getSequenceAsString(), rnastruc, seq.getName(),
ap);
{
purinePyrimidineColour.setSelected(true);
}
+
+
/*
* else if (sg.cs instanceof CovariationColourScheme) {
* covariationColour.setSelected(true); }
buildGroupURLMenu(sg, groupLinks);
}
// Add a 'show all structures' for the current selection
- Hashtable<String, PDBEntry> pdbe = new Hashtable<String, PDBEntry>();
+ Hashtable<String, PDBEntry> pdbe = new Hashtable<String, PDBEntry>(),reppdb=new Hashtable<String,PDBEntry>();
SequenceI sqass = null;
for (SequenceI sq : ap.av.getSequenceSelection())
{
.getPDBId();
if (pes != null)
{
+ reppdb.put(pes.get(0).getId(),pes.get(0));
for (PDBEntry pe : pes)
{
pdbe.put(pe.getId(), pe);
if (pdbe.size() > 0)
{
final PDBEntry[] pe = pdbe.values().toArray(
- new PDBEntry[pdbe.size()]);
- final JMenuItem gpdbview;
+ new PDBEntry[pdbe.size()]),pr = reppdb.values().toArray(
+ new PDBEntry[reppdb.size()]);
+ final JMenuItem gpdbview,rpdbview;
if (pdbe.size() == 1)
{
structureMenu.add(gpdbview = new JMenuItem(MessageManager.formatMessage("label.view_structure_for", new String[]{sqass.getDisplayId(false)})));\r
}
else
{
- structureMenu.add(gpdbview = new JMenuItem(MessageManager.formatMessage("label.view_all_structures", new String[]{new Integer(pdbe.size()).toString()})));\r
+ structureMenu.add(gpdbview = new JMenuItem(MessageManager.formatMessage("label.view_all_structures", new String[]{new Integer(pdbe.size()).toString()}))); \r
}
gpdbview.setToolTipText(MessageManager.getString("label.open_new_jmol_view_with_all_structures_associated_current_selection_superimpose_using_alignment"));\r
gpdbview.addActionListener(new ActionListener()
new AppJmol(ap, pe, ap.av.collateForPDB(pe));
}
});
+ if (reppdb.size()>1 && reppdb.size()<pdbe.size())
+ {
+ structureMenu.add(rpdbview = new JMenuItem(MessageManager.formatMessage("label.view_all_representative_structures", new String[]{new Integer(reppdb.size()).toString()})));
+ rpdbview.setToolTipText(MessageManager.getString("label.open_new_jmol_view_with_all_representative_structures_associated_current_selection_superimpose_using_alignment"));
+ rpdbview.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ new AppJmol(ap, pr, ap.av.collateForPDB(pr));
+ }
+ });
+ }
}
}
else
pdbFromFile_actionPerformed();
}
});
+// RNAFold.setText("From RNA Fold with predict2D");
+// RNAFold.addActionListener(new ActionListener()
+// {
+// public void actionPerformed(ActionEvent e)
+// {
+// try {
+// RNAFold_actionPerformed();
+// } catch (Exception e1) {
+// // TODO Auto-generated catch block
+// e1.printStackTrace();
+// }
+// }
+// });
+// ContraFold.setText("From Contra Fold with predict2D");
+// ContraFold.addActionListener(new ActionListener()
+// {
+// public void actionPerformed(ActionEvent e)
+// {
+// try {
+// ContraFold_actionPerformed();
+// } catch (Exception e1) {
+// // TODO Auto-generated catch block
+// e1.printStackTrace();
+// }
+// }
+// });
enterPDB.setText(MessageManager.getString("label.enter_pdb_id"));\r
enterPDB.addActionListener(new ActionListener()
{
colourMenu.add(turnColour);
colourMenu.add(buriedColour);
colourMenu.add(nucleotideMenuItem);
- if (ap.getAlignment().isNucleotide())
- {
- colourMenu.add(purinePyrimidineColour);
+ if (ap.getAlignment().isNucleotide()) {
+ // JBPNote - commented since the colourscheme isn't functional
+ // colourMenu.add(RNAInteractionColour);
+ colourMenu.add(purinePyrimidineColour);
}
// colourMenu.add(covariationColour);
colourMenu.add(userDefinedColour);
editMenu.add(lowerCase);
editMenu.add(toggle);
pdbMenu.add(pdbFromFile);
+ // JBPNote: These shouldn't be added here - should appear in a generic 'apply web service to this sequence menu'
+ // pdbMenu.add(RNAFold);
+ // pdbMenu.add(ContraFold);
pdbMenu.add(enterPDB);
pdbMenu.add(discoverPDB);
jMenu1.add(groupName);
purinePyrimidineColour_actionPerformed();
}
});
+
+
/*
* covariationColour.addActionListener(new java.awt.event.ActionListener() {
* public void actionPerformed(ActionEvent e) {
refresh();
}
+
/*
* protected void covariationColour_actionPerformed() { getGroup().cs = new
* CovariationColourScheme(sequence.getAnnotation()[0]); refresh(); }
}
}
-
+ // JBNote: commented out - these won't be instantiated here...!
+// public void RNAFold_actionPerformed() throws Exception
+// {
+// Predict2D P2D = new Predict2D();
+// P2D.getStructure2DFromRNAFold("toto");
+// }
+//
+// public void ContraFold_actionPerformed() throws Exception
+// {
+// Predict2D P2D = new Predict2D();
+// P2D.getStructure2DFromContraFold("toto");
+// }
public void enterPDB_actionPerformed()
{
String id = JOptionPane.showInternalInputDialog(Desktop.desktop,
protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();
protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem RNAInteractionColour = new JRadioButtonMenuItem();
// protected JRadioButtonMenuItem covariationColour = new
// JRadioButtonMenuItem();
protected JMenuItem showTranslation = new JMenuItem();
protected JMenuItem extractScores = new JMenuItem();
+
+ protected JMenuItem expandAlignment = new JMenuItem();
protected JMenu showProducts = new JMenu();
colours.add(purinePyrimidineColour);
// colours.add(covariationColour);
colours.add(tcoffeeColour);
-
+ colours.add(RNAInteractionColour);
setColourSelected(jalview.bin.Cache
.getDefault("DEFAULT_COLOUR", "None"));
purinePyrimidineColour.setSelected(true);
break;
+
+ case ColourSchemeProperty.RNAINTERACTION:
+ RNAInteractionColour.setSelected(true);
+
+ break;
/*
* case ColourSchemeProperty.COVARIATION:
* covariationColour.setSelected(true);
makeGrpsFromSelection_actionPerformed(e);
}
});
-
+ expandAlignment.setText(MessageManager.getString("action.view_flanking_regions"));
+ expandAlignment.setToolTipText(MessageManager.getString("label.view_flanking_regions"));
+ expandAlignment.addActionListener(new java.awt.event.ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ expand_newalign(e);
+ }
+ });
remove2LeftMenuItem.setText(MessageManager.getString("action.remove_left"));
remove2LeftMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
java.awt.event.KeyEvent.VK_L, Toolkit.getDefaultToolkit()
purinePyrimidineColour_actionPerformed(e);
}
});
+
+ RNAInteractionColour.setText("RNA Interaction type");
+ RNAInteractionColour.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ RNAInteractionColour_actionPerformed(e);
+ }
+ });
/*
* covariationColour.setText("Covariation");
* covariationColour.addActionListener(new java.awt.event.ActionListener() {
colourMenu.add(buriedColour);
colourMenu.add(nucleotideColour);
colourMenu.add(purinePyrimidineColour);
+ colourMenu.add(RNAInteractionColour);
// colourMenu.add(covariationColour);
colourMenu.add(tcoffeeColour);
colourMenu.add(userDefinedColour);
colourMenu.add(abovePIDThreshold);
colourMenu.add(modifyPID);
colourMenu.add(annotationColour);
- colourMenu.add(rnahelicesColour);
+ colourMenu.add(rnahelicesColour);
calculateMenu.add(sort);
calculateMenu.add(calculateTree);
calculateMenu.addSeparator();
sort.add(sortGroupMenuItem);
sort.add(sortPairwiseMenuItem);
sort.add(sortByTreeMenu);
- calculateTree.add(averageDistanceTreeMenuItem);
- calculateTree.add(neighbourTreeMenuItem);
- calculateTree.add(avDistanceTreeBlosumMenuItem);
- calculateTree.add(njTreeBlosumMenuItem);
jMenu2.add(htmlMenuItem);
jMenu2.add(epsFile);
jMenu2.add(createPNG);
selectMenu.add(unGroup);
selectMenu.add(grpsFromSelection);
selectMenu.add(deleteGroups);
+ calculateMenu.add(expandAlignment);
// TODO - determine if the listenToViewSelections button is needed : see bug
// JAL-574
// selectMenu.addSeparator();
protected void purinePyrimidineColour_actionPerformed(ActionEvent e)
{
}
+
+ protected void RNAInteractionColour_actionPerformed(ActionEvent e)
+ {
+ }
+
/*
* protected void covariationColour_actionPerformed(ActionEvent e) { }
{
}
+
+ protected void expand_newalign(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
}
*/
package jalview.schemes;
+ import jalview.analysis.scoremodels.PIDScoreModel;
+ import jalview.api.analysis.ScoreModelI;
+
import java.util.*;
import java.util.List;
-
import java.awt.*;
public class ResidueProperties
{
- public static Hashtable scoreMatrices = new Hashtable();
+ public static Hashtable<String,ScoreModelI> scoreMatrices = new Hashtable();
// Stores residue codes/names and colours and other things
public static final int[] aaIndex; // aaHash version 2.1.1 and below
propHash.put("proline", proline);
propHash.put("polar", polar);
}
+ static
+ {
+ int[][][] propMatrix = new int[3][maxProteinIndex][maxProteinIndex];
+ for (int i=0;i<maxProteinIndex;i++)
+ {
+ String ic="";
+ if (aa.length<i) {
+ ic+=aa[i];
+ }
+ else {ic = "-";}
+ propMatrix[0][i][i]=propHash.size();
+ propMatrix[1][i][i]=propHash.size();
+ propMatrix[2][i][i]=propHash.size();
+ for (int j=i+1;j<maxProteinIndex; j++)
+ {
+ String jc="";
+ if (aa.length<j) {
+ jc+=aa[j];
+ }
+ else {jc = "-";}
+ propMatrix[0][i][j]=0;
+ propMatrix[1][i][j]=0;
+ propMatrix[2][i][j]=0;
+ for (Enumeration<String> en= (Enumeration<String>)propHash.keys(); en.hasMoreElements(); )
+ {
+ String ph = en.nextElement();
+ Map<String,Integer> pph=(Map<String,Integer>)propHash.get(ph);
+ propMatrix[0][i][j]+= pph.get(ic).equals(pph.get(jc)) ? pph.get(ic) : -1;
+ propMatrix[1][i][j]+= pph.get(ic).equals(pph.get(jc)) ? 1 : -1;
+ propMatrix[2][i][j]+= pph.get(ic).equals(pph.get(jc)) ? pph.get(ic)*2 : 0;
+ }
+ }
+ }
+
+ scoreMatrices.put("Conservation Pos", new ScoreMatrix("Conservation Pos",propMatrix[0],0));
+ scoreMatrices.put("Conservation Both", new ScoreMatrix("Conservation Both",propMatrix[1],0));
+ scoreMatrices.put("Conservation EnhPos", new ScoreMatrix("Conservation EnhPos",propMatrix[2],0));
+ scoreMatrices.put("PID", new PIDScoreModel());
+ }
private ResidueProperties()
{
public static ScoreMatrix getScoreMatrix(String pwtype)
{
Object val = scoreMatrices.get(pwtype);
- if (val != null)
+ if (val != null && val instanceof ScoreMatrix)
{
return (ScoreMatrix) val;
}
return null;
}
+ /**
+ * get a ScoreModel based on its string name
+ *
+ * @param pwtype
+ * @return scoremodel of type pwtype or null
+ */
+ public static ScoreModelI getScoreModel(String pwtype)
+ {
+ return scoreMatrices.get(pwtype);
+ }
public static int getPAM250(char c, char d)
{
public static Hashtable toRNAssState;
static
{
- toRNAssState = new Hashtable();
- toRNAssState.put(")", "S");
- toRNAssState.put("(", "S");
+ toRNAssState = new Hashtable<String,String>();
+ toRNAssState.put(")", "(");
+ toRNAssState.put("(", "(");
+ toRNAssState.put("]", "[");
+ toRNAssState.put("[", "[");
+ toRNAssState.put("{", "{");
+ toRNAssState.put("}", "{");
+ toRNAssState.put(">", ">");
+ toRNAssState.put("<", ">");
+ toRNAssState.put("A", "A");
+ toRNAssState.put("a", "A");
+ toRNAssState.put("B", "B");
+ toRNAssState.put("b", "B");
+ toRNAssState.put("C", "C");
+ toRNAssState.put("c", "C");
+ toRNAssState.put("D", "D");
+ toRNAssState.put("d", "D");
+ toRNAssState.put("E", "E");
+ toRNAssState.put("e", "E");
+ toRNAssState.put("F", "F");
+ toRNAssState.put("f", "F");
+ toRNAssState.put("G", "G");
+ toRNAssState.put("g", "G");
+ toRNAssState.put("H", "H");
+ toRNAssState.put("h", "H");
+ toRNAssState.put("I", "I");
+ toRNAssState.put("i", "I");
+ toRNAssState.put("J", "J");
+ toRNAssState.put("j", "J");
+ toRNAssState.put("K", "K");
+ toRNAssState.put("k", "K");
+ toRNAssState.put("L", "L");
+ toRNAssState.put("l", "L");
+ toRNAssState.put("M", "M");
+ toRNAssState.put("m", "M");
+ toRNAssState.put("N", "N");
+ toRNAssState.put("n", "N");
+ toRNAssState.put("O", "O");
+ toRNAssState.put("o", "O");
+ toRNAssState.put("P", "P");
+ toRNAssState.put("p", "P");
+ toRNAssState.put("Q", "Q");
+ toRNAssState.put("q", "Q");
+ toRNAssState.put("R", "R");
+ toRNAssState.put("r", "R");
+ toRNAssState.put("S", "S");
+ toRNAssState.put("s", "S");
+ toRNAssState.put("T", "T");
+ toRNAssState.put("t", "T");
+ toRNAssState.put("U", "U");
+ toRNAssState.put("u", "U");
+ toRNAssState.put("V", "V");
+ toRNAssState.put("v", "V");
+ toRNAssState.put("W", "W");
+ toRNAssState.put("w", "W");
+ toRNAssState.put("X", "X");
+ toRNAssState.put("x", "X");
+ toRNAssState.put("Y", "Y");
+ toRNAssState.put("y", "Y");
+ toRNAssState.put("Z", "Z");
+ toRNAssState.put("z", "Z");
+
}
/**