boolean mouseDragging = false;
boolean MAC = false;
+
+ //for editing cursor
+ int cursorX = 0;
+ int cursorY = 0;
/**
* Creates a new AnnotationPanel object.
}
JPopupMenu pop = new JPopupMenu("Structure type");
- JMenuItem item = new JMenuItem(HELIX);
- item.addActionListener(this);
- pop.add(item);
- item = new JMenuItem(SHEET);
- item.addActionListener(this);
- pop.add(item);
- item = new JMenuItem(STEM);
- item.addActionListener(this);
- pop.add(item);
+ JMenuItem item;
+ /*
+ * Just display the needed structure options
+ */
+ if(av.alignment.isNucleotide()==true){
+ item = new JMenuItem(STEM);
+ item.addActionListener(this);
+ pop.add(item);
+ }else{
+ item = new JMenuItem(HELIX);
+ item.addActionListener(this);
+ pop.add(item);
+ item = new JMenuItem(SHEET);
+ item.addActionListener(this);
+ pop.add(item);
+ }
item = new JMenuItem(LABEL);
item.addActionListener(this);
pop.add(item);
*/
public void mouseClicked(MouseEvent evt)
{
+ if(activeRow !=-1){
+ AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation anot = aa[activeRow];
+
+ if(anot.description.equals("secondary structure")){
+ System.out.println(anot.description+" "+anot.getRNAStruc());
+ }
+ }
}
+
+ public void drawCursor(Graphics graphics, SequenceI seq, int res, int x1, int y1)
+ {
+ int pady = av.charHeight / 5;
+ int charOffset = 0;
+ graphics.setColor(Color.black);
+ graphics.fillRect(x1, y1, av.charWidth, av.charHeight);
+
+ if (av.validCharWidth)
+ {
+ graphics.setColor(Color.white);
+
+ char s = seq.getCharAt(res);
+
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s), charOffset + x1,
+ (y1 + av.charHeight) - pady);
+ }
+
+ }
/**
* DOCUMENT ME!
package jalview.gui;
import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.awt.*;
import javax.swing.*;
initVarna();
}*/
+
+
public AppVarna(String seq,String struc,String name,AlignmentPanel ap){
ArrayList<RNA> rnaList = new ArrayList<RNA>();
RNA rna1 = new RNA(name);
try {
- rna1.setRNA(seq,struc);
+ rna1.setRNA(seq,replaceOddGaps(struc));
} catch (ExceptionUnmatchedClosingParentheses e2) {
e2.printStackTrace();
} catch (ExceptionFileFormatOrSyntax e3) {
showPanel(true);
}
+ public String replaceOddGaps(String oldStr){
+ String patternStr = "[^([{<>}])]";
+ String replacementStr = ".";
+ Pattern pattern = Pattern.compile(patternStr);
+ Matcher matcher = pattern.matcher(oldStr);
+ String newStr=matcher.replaceAll(replacementStr);
+ return newStr;
+ }
+
public RNA trimRNA(RNA rna){
RNA rnaTrim = new RNA("trim_"+rna.getName());
try {
- rnaTrim.setRNA(rna.getSeq(),rna.getStructDBN());
+ rnaTrim.setRNA(rna.getSeq(),replaceOddGaps(rna.getStructDBN()));
} catch (ExceptionUnmatchedClosingParentheses e2) {
e2.printStackTrace();
} catch (ExceptionFileFormatOrSyntax e3) {