<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="utils"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/activation.jar"/>
<classpathentry kind="lib" path="lib/axis.jar" sourcepath="D:/axis-1_2RC2-src/axis-1_2RC2"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/plugin.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/plugin.java"/>
<classpathentry kind="output" path="classes"/>
</classpath>
</dictionary>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ <dictionary>
+ <key>LaunchConfigHandle</key>
+ <value><project>/.externalToolBuilders/Jalview build.xml [Builder] (1).launch</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
--- /dev/null
+/* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* Author: Lauren Michelle Lui
+ * Methods are based on RALEE methods http://personalpages.manchester.ac.uk/staff/sam.griffiths-jones/software/ralee/
+ * */
+
+package jalview.analysis;
+
+import java.util.Hashtable;
+import java.util.Vector;
+
+import jalview.datamodel.SequenceFeature;
+
+public class Rna
+{
+ /**
+ * Based off of RALEE code ralee-get-base-pairs. Keeps track of open bracket
+ * positions in "stack" vector. When a close bracket is reached, pair this
+ * with the last element in the "stack" vector and store in "pairs" vector.
+ * Remove last element in the "stack" vector. Continue in this manner until
+ * the whole string is processed.
+ *
+ * @param line
+ * Secondary structure line of an RNA Stockholm file
+ * @return Array of SequenceFeature; type = RNA helix, begin is open base
+ * pair, end is close base pair
+ */
+ public static SequenceFeature[] GetBasePairs(String line)
+ {
+
+ Vector stack = new Vector();
+ Vector pairs = new Vector();
+
+ int i = 0;
+ while (i < line.length())
+ {
+ char base = line.charAt(i);
+
+ if ((base == '<') || (base == '(') || (base == '{') || (base == '['))
+ {
+ stack.addElement(i);
+ }
+ else if ((base == '>') || (base == ')') || (base == '}')
+ || (base == ']'))
+ {
+
+ Object temp = stack.lastElement();
+ stack.remove(stack.size() - 1);
+ pairs.addElement(temp);
+ pairs.addElement(i);
+ }
+
+ i++;
+ }
+
+ int numpairs = pairs.size() / 2;
+ SequenceFeature[] outPairs = new SequenceFeature[numpairs];
+
+ // Convert pairs to array
+ for (int p = 0; p < pairs.size(); p += 2)
+ {
+ int begin = Integer.parseInt(pairs.elementAt(p).toString());
+ int end = Integer.parseInt(pairs.elementAt(p + 1).toString());
+
+ outPairs[p / 2] = new SequenceFeature("RNA helix", "", "", begin,
+ end, "");
+ }
+
+ return outPairs;
+ }
+
+ /**
+ * Figures out which helix each position belongs to and stores the helix
+ * number in the 'featureGroup' member of a SequenceFeature Based off of RALEE
+ * code ralee-helix-map.
+ *
+ * @param pairs
+ * Array of SequenceFeature (output from Rna.GetBasePairs)
+ */
+ public static void HelixMap(SequenceFeature[] pairs)
+ {
+
+ int helix = 0; // Number of helices/current helix
+ int lastopen = 0; // Position of last open bracket reviewed
+ int lastclose = 9999999; // Position of last close bracket reviewed
+ int i = pairs.length; // Number of pairs
+
+ int open; // Position of an open bracket under review
+ int close; // Position of a close bracket under review
+ int j; // Counter
+
+ Hashtable helices = new Hashtable(); // Keep track of helix number for each
+ // position
+
+ // Go through each base pair and assign positions a helix
+ for (i = 0; i < pairs.length; i++)
+ {
+
+ open = pairs[i].getBegin();
+ close = pairs[i].getEnd();
+
+ // System.out.println("open " + open + " close " + close);
+ // System.out.println("lastclose " + lastclose + " lastopen " + lastopen);
+
+ // we're moving from right to left based on closing pair
+ /*
+ * catch things like <<..>>..<<..>> |
+ */
+ if (open > lastclose)
+ {
+ helix++;
+ }
+
+ /*
+ * catch things like <<..<<..>>..<<..>>>> |
+ */
+ j = pairs.length - 1;
+ while (j >= 0)
+ {
+ int popen = pairs[j].getBegin();
+
+ // System.out.println("j " + j + " popen " + popen + " lastopen "
+ // +lastopen + " open " + open);
+ if ((popen < lastopen) && (popen > open))
+ {
+ if (helices.containsValue(popen)
+ && (((Integer) helices.get(popen)) == helix))
+ {
+ continue;
+ }
+ else
+ {
+ helix++;
+ break;
+ }
+ }
+
+ j -= 1;
+ }
+
+ // Put positions and helix information into the hashtable
+ helices.put(open, helix);
+ helices.put(close, helix);
+
+ // Record helix as featuregroup
+ pairs[i].setFeatureGroup(Integer.toString(helix));
+ pairs[i].setFeatureGroup(Integer.toString(helix));
+
+ lastopen = open;
+ lastclose = close;
+
+ }
+ }
+}
MenuItem turn = new MenuItem("Turn Propensity");
MenuItem buried = new MenuItem("Buried Index");
+
+ MenuItem purinepyrimidine = new MenuItem("Purine/Pyrimidine");
MenuItem user = new MenuItem("User Defined Colours");
strand.addActionListener(this);
turn.addActionListener(this);
buried.addActionListener(this);
+ purinepyrimidine.addActionListener(this);
user.addActionListener(this);
jmolHelp.addActionListener(this);
coloursMenu.add(strand);
coloursMenu.add(turn);
coloursMenu.add(buried);
+ coloursMenu.add(purinepyrimidine);
coloursMenu.add(user);
coloursMenu.add(jmolColour);
helpMenu.add(jmolHelp);
setEnabled(buried);
jmb.setJalviewColourScheme(new BuriedColourScheme());
}
+ else if(evt.getSource() == purinepyrimidine)
+ {
+ jmb.setJalviewColourScheme(new PurinePyrimidineColourScheme());
+ }
else if (evt.getSource() == user)
{
setEnabled(user);
*/
package jalview.datamodel;
+import jalview.analysis.Rna;
+
import java.util.Enumeration;
import java.util.Hashtable;
/** DOCUMENT ME!! */
public Annotation[] annotations;
+ /**
+ * RNA secondary structure contact positions
+ */
+ public SequenceFeature[] _rnasecstr = null;
+
+ /**
+ * Updates the _rnasecstr field Determines the positions that base pair and
+ * the positions of helices based on secondary structure from a Stockholm file
+ *
+ * @param RNAannot
+ */
+ private void _updateRnaSecStr(String RNAannot)
+ {
+ _rnasecstr = Rna.GetBasePairs(RNAannot);
+ Rna.HelixMap(_rnasecstr);
+
+ if (_rnasecstr != null && _rnasecstr.length > 0)
+ {
+ // show all the RNA secondary structure annotation symbols.
+ showAllColLabels = true;
+ scaleColLabel = true;
+ }
+ // System.out.println("featuregroup " + _rnasecstr[0].getFeatureGroup());
+ }
+
public java.util.Hashtable sequenceMapping;
/** DOCUMENT ME!! */
validateRangeAndDisplay();
}
+ /**
+ * Checks if annotation labels represent secondary structures
+ *
+ */
void areLabelsSecondaryStructure()
{
boolean nonSSLabel = false;
+ boolean isrna = false;
+ StringBuffer rnastring = new StringBuffer();
+
char firstChar = 0;
for (int i = 0; i < annotations.length; i++)
{
{
hasIcons |= true;
}
+ else
+ // Check for RNA secondary structure
+ {
+ if (annotations[i].secondaryStructure == 'S')
+ {
+ hasIcons |= true;
+ isrna |= true;
+ }
+ }
- if (annotations[i].displayCharacter == null)
+ // System.out.println("displaychar " + annotations[i].displayCharacter);
+
+ if (annotations[i].displayCharacter == null
+ || annotations[i].displayCharacter.length() == 0)
{
+ rnastring.append('.');
continue;
}
if (annotations[i].displayCharacter.length() == 1)
firstChar != ' '
&& firstChar != 'H'
&& firstChar != 'E'
+ && firstChar != 'S'
&& firstChar != '-'
&& firstChar < jalview.schemes.ResidueProperties.aaIndex.length)
{
}
}
}
+ else
+ {
+ rnastring.append(annotations[i].displayCharacter.charAt(1));
+ }
if (annotations[i].displayCharacter.length() > 0)
{
}
}
+ else
+ {
+ if (isrna)
+ {
+ _updateRnaSecStr(rnastring.toString());
+ }
+ }
annotationId = this.hashCode() + "";
}
* PFAM ID\r
*/\r
public static String PFAM = "PFAM";\r
+ \r
+ /**\r
+ * RFAM ID\r
+ */\r
+ public static String RFAM = "RFAM";\r
\r
/**\r
* GeneDB ID\r
{ PDB };\r
\r
public static final String[] DOMAINDBS =\r
- { PFAM };\r
+ { PFAM, RFAM };\r
\r
/**\r
* set of unique DBRefSource property constants. These could be used to\r
public static final Object DNACODINGSEQDB = "XONCODING";\r
\r
/**\r
- * DB returns several sequences associated with a protein domain\r
+ * DB returns several sequences associated with a protein/nucleotide domain\r
*/\r
public static final Object DOMAINDB = "DOMAIN";\r
\r
import jalview.schemes.HydrophobicColourScheme;
import jalview.schemes.NucleotideColourScheme;
import jalview.schemes.PIDColourScheme;
+import jalview.schemes.PurinePyrimidineColourScheme;
import jalview.schemes.ResidueProperties;
import jalview.schemes.StrandColourScheme;
import jalview.schemes.TaylorColourScheme;
changeColour(new NucleotideColourScheme());
}
+ public void purinePyrimidineColour_actionPerformed(ActionEvent e)
+ {
+ changeColour(new PurinePyrimidineColourScheme());
+ }
+ /*
+ public void covariationColour_actionPerformed(ActionEvent e)
+ {
+ changeColour(new CovariationColourScheme(viewport.alignment.getAlignmentAnnotation()[0]));
+ }
+ */
public void annotationColour_actionPerformed(ActionEvent e)
{
new AnnotationColourChooser(viewport, alignPanel);
}
+
+ public void rnahelicesColour_actionPerformed(ActionEvent e)
+ {
+ new RNAHelicesColourChooser(viewport, alignPanel);
+ }
/**
* DOCUMENT ME!
import javax.swing.*;
+import com.stevesoft.pat.Regex;
+
import jalview.analysis.AAFrequency;
import jalview.datamodel.*;
import jalview.schemes.ColourSchemeI;
final String SHEET = "Sheet";
+ /**
+ * For RNA secondary structure "stems" aka helices
+ */
+ final String STEM = "RNA Helix";
+
final String LABEL = "Label";
final String REMOVE = "Remove Annotation";
final Color SHEET_COLOUR = Color.green.darker().darker();
+ final Color STEM_COLOUR = Color.blue.darker();
+
/** DOCUMENT ME!! */
AlignViewport av;
symbol = "\u03B2";
}
+ // Added by LML to color stems
+ else if (evt.getActionCommand().equals(STEM))
+ {
+ type = 'S';
+ symbol = "\u03C3";
+ }
+
if (!aa[activeRow].hasIcons)
{
aa[activeRow].hasIcons = true;
continue;
String tlabel = null;
if (anot[index] != null)
- {
+ { // LML added stem code
if (label2.equals(HELIX) || label2.equals(SHEET)
- || label2.equals(LABEL))
+ || label2.equals(STEM) || label2.equals(LABEL))
{
tlabel = anot[index].description;
if (tlabel == null || tlabel.length() < 1)
{
- if (label2.equals(HELIX) || label2.equals(SHEET))
+ if (label2.equals(HELIX) || label2.equals(SHEET)
+ || label2.equals(STEM))
{
tlabel = "" + anot[index].secondaryStructure;
}
item = new JMenuItem(SHEET);
item.addActionListener(this);
pop.add(item);
+ item = new JMenuItem(STEM);
+ item.addActionListener(this);
+ pop.add(item);
item = new JMenuItem(LABEL);
item.addActionListener(this);
pop.add(item);
break;
+ case 'S': // Stem case for RNA secondary structure
+ g.setColor(STEM_COLOUR); // row.annotations[column].colour for By
+ // RNA Helices colouring
+ // System.out.println("last SSX displayx" +
+ // row.annotations[column-1].displayCharacter +"x");
+ Regex closeparen = new Regex("(\\))");
+
+ //If a closing base pair half of the stem, display a backward arrow
+ if (closeparen
+ .search(row.annotations[column - 1].displayCharacter))// row.annotations[column-1].displayCharacter))
+ {
+ g.fillPolygon(new int[]
+ { lastSSX + 5, lastSSX + 5, lastSSX },
+ new int[]
+ { y + iconOffset, y + 14 + iconOffset,
+ y + 8 + iconOffset }, 3);
+ g.fillRect(lastSSX + 2, y + 4 + iconOffset,
+ (x * av.charWidth) - lastSSX - 2, 7);
+ }
+ else //display a forward arrow
+ {
+ g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
+ - lastSSX - 4, 7);
+ g.fillPolygon(new int[]
+ { (x * av.charWidth) - 5, (x * av.charWidth) - 5,
+ (x * av.charWidth) },
+ new int[]
+ { y + iconOffset, y + 14 + iconOffset,
+ y + 8 + iconOffset }, 3);
+ }
+ break;
+
default:
g.setColor(Color.gray);
g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
buriedColour.setSelected(true);
jmb.setJalviewColourScheme(new BuriedColourScheme());
}
-
+
+ public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
+ {
+ setJalviewColourScheme(new PurinePyrimidineColourScheme());
+ }
+
public void userColour_actionPerformed(ActionEvent actionEvent)
{
userColour.setSelected(true);
}
// TODO: update this text for each release or centrally store it for lite
// and application
- message.append("\nAuthors: Jim Procter, Jan Engelhardt, Lauren Lui, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,\n David Martin & Geoff Barton."
+ message.append("\nAuthors: Jim Procter, Jan Engelhardt2, Lauren Lui, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,\n David Martin & Geoff Barton."
+ "\nDevelopment managed by The Barton Group, University of Dundee, Scotland, UK.\n"
+ "\nFor help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list\n"
+ "\nIf you use Jalview, please cite:"
protected JRadioButtonMenuItem PIDColour = new JRadioButtonMenuItem();
protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+
+ //protected JRadioButtonMenuItem covariationColour = new JRadioButtonMenuItem();
JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem();
colours.add(userDefinedColour);
colours.add(PIDColour);
colours.add(BLOSUM62Colour);
+ colours.add(purinePyrimidineColour);
+ //colours.add(covariationColour);
for (int i = 0; i < jalview.io.FormatAdapter.WRITEABLE_FORMATS.length; i++)
{
{
clustalColour.setSelected(true);
}
+ else if (sg.cs instanceof PurinePyrimidineColourScheme)
+ {
+ purinePyrimidineColour.setSelected(true);
+ }
+ /* else if (sg.cs instanceof CovariationColourScheme)
+ {
+ covariationColour.setSelected(true);
+ }*/
else
{
noColourmenuItem.setSelected(true);
colourMenu.add(turnColour);
colourMenu.add(buriedColour);
colourMenu.add(nucleotideMenuItem);
+ colourMenu.add(purinePyrimidineColour);
+ //colourMenu.add(covariationColour);
colourMenu.add(userDefinedColour);
if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null)
BLOSUM62Colour_actionPerformed();
}
});
+ purinePyrimidineColour.setText("Purine/Pyrimidine");
+ purinePyrimidineColour.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ purinePyrimidineColour_actionPerformed();
+ }
+ });
+ /*
+ covariationColour.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ covariationColour_actionPerformed();
+ }
+ });*/
+
conservationMenuItem.setText("Conservation");
conservationMenuItem
.addActionListener(new java.awt.event.ActionListener()
getGroup().cs = new NucleotideColourScheme();
refresh();
}
-
+
+ protected void purinePyrimidineColour_actionPerformed()
+ {
+ getGroup().cs = new PurinePyrimidineColourScheme();
+ refresh();
+ }
+ /*
+ protected void covariationColour_actionPerformed()
+ {
+ getGroup().cs = new CovariationColourScheme(sequence.getAnnotation()[0]);
+ refresh();
+ }
+*/
/**
* DOCUMENT ME!
*
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.gui;
+
+import java.util.*;
+import java.awt.event.*;
+
+import jalview.datamodel.*;
+import jalview.schemes.*;
+
+/**
+ * Helps generate the colors for RNA secondary structure. Future: add option to
+ * change colors based on covariation.
+ *
+ * @author Lauren Michelle Lui
+ *
+ */
+public class RNAHelicesColourChooser
+{
+
+ AlignViewport av;
+
+ AlignmentPanel ap;
+
+ ColourSchemeI oldcs;
+
+ Hashtable oldgroupColours;
+
+ jalview.datamodel.AlignmentAnnotation currentAnnotation;
+
+ boolean adjusting = false;
+
+ public RNAHelicesColourChooser(AlignViewport av, final AlignmentPanel ap)
+ {
+ oldcs = av.getGlobalColourScheme();
+ if (av.alignment.getGroups() != null)
+ {
+ oldgroupColours = new Hashtable();
+ Vector allGroups = ap.av.alignment.getGroups();
+ SequenceGroup sg;
+ for (int g = 0; g < allGroups.size(); g++)
+ {
+ sg = (SequenceGroup) allGroups.get(g);
+ if (sg.cs != null)
+ {
+ oldgroupColours.put(sg, sg.cs);
+ }
+ }
+ }
+ this.av = av;
+ this.ap = ap;
+
+ if (oldcs instanceof RNAHelicesColour)
+ {
+ RNAHelicesColour rhc = (RNAHelicesColour) oldcs;
+
+ }
+
+ adjusting = true;
+ Vector list = new Vector();
+ int index = 1;
+ for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++)
+ {
+ String label = av.alignment.getAlignmentAnnotation()[i].label;
+ if (!list.contains(label))
+ list.addElement(label);
+ else
+ list.addElement(label + "_" + (index++));
+ }
+
+ adjusting = false;
+
+ changeColour();
+
+ }
+
+ void changeColour()
+ {
+ // Check if combobox is still adjusting
+ if (adjusting)
+ {
+ return;
+ }
+
+ currentAnnotation = av.alignment.getAlignmentAnnotation()[0];// annotations.getSelectedIndex()];
+
+ RNAHelicesColour rhc = null;
+
+ rhc = new RNAHelicesColour(currentAnnotation);
+
+ av.setGlobalColourScheme(rhc);
+
+ if (av.alignment.getGroups() != null)
+ {
+ Vector allGroups = ap.av.alignment.getGroups();
+ SequenceGroup sg;
+ for (int g = 0; g < allGroups.size(); g++)
+ {
+ sg = (SequenceGroup) allGroups.get(g);
+
+ if (sg.cs == null)
+ {
+ continue;
+ }
+
+ sg.cs = new RNAHelicesColour(currentAnnotation);
+
+ }
+ }
+
+ ap.paintAlignment(false);
+ }
+
+ void reset()
+ {
+ av.setGlobalColourScheme(oldcs);
+ if (av.alignment.getGroups() != null)
+ {
+ Vector allGroups = ap.av.alignment.getGroups();
+ SequenceGroup sg;
+ for (int g = 0; g < allGroups.size(); g++)
+ {
+ sg = (SequenceGroup) allGroups.get(g);
+ sg.cs = (ColourSchemeI) oldgroupColours.get(sg);
+ }
+ }
+ }
+
+ public void annotations_actionPerformed(ActionEvent e)
+ {
+ changeColour();
+ }
+
+}
*/
public static final String[] READABLE_EXTENSIONS = new String[]
{ "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar",
- "sto" }; // ,
+ "sto", "stk" }; // ,
// ".blast"
// };
\r
import com.stevesoft.pat.*;\r
import jalview.datamodel.*;\r
+import jalview.analysis.Rna;\r
\r
// import org.apache.log4j.*;\r
\r
Hashtable seqs = new Hashtable();\r
Regex p, r, rend, s, x;\r
\r
+ // Temporary line for processing RNA annotation\r
+ // String RNAannot = "";\r
+\r
// ------------------ Parsing File ----------------------\r
// First, we have to check that this file has STOCKHOLM format, i.e. the\r
// first line must match\r
r = new Regex("#=(G[FSRC]?)\\s+(.*)"); // Finds any annotation line\r
x = new Regex("(\\S+)\\s+(\\S+)"); // split id from sequence\r
\r
+ // Convert all bracket types to parentheses (necessary for passing to VARNA)\r
+ Regex openparen = new Regex("(<|\\[)", "(");\r
+ Regex closeparen = new Regex("(>|\\])", ")");\r
+\r
+ // Detect if file is RNA by looking for bracket types\r
+ Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");\r
+\r
rend.optimize();\r
p.optimize();\r
s.optimize();\r
r.optimize();\r
x.optimize();\r
+ openparen.optimize();\r
+ closeparen.optimize();\r
\r
while ((line = nextLine()) != null)\r
{\r
private AlignmentAnnotation parseAnnotationRow(Vector annotation,\r
String label, String annots)\r
{\r
+ String convert1, convert2 = null;\r
+\r
+ // Convert all bracket types to parentheses\r
+ Regex openparen = new Regex("(<|\\[)", "(");\r
+ Regex closeparen = new Regex("(>|\\])", ")");\r
+\r
+ // Detect if file is RNA by looking for bracket types\r
+ Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");\r
+\r
+ convert1 = openparen.replaceAll(annots);\r
+ convert2 = closeparen.replaceAll(convert1);\r
+ annots = convert2;\r
+\r
String type = (label.indexOf("_cons") == label.length() - 5) ? label\r
.substring(0, label.length() - 5) : label;\r
boolean ss = false;\r
// be written out\r
if (ss)\r
{\r
- ann.secondaryStructure = jalview.schemes.ResidueProperties\r
- .getDssp3state(pos).charAt(0);\r
+ if (detectbrackets.search(pos))\r
+ {\r
+ ann.secondaryStructure = jalview.schemes.ResidueProperties\r
+ .getRNASecStrucState(pos).charAt(0);\r
+ }\r
+ else\r
+ {\r
+ ann.secondaryStructure = jalview.schemes.ResidueProperties\r
+ .getDssp3state(pos).charAt(0);\r
+ }\r
+\r
if (ann.secondaryStructure == pos.charAt(0) || pos.charAt(0) == 'C')\r
{\r
ann.displayCharacter = ""; // null; // " ";\r
+ id);\r
return id;\r
}\r
+ /**\r
+ * //ssline is complete secondary structure line private AlignmentAnnotation\r
+ * addHelices(Vector annotation, String label, String ssline) {\r
+ * \r
+ * // decide on secondary structure or not. Annotation[] els = new\r
+ * Annotation[ssline.length()]; for (int i = 0; i < ssline.length(); i++) {\r
+ * String pos = ssline.substring(i, i + 1); Annotation ann; ann = new\r
+ * Annotation(pos, "", ' ', 0f); // 0f is 'valid' null - will not\r
+ * \r
+ * ann.secondaryStructure =\r
+ * jalview.schemes.ResidueProperties.getRNAssState(pos).charAt(0);\r
+ * \r
+ * ann.displayCharacter = "x" + ann.displayCharacter;\r
+ * \r
+ * System.out.println(ann.displayCharacter);\r
+ * \r
+ * els[i] = ann; } AlignmentAnnotation helicesAnnot = null; Enumeration e =\r
+ * annotation.elements(); while (e.hasMoreElements()) { helicesAnnot =\r
+ * (AlignmentAnnotation) e.nextElement(); if (helicesAnnot.label.equals(type))\r
+ * break; helicesAnnot = null; } if (helicesAnnot == null) { helicesAnnot =\r
+ * new AlignmentAnnotation(type, type, els);\r
+ * annotation.addElement(helicesAnnot); } else { Annotation[] anns = new\r
+ * Annotation[helicesAnnot.annotations.length + els.length];\r
+ * System.arraycopy(helicesAnnot.annotations, 0, anns, 0,\r
+ * helicesAnnot.annotations.length); System.arraycopy(els, 0, anns,\r
+ * helicesAnnot.annotations.length, els.length); helicesAnnot.annotations =\r
+ * anns; }\r
+ * \r
+ * helicesAnnot.features = Rna.GetBasePairs(ssline);\r
+ * Rna.HelixMap(helicesAnnot.features);\r
+ * \r
+ * \r
+ * return helicesAnnot; }\r
+ */\r
}\r
protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+
+ // protected JRadioButtonMenuItem covariationColour = new
+ // JRadioButtonMenuItem();
+
JMenuItem njTreeBlosumMenuItem = new JMenuItem();
JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem();
public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem();
- protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();
-
JMenuItem deleteGroups = new JMenuItem();
JMenuItem delete = new JMenuItem();
JMenuItem annotationColour = new JMenuItem();
+ JMenuItem rnahelicesColour = new JMenuItem();
+
JMenuItem associatedData = new JMenuItem();
protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem();
colours.add(PIDColour);
colours.add(BLOSUM62Colour);
colours.add(nucleotideColour);
+ colours.add(purinePyrimidineColour);
+ // colours.add(covariationColour);
setColourSelected(jalview.bin.Cache
.getDefault("DEFAULT_COLOUR", "None"));
break;
+ case ColourSchemeProperty.PURINEPYRIMIDINE:
+ purinePyrimidineColour.setSelected(true);
+
+ break;
+ /*
+ * case ColourSchemeProperty.COVARIATION:
+ * covariationColour.setSelected(true);
+ *
+ * break;
+ */
case ColourSchemeProperty.USER_DEFINED:
userDefinedColour.setSelected(true);
BLOSUM62Colour_actionPerformed(e);
}
});
+ nucleotideColour.setText("Nucleotide");
+ nucleotideColour.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ nucleotideColour_actionPerformed(e);
+ }
+ });
+
+ purinePyrimidineColour.setText("Purine/Pyrimidine");
+ purinePyrimidineColour
+ .addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ purinePyrimidineColour_actionPerformed(e);
+ }
+ });
+ /*
+ * covariationColour.setText("Covariation");
+ * covariationColour.addActionListener(new java.awt.event.ActionListener() {
+ * public void actionPerformed(ActionEvent e) {
+ * covariationColour_actionPerformed(e); } });
+ */
+
avDistanceTreeBlosumMenuItem.setText("Average Distance Using BLOSUM62");
avDistanceTreeBlosumMenuItem
.addActionListener(new java.awt.event.ActionListener()
annotationColour_actionPerformed(e);
}
});
+
+ rnahelicesColour.setText("By RNA helices");
+ rnahelicesColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ rnahelicesColour_actionPerformed(e);
+ }
+ });
+
associatedData.setText("Load Features / Annotations");
associatedData.addActionListener(new ActionListener()
{
colourMenu.add(turnColour);
colourMenu.add(buriedColour);
colourMenu.add(nucleotideColour);
+ colourMenu.add(purinePyrimidineColour);
+ // colourMenu.add(covariationColour);
colourMenu.add(userDefinedColour);
colourMenu.addSeparator();
colourMenu.add(conservationMenuItem);
colourMenu.add(abovePIDThreshold);
colourMenu.add(modifyPID);
colourMenu.add(annotationColour);
+ colourMenu.add(rnahelicesColour);
calculateMenu.add(sort);
calculateMenu.add(calculateTree);
calculateMenu.addSeparator();
{
}
+ protected void purinePyrimidineColour_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /*
+ * protected void covariationColour_actionPerformed(ActionEvent e) { }
+ */
+
protected void noColourmenuItem_actionPerformed(ActionEvent e)
{
}
}
+ public void rnahelicesColour_actionPerformed(ActionEvent e)
+ {
+
+ }
+
public void associatedData_actionPerformed(ActionEvent e)
{
buriedColour_actionPerformed(actionEvent);
}
});
+ purinePyrimidineColour.setText("Purine/Pyrimidine");
+ purinePyrimidineColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ purinePyrimidineColour_actionPerformed(actionEvent);
+ }
+ });
+
userColour.setText("User Defined ...");
userColour.addActionListener(new ActionListener()
{
colourMenu.add(strandColour);
colourMenu.add(turnColour);
colourMenu.add(buriedColour);
+ colourMenu.add(purinePyrimidineColour);
colourMenu.add(userColour);
colourMenu.add(jmolColour);
colourMenu.add(backGround);
protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();
protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+
protected JRadioButtonMenuItem userColour = new JRadioButtonMenuItem();
{
}
+
+ public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
public void userColour_actionPerformed(ActionEvent actionEvent)
{
{
ret = NONE;
}
+ else if (name.equalsIgnoreCase("Purine/Pyrimidine"))
+ {
+ ret = PURINEPYRIMIDINE;
+ }
+ // else if (name.equalsIgnoreCase("Covariation"))
+ // {
+ // ret = COVARIATION;
+ // }
return ret;
}
{
index = NUCLEOTIDE;
}
+ else if (cs instanceof PurinePyrimidineColourScheme)
+ {
+ index = PURINEPYRIMIDINE;
+ }
+ /*
+ * else if (cs instanceof CovariationColourScheme) { index = COVARIATION; }
+ */
else if (cs instanceof UserColourScheme)
{
if ((((UserColourScheme) cs).getName() != null)
break;
+ case PURINEPYRIMIDINE:
+ ret = "Purine/Pyrimidine";
+
+ break;
+
+ /*
+ * case COVARIATION: ret = "Covariation";
+ *
+ * break;
+ */
case USER_DEFINED:
ret = "User Defined";
break;
+ case PURINEPYRIMIDINE:
+ cs = new PurinePyrimidineColourScheme();
+
+ break;
+
+ // case COVARIATION:
+ // cs = new CovariationColourScheme(annotation);
+
+ // break;
+
case USER_DEFINED:
Color[] col = new Color[24];
for (int i = 0; i < 24; i++)
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.schemes;
+
+import java.awt.*;
+import java.util.Hashtable;
+
+import jalview.datamodel.AlignmentAnnotation;
+
+/**
+ * Became RNAHelicesColour.java. Placeholder for true covariation color scheme
+ *
+ * @author Lauren Michelle Lui
+ * @version 2.5
+ */
+public class CovariationColourScheme extends ResidueColourScheme
+{
+ public Hashtable helixcolorhash = new Hashtable();
+
+ public Hashtable positionsToHelix = new Hashtable();
+
+ int numHelix = 0;
+
+ public AlignmentAnnotation annotation;
+
+ /**
+ * Creates a new CovariationColourScheme object.
+ */
+ public CovariationColourScheme(AlignmentAnnotation annotation)
+ {
+ this.annotation = annotation;
+
+ for (int x = 0; x < this.annotation._rnasecstr.length; x++)
+ {
+ // System.out.println(this.annotation._rnasecstr[x] + " Begin" +
+ // this.annotation._rnasecstr[x].getBegin());
+ // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup());
+ // pairs.put(this.annotation._rnasecstr[x].getBegin(),
+ // this.annotation._rnasecstr[x].getEnd());
+
+ positionsToHelix.put(this.annotation._rnasecstr[x].getBegin(),
+ this.annotation._rnasecstr[x].getFeatureGroup());
+ positionsToHelix.put(this.annotation._rnasecstr[x].getEnd(),
+ this.annotation._rnasecstr[x].getFeatureGroup());
+
+ if (Integer.parseInt(this.annotation._rnasecstr[x].getFeatureGroup()) > numHelix)
+ {
+ numHelix = Integer.parseInt(this.annotation._rnasecstr[x]
+ .getFeatureGroup());
+ }
+
+ }
+
+ for (int j = 0; j <= numHelix; j++)
+ {
+ helixcolorhash.put(Integer.toString(j), jalview.util.ColorUtils
+ .generateRandomColor(Color.white));
+ }
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color findColour(char c)
+ {
+ // System.out.println("called"); log.debug
+ // Generate a random pastel color
+
+ return ResidueProperties.purinepyrimidine[ResidueProperties.purinepyrimidineIndex[c]];// jalview.util.ColorUtils.generateRandomColor(Color.white);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n
+ * DOCUMENT ME!
+ * @param j
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color findColour(char c, int j)
+ {
+ Color currentColour = Color.white;
+ String currentHelix = null;
+ // System.out.println(c + " " + j);
+ currentHelix = (String) positionsToHelix.get(j);
+ // System.out.println(positionsToHelix.get(j));
+
+ if (currentHelix != null)
+ {
+ currentColour = (Color) helixcolorhash.get(currentHelix);
+ }
+
+ // System.out.println(c + " " + j + " helix " + currentHelix + " " +
+ // currentColour);
+ return currentColour;
+ }
+
+}
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.schemes;
+
+import java.awt.*;
+
+/**
+ * Class is based off of NucleotideColourScheme
+ *
+ * @author Lauren Michelle Lui
+ */
+public class PurinePyrimidineColourScheme extends ResidueColourScheme
+{
+ /**
+ * Creates a new PurinePyrimidineColourScheme object.
+ */
+ public PurinePyrimidineColourScheme()
+ {
+ super(ResidueProperties.purinepyrimidine, 0);
+ }
+
+ /**
+ * Finds the corresponding color for the type of character inputed
+ *
+ * @param c
+ * Character in sequence
+ *
+ * @return Color from purinepyrimidineIndex in
+ * jalview.schemes.ResidueProperties
+ */
+ public Color findColour(char c)
+ {
+ return colors[ResidueProperties.purinepyrimidineIndex[c]];
+ }
+
+ /**
+ * Returns color based on conservation
+ *
+ * @param c
+ * Character in sequence
+ * @param j
+ * Threshold
+ *
+ * @return Color in RGB
+ */
+ public Color findColour(char c, int j)
+ {
+ Color currentColour;
+ if ((threshold == 0) || aboveThreshold(c, j))
+ {
+ try
+ {
+ currentColour = colors[ResidueProperties.purinepyrimidineIndex[c]];
+ } catch (Exception ex)
+ {
+ return Color.white;
+ }
+ }
+ else
+ {
+ return Color.white;
+ }
+
+ if (conservationColouring)
+ {
+ currentColour = applyConservation(currentColour, j);
+ }
+
+ return currentColour;
+ }
+}
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.schemes;
+
+import java.awt.*;
+import java.util.Hashtable;
+
+import jalview.datamodel.AlignmentAnnotation;
+
+/**
+ * Looks at the information computed from an RNA Stockholm format file on the
+ * secondary structure of the alignment. Extracts the information on the
+ * positions of the helices present and assigns colors.
+ *
+ * @author Lauren Michelle Lui
+ * @version 2.5
+ */
+public class RNAHelicesColour extends ResidueColourScheme
+{
+
+ /**
+ * Stores random colors generated for the number of helices
+ */
+ public Hashtable helixcolorhash = new Hashtable();
+
+ /**
+ * Maps sequence positions to the RNA helix they belong to. Key: position,
+ * Value: helix
+ */
+ public Hashtable positionsToHelix = new Hashtable();
+
+ /**
+ * Number of helices in the RNA secondary structure
+ */
+ int numHelix = 0;
+
+ public AlignmentAnnotation annotation;
+
+ /**
+ * Creates a new RNAHelicesColour object.
+ */
+ public RNAHelicesColour(AlignmentAnnotation annotation)
+ {
+ this.annotation = annotation;
+
+ // Figure out number of helices
+ // Length of rnasecstr is the number of pairs of positions that base pair
+ // with each other in the secondary structure
+ for (int x = 0; x < this.annotation._rnasecstr.length; x++)
+ {
+
+ /*
+ * System.out.println(this.annotation._rnasecstr[x] + " Begin" +
+ * this.annotation._rnasecstr[x].getBegin());
+ */
+ // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup());
+
+ positionsToHelix.put(this.annotation._rnasecstr[x].getBegin(),
+ this.annotation._rnasecstr[x].getFeatureGroup());
+ positionsToHelix.put(this.annotation._rnasecstr[x].getEnd(),
+ this.annotation._rnasecstr[x].getFeatureGroup());
+
+ if (Integer.parseInt(this.annotation._rnasecstr[x].getFeatureGroup()) > numHelix)
+ {
+ numHelix = Integer.parseInt(this.annotation._rnasecstr[x]
+ .getFeatureGroup());
+ }
+
+ }
+
+ // Generate random colors and store
+ for (int j = 0; j <= numHelix; j++)
+ {
+ helixcolorhash.put(Integer.toString(j), jalview.util.ColorUtils
+ .generateRandomColor(Color.white));
+ }
+
+ }
+
+ /**
+ * Returns default color base on purinepyrimidineIndex in
+ * jalview.schemes.ResidueProperties (Allows coloring in sequence logo)
+ *
+ * @param c
+ * Character in sequence
+ *
+ * @return color in RGB
+ */
+ public Color findColour(char c)
+ {
+ return ResidueProperties.purinepyrimidine[ResidueProperties.purinepyrimidineIndex[c]];
+ // random colors for all positions
+ // jalview.util.ColorUtils.generateRandomColor(Color.white); If you want
+ }
+
+ /**
+ * Returns color based on helices
+ *
+ * @param c
+ * Character in sequence
+ * @param j
+ * Threshold
+ *
+ * @return Color in RGB
+ */
+ public Color findColour(char c, int j)
+ {
+ Color currentColour = Color.white;
+ String currentHelix = null;
+ currentHelix = (String) positionsToHelix.get(j);
+
+ if (currentHelix != null)
+ {
+ currentColour = (Color) helixcolorhash.get(currentHelix);
+ }
+
+ // System.out.println(c + " " + j + " helix " + currentHelix + " " +
+ // currentColour);
+ return currentColour;
+ }
+}
public static final int[] nucleotideIndex;
+ public static final int[] purinepyrimidineIndex;
+
public static final Hashtable aa3Hash = new Hashtable();
public static final Hashtable aa2Triplet = new Hashtable();
nucleotideName.put("y", "Unknown Pyrimidine");
nucleotideName.put("N", "Unknown");
nucleotideName.put("n", "Unknown");
+ nucleotideName.put("W", "Weak nucleotide (A or T)");
+ nucleotideName.put("w", "Weak nucleotide (A or T)");
+ nucleotideName.put("S", "Strong nucleotide (G or C)");
+ nucleotideName.put("s", "Strong nucleotide (G or C)");
+ nucleotideName.put("M", "Amino (A or C)");
+ nucleotideName.put("m", "Amino (A or C)");
+ nucleotideName.put("K", "Keto (G or T)");
+ nucleotideName.put("k", "Keto (G or T)");
+ nucleotideName.put("B", "Not A (G or C or T)");
+ nucleotideName.put("b", "Not A (G or C or T)");
+ nucleotideName.put("H", "Not G (A or C or T)");
+ nucleotideName.put("h", "Not G (A or C or T)");
+ nucleotideName.put("D", "Not C (A or G or T)");
+ nucleotideName.put("d", "Not C (A or G or T)");
+ nucleotideName.put("V", "Not T (A or G or C");
+ nucleotideName.put("v", "Not T (A or G or C");
+
+ }
+
+ static
+ {
+ purinepyrimidineIndex = new int[255];
+ for (int i = 0; i < 255; i++)
+ {
+ purinepyrimidineIndex[i] = 3; // non-nucleotide symbols are all non-gap
+ // gaps.
+ }
+
+ purinepyrimidineIndex['A'] = 0;
+ purinepyrimidineIndex['a'] = 0;
+ purinepyrimidineIndex['C'] = 1;
+ purinepyrimidineIndex['c'] = 1;
+ purinepyrimidineIndex['G'] = 0;
+ purinepyrimidineIndex['g'] = 0;
+ purinepyrimidineIndex['T'] = 1;
+ purinepyrimidineIndex['t'] = 1;
+ purinepyrimidineIndex['U'] = 1;
+ purinepyrimidineIndex['u'] = 1;
+ purinepyrimidineIndex['I'] = 2;
+ purinepyrimidineIndex['i'] = 2;
+ purinepyrimidineIndex['X'] = 2;
+ purinepyrimidineIndex['x'] = 2;
+ purinepyrimidineIndex['R'] = 0;
+ purinepyrimidineIndex['r'] = 0;
+ purinepyrimidineIndex['Y'] = 1;
+ purinepyrimidineIndex['y'] = 1;
+ purinepyrimidineIndex['N'] = 2;
+ purinepyrimidineIndex['n'] = 2;
}
static
new Color(235, 65, 60), // G
new Color(60, 136, 238), // T
new Color(60, 136, 238), // U
- Color.white, // I
- Color.white, // X
+ Color.white, // I (inosine)
+ Color.white, // X (xanthine)
Color.white, // R
Color.white, // Y
Color.white, // N
Color.white, // Gap
};
+ // Added for PurinePyrimidineColourScheme
+ public static final Color[] purinepyrimidine =
+ { new Color(255, 131, 250), // A, G, R purines purplish/orchid
+ new Color(64, 224, 208), // C,U, T, Y pyrimidines turquoise
+ Color.white, // all other nucleotides
+ Color.white // Gap
+ };
+
// Zappo
public static final Color[] zappo =
{ Color.pink, // A
return ss.toString();
}
+ /**
+ * Used by getRNASecStrucState
+ *
+ */
+ public static Hashtable toRNAssState;
+ static
+ {
+ toRNAssState = new Hashtable();
+ toRNAssState.put(")", "S");
+ toRNAssState.put("(", "S");
+ }
+
+ /**
+ * translate to RNA secondary structure representation
+ *
+ * @param ssstring
+ * @return ssstring as a RNA-state secondary structure assignment.
+ */
+ public static String getRNASecStrucState(String ssstring)
+ {
+ if (ssstring == null)
+ {
+ return null;
+ }
+ StringBuffer ss = new StringBuffer();
+ for (int i = 0; i < ssstring.length(); i++)
+ {
+ String ssc = ssstring.substring(i, i + 1);
+ if (toRNAssState.containsKey(ssc))
+ {
+ ss.append((String) toRNAssState.get(ssc));
+ }
+ else
+ {
+ ss.append(" ");
+ }
+ }
+ return ss.toString();
+ }
+
// main method generates perl representation of residue property hash
// / cut here
public static void main(String[] args)
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * author: Lauren Michelle Lui
+ */
+
+package jalview.util;
+
+import java.awt.Color;
+import java.util.Random;
+
+public class ColorUtils
+{
+
+ /**
+ * Generates a random color, will mix with input color. Code taken from
+ * http://stackoverflow
+ * .com/questions/43044/algorithm-to-randomly-generate-an-aesthetically
+ * -pleasing-color-palette
+ *
+ * @param mix
+ * @return Random color in RGB
+ */
+ public static final Color generateRandomColor(Color mix)
+ {
+ Random random = new Random();
+ int red = random.nextInt(256);
+ int green = random.nextInt(256);
+ int blue = random.nextInt(256);
+
+ // mix the color
+ if (mix != null)
+ {
+ red = (red + mix.getRed()) / 2;
+ green = (green + mix.getGreen()) / 2;
+ blue = (blue + mix.getBlue()) / 2;
+ }
+
+ Color color = new Color(red, green, blue);
+ return color;
+
+ }
+
+}
// alignment is\r
// 'default' for\r
// PFAM\r
+ addDBRefSourceImpl(jalview.ws.dbsources.RfamFull.class);\r
+ addDBRefSourceImpl(jalview.ws.dbsources.RfamSeed.class);\r
registerDasSequenceSources();\r
}\r
\r
* @author JimP\r
* \r
*/\r
-abstract public class Pfam extends DbSourceProxyImpl implements\r
+abstract public class Pfam extends Xfam implements\r
DbSourceProxy\r
{\r
\r
* \r
* @see jalview.ws.DbSourceProxy#getDbVersion()\r
*/\r
- public String getDbVersion()\r
+ @Override\r
+public String getDbVersion()\r
{\r
// TODO Auto-generated method stub\r
return null;\r
}\r
\r
- /**\r
+ /**Returns base URL for selected Pfam alignment type\r
* \r
* @return PFAM URL stub for this DbSource\r
*/\r
- protected abstract String getPFAMURL();\r
+ @Override\r
+protected abstract String getXFAMURL();\r
\r
/*\r
* (non-Javadoc)\r
/*\r
* public String getDbName() { return "PFAM"; // getDbSource(); }\r
*/\r
+ \r
+ \r
+ public String getXfamSource() { return jalview.datamodel.DBRefSource.PFAM; }\r
+ \r
+ \r
}\r
* \r
* @see jalview.ws.dbsources.Pfam#getPFAMURL()\r
*/\r
- protected String getPFAMURL()\r
+ protected String getXFAMURL()\r
{\r
return "http://pfam.sanger.ac.uk/family/alignment/download/format?alnType=full&format=stockholm&order=t&case=l&gaps=default&entry=";\r
}\r
return "PF03760";\r
}\r
\r
+public String getDbVersion() {\r
+ return null;\r
+}\r
+\r
}\r
* \r
* @see jalview.ws.dbsources.Pfam#getPFAMURL()\r
*/\r
- protected String getPFAMURL()\r
+ protected String getXFAMURL()\r
{\r
return "http://pfam.sanger.ac.uk/family/alignment/download/format?alnType=seed&format=stockholm&order=t&case=l&gaps=default&entry=";\r
}\r