VARNAPanel varnaPanel;
- String name;
+ public String name;
/*public AppVarna(){
vab = new AppVarnaBinding();
RNA rna1 = new RNA(name);
try {
rna1.setRNA(seq,struc);
- } catch (ExceptionUnmatchedClosingParentheses e2) {
+ } catch (ExceptionUnmatchedClosingParentheses e2) {
e2.printStackTrace();
} catch (ExceptionFileFormatOrSyntax e3) {
e3.printStackTrace();
}
rnaList.add(rna1);
+ rnaList.add(trimRNA(rna1));
vab = new AppVarnaBinding(rnaList);
//vab = new AppVarnaBinding(seq,struc);
- name=this.name;
+ //System.out.println("Hallo: "+name);
+ this.name=name;
initVarna();
}
public void initVarna(){
- //TODO: Why is it not possible to include varnaPanel in the AppVarna-Jframe?
//vab.setFinishedInit(false);
varnaPanel=vab.get_varnaPanel();
setBackground(Color.white);
+ JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,vab.getListPanel(),varnaPanel);
getContentPane().setLayout(new BorderLayout());
- getContentPane().add(varnaPanel, BorderLayout.CENTER);
-
+ getContentPane().add(split, BorderLayout.CENTER);
+ //getContentPane().add(vab.getTools(), BorderLayout.NORTH);
varnaPanel.addVARNAListener(this);
- jalview.gui.Desktop.addInternalFrame(this,name,getBounds().width, getBounds().height);
+ jalview.gui.Desktop.addInternalFrame(this,"VARNA -"+name,getBounds().width, getBounds().height);
this.pack();
- this.setVisible(true);
- //showPanel(true);
+ showPanel(true);
}
+ public RNA trimRNA(RNA rna){
+ RNA rnaTrim = new RNA(rna.getName()+"_trim");
+ String seq=rna.getSeq();
+ String struc=rna.getStructDBN();
+ String newSeq="";
+ String newStruc="";
+ for(int i=0;i<seq.length();i++){
+ if(seq.substring(i, i+1).compareTo("-")!=0){
+ newSeq=newSeq+seq.substring(i, i+1);
+ newStruc=newStruc+struc.substring(i,i+1);
+ }
+ }
+ try {
+ rnaTrim.setRNA(newSeq,newStruc);
+ } catch (ExceptionUnmatchedClosingParentheses e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ExceptionFileFormatOrSyntax e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ //System.out.println(newSeq+"\t"+newStruc);
+ return rnaTrim;
+ }
+
public void showPanel(boolean show){
- varnaPanel.setVisible(show);
+ this.setVisible(show);
}
private boolean _started = false;
*/
//private static final long serialVersionUID = -790155708306987257L;
- //private String DEFAULT_SEQUENCE = "CAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIA";
- //private String DEFAULT_STRUCTURE1 = "..(((((...(((((...(((((...(((((.....)))))...))))).....(((((...(((((.....)))))...))))).....)))))...)))))..";
- //private String DEFAULT_STRUCTURE2 = "..(((((...(((((...(((((........(((((...(((((.....)))))...)))))..................))))).....)))))...)))))..";
+ private String DEFAULT_SEQUENCE = "CAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIA";
+ private String DEFAULT_STRUCTURE1 = "..(((((...(((((...(((((...(((((.....)))))...))))).....(((((...(((((.....)))))...))))).....)))))...)))))..";
+ private String DEFAULT_STRUCTURE2 = "..(((((...(((((...(((((........(((((...(((((.....)))))...)))))..................))))).....)))))...)))))..";
public VARNAPanel vp;
- private JPanel _tools = new JPanel();
+ protected JPanel _tools = new JPanel();
private JPanel _input = new JPanel();
private JPanel _seqPanel = new JPanel();
private JButton _deleteButton = new JButton("Delete");
private JButton _duplicateButton = new JButton("Snapshot");
- private JPanel _listPanel = new JPanel();
+ protected JPanel _listPanel = new JPanel();
private ReorderableJList _sideList = null;
initVarna(seq,struc);
}
- public AppVarnaBinding(ArrayList<RNA> rnalist){
+ public AppVarnaBinding(ArrayList<RNA> rnaList){
//super("VARNA in Jalview");
- initVarnaEdit(rnalist);
+ initVarnaEdit(rnaList);
}
DefaultListModel dlm = new DefaultListModel();
- int marginTools = 40;
+ //int marginTools = 40;
DefaultListSelectionModel m = new DefaultListSelectionModel();
m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
FullBackup sel = (FullBackup) _sideList.getSelectedValue();
Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA().getSize(), sel.rna.getSize());
vp.showRNAInterpolated(sel.rna,sel.config,map);
- _seq.setText(sel.rna.getSeq());
- _str.setText(sel.rna.getStructDBN());
+ //_seq.setText(sel.rna.getSeq());
+ //_str.setText(sel.rna.getStructDBN());
}
}
});
-
+
_rnaList = new BackupHolder(dlm,_sideList);
+
try {
vp = new VARNAPanel("0",".");
for(int i=0;i<rnaInList.size();i++){
}
vp.setPreferredSize(new Dimension(400, 400));
for(int i=0;i<rnaInList.size();i++){
- _rnaList.add(vp.getConfig().clone(),rnaInList.get(i),generateDefaultName(),true);
+ if(i<rnaInList.size()-1){
+ _rnaList.add(vp.getConfig().clone(),rnaInList.get(i),generateDefaultName());
+ }else{
+ _rnaList.add(vp.getConfig().clone(),rnaInList.get(i),generateDefaultName(),true);
+ }
}
+
/*_rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
_rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);*/
JScrollPane listScroller = new JScrollPane(_sideList);
listScroller.setPreferredSize(new Dimension(150, 0));
- //TODO setBackground(_backgroundColor);
vp.setBackground(_backgroundColor);
-
-
+
+ /*
Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
_seqLabel.setHorizontalTextPosition(JLabel.LEFT);
}
}
});
-
-
+
_seqPanel.setLayout(new BorderLayout());
_seqPanel.add(_seqLabel, BorderLayout.WEST);
_seqPanel.add(_seq, BorderLayout.CENTER);
public void actionPerformed(ActionEvent e) {
_rnaList.add((VARNAConfig)vp.getConfig().clone(),vp.getRNA().clone(),vp.getRNA().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new Date()),true);
}});
-
+ goPanel.add(_createButton, BorderLayout.CENTER);
+ */
JPanel ops = new JPanel();
ops.setLayout(new GridLayout(1,2));
ops.add(_deleteButton);
_listPanel.add(j,BorderLayout.NORTH);
_listPanel.add(listScroller,BorderLayout.CENTER);
- goPanel.add(_createButton, BorderLayout.CENTER);
-
- JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
+
+
+ //JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
/**TODO
getContentPane().setLayout(new BorderLayout());
getContentPane().add(split, BorderLayout.CENTER);
vp.addVARNAListener(this);
}
+
+ public JPanel getTools(){
+ return _tools;
+ }
+
+ public JPanel getListPanel(){
+ return _listPanel;
+ }
-
- /*private void RNAPanelDemoInit()
+ /*
+ private void RNAPanelDemoInit()
{
DefaultListModel dlm = new DefaultListModel();
DropTarget dt = new DropTarget(vp, this);
vp.addVARNAListener(this);
- }*/
-
+ }
+ */
public static String generateDefaultName()
{
return "User file #"+_nextID++;