2 VARNA is a tool for the automated drawing, visualization and annotation of the secondary structure of RNA, designed as a companion software for web servers and databases.
3 Copyright (C) 2008 Kevin Darty, Alain Denise and Yann Ponty.
4 electronic mail : Yann.Ponty@lri.fr
5 paper mail : LRI, bat 490 Université Paris-Sud 91405 Orsay Cedex France
7 This file is part of VARNA version 3.1.
8 VARNA version 3.1 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 VARNA version 3.1 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along with VARNA version 3.1.
16 If not, see http://www.gnu.org/licenses.
18 package fr.orsay.lri.varna.applications;
20 import java.awt.BorderLayout;
21 import java.awt.Color;
22 import java.awt.Dimension;
24 import java.awt.GridLayout;
25 import java.awt.event.ActionEvent;
26 import java.awt.event.ActionListener;
27 import java.awt.event.ItemEvent;
28 import java.awt.event.ItemListener;
29 import java.awt.event.MouseEvent;
30 import java.math.BigInteger;
31 import java.util.ArrayList;
32 import java.util.Collections;
34 import javax.swing.BorderFactory;
35 import javax.swing.DefaultComboBoxModel;
36 import javax.swing.JButton;
37 import javax.swing.JComboBox;
38 import javax.swing.JFrame;
39 import javax.swing.JLabel;
40 import javax.swing.JOptionPane;
41 import javax.swing.JPanel;
42 import javax.swing.JSplitPane;
43 import javax.swing.JTextArea;
44 import javax.swing.JTextField;
45 import javax.swing.JTextPane;
46 import javax.swing.border.BevelBorder;
48 import fr.orsay.lri.varna.VARNAPanel;
49 import fr.orsay.lri.varna.controlers.ControleurInterpolator;
50 import fr.orsay.lri.varna.exceptions.ExceptionDrawingAlgorithm;
51 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
52 import fr.orsay.lri.varna.exceptions.ExceptionModeleStyleBaseSyntaxError;
53 import fr.orsay.lri.varna.exceptions.ExceptionNAViewAlgorithm;
54 import fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength;
55 import fr.orsay.lri.varna.exceptions.ExceptionParameterError;
56 import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
57 import fr.orsay.lri.varna.exceptions.MappingException;
58 import fr.orsay.lri.varna.models.VARNAConfig;
59 import fr.orsay.lri.varna.models.VARNAConfig.BP_STYLE;
60 import fr.orsay.lri.varna.models.rna.Mapping;
61 import fr.orsay.lri.varna.models.rna.ModeleBP;
62 import fr.orsay.lri.varna.models.rna.ModeleBase;
63 import fr.orsay.lri.varna.models.rna.ModelBaseStyle;
64 import fr.orsay.lri.varna.models.rna.RNA;
65 import fr.orsay.lri.varna.interfaces.InterfaceVARNABasesListener;
66 import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener;;
68 public class NussinovDesignDemo extends JFrame implements InterfaceVARNAListener,InterfaceVARNABasesListener, ItemListener {
73 private static final long serialVersionUID = -790155708306987257L;
75 private static final String SEQUENCE_A = "AGGCACGUCU";
76 private static final String SEQUENCE_B = "GAGUAGCCUC";
77 private static final String SEQUENCE_C = "GCAUAGCUGC";
78 private static final String SEQUENCE_INRIA = "CGAUUGCAUCGCAAGU";
80 private static final String TARGET_STRUCTURE_1 = "(((((((..)))))))";
81 private static final String TARGET_STRUCTURE_2 = "(((())))(((())))";
82 private static final String TARGET_STRUCTURE_3 = "(.((.((..).)).))";
83 private static final String TARGET_STRUCTURE_4 = "((((((())))(((())(()))))))";
84 private static final String TARGET_STRUCTURE_5 = "(((())))(((())))(((())))(((())))(((())))(((())))";
86 private static final String SEQUENCE_BIG = "AAAACAAAAACACCAUGGUGUUUUCACCCAAUUGGGUGAAAACAGAGAUCUCGAGAUCUCUGUUUUUGUUUU";
88 private static final String DEFAULT_STRUCTURE = "..........";
89 // private static final String DEFAULT_STRUCTURE1 = "((((....))))";
90 // private static final String DEFAULT_STRUCTURE2 =
91 // "((((..(((....)))..))))";
93 private VARNAPanel _vpMaster;
94 private VARNAPanel _vpTarget;
96 private InfoPanel _infos = new InfoPanel();
97 private JPanel _tools = new JPanel();
98 private JPanel _input = new JPanel();
100 private JPanel _seqPanel = new JPanel();
101 private JPanel _structPanel = new JPanel();
102 private JLabel _actions = new JLabel();
103 private JComboBox _struct = new JComboBox();
104 private JLabel _seq1 = new JLabel();
105 private JLabel _structLabel = new JLabel("Structure Cible");
106 private JLabel _seqLabel = new JLabel("Sequence d'ARN");
107 private JButton _switchButton = new JButton("Reset");
110 private Color _backgroundColor = Color.white;
112 private Color _okColor = Color.decode("#E33729");
113 private Color _koColor = new Color(250,200,200);
116 public static ModelBaseStyle createStyle(String txt)
118 ModelBaseStyle result = new ModelBaseStyle();
120 result.assignParameters(txt);
121 } catch (ExceptionModeleStyleBaseSyntaxError e) {
122 // TODO Auto-generated catch block
124 } catch (ExceptionParameterError e) {
125 // TODO Auto-generated catch block
131 public void applyTo(VARNAPanel vp, ModelBaseStyle mb, int[] indices)
133 for(int i=0;i<indices.length;i++)
135 ModeleBase m = vp.getRNA().getBaseAt(indices[i]);
137 if (m.getElementStructure()!=-1)
139 vp.getRNA().getBaseAt(m.getElementStructure()).setStyleBase(mb);
146 public NussinovDesignDemo() {
149 _vpMaster = new VARNAPanel(getSeq(), "");
150 _vpTarget = new VARNAPanel();
151 } catch (ExceptionNonEqualLength e) {
152 _vpMaster.errorDialog(e);
154 _vpMaster.setPreferredSize(new Dimension(600, 600));
155 _vpTarget.setPreferredSize(new Dimension(600, 600));
159 static Font labelsFont = Font.decode("Dialog-BOLD-25");
161 private void RNAPanelDemoInit() {
162 int marginTools = 250;
163 Font textFieldsFont = Font.decode("MonoSpaced-BOLD-16");
167 _seq1.setFont(textFieldsFont.deriveFont(25f));
170 setBackground(_backgroundColor);
173 _structLabel.setFont(labelsFont.deriveFont(Font.PLAIN));
176 String[] secstr = {TARGET_STRUCTURE_1,TARGET_STRUCTURE_2,TARGET_STRUCTURE_3,TARGET_STRUCTURE_4,TARGET_STRUCTURE_5};
177 DefaultComboBoxModel cm = new DefaultComboBoxModel(secstr);
178 _struct.setModel(cm);
179 _struct.addActionListener(new ActionListener() {
180 public void actionPerformed(ActionEvent e) {
181 System.out.println(e.getActionCommand());
182 setTarget(((JComboBox)e.getSource()).getSelectedItem().toString());
185 _struct.setFont(textFieldsFont);
186 _struct.setEnabled(true);
187 _struct.setEditable(true);
190 _switchButton.addActionListener(new ActionListener() {
191 public void actionPerformed(ActionEvent e) {
192 setTarget(_struct.getSelectedItem().toString());
196 _seqPanel.setLayout(new BorderLayout());
197 _seqPanel.add(_seqLabel, BorderLayout.WEST);
198 _seqPanel.add(_seq1, BorderLayout.CENTER);
200 _seqPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
202 _structLabel.setPreferredSize(new Dimension(marginTools, 15));
203 _structLabel.setHorizontalTextPosition(JLabel.LEFT);
204 _structPanel.setLayout(new BorderLayout());
205 _structPanel.add(_structLabel, BorderLayout.WEST);
206 _structPanel.add(_struct, BorderLayout.CENTER);
208 _input.setLayout(new GridLayout(0, 1));
209 _input.add(_structPanel);
211 JPanel goPanel = new JPanel();
212 goPanel.setLayout(new BorderLayout());
214 _infos.setFont(labelsFont);
217 formatLabel(_seqLabel);
221 _tools.setLayout(new BorderLayout());
222 //_tools.add(_infos, BorderLayout.NORTH);
223 _tools.add(_input, BorderLayout.CENTER);
224 _tools.add(_actions, BorderLayout.SOUTH);
225 _tools.add(goPanel, BorderLayout.EAST);
227 _tools.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
229 //goPanel.add(_goButton, BorderLayout.CENTER);
230 goPanel.add(_switchButton, BorderLayout.CENTER);
232 getContentPane().setLayout(new BorderLayout());
233 JSplitPane VARNAs = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
234 VARNAs.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
235 //VARNAs.setLayout(new GridLayout(1,2));
236 JPanel mast2 = new JPanel();
237 mast2.setLayout(new BorderLayout());
238 mast2.add(_seqPanel, BorderLayout.NORTH);
239 mast2.add(_infos, BorderLayout.SOUTH);
241 JPanel mast = new JPanel();
242 mast.setLayout(new BorderLayout());
243 mast.add(_vpMaster, BorderLayout.CENTER);
244 mast.add(mast2,BorderLayout.SOUTH);
247 VARNAs.add(_vpTarget);
249 VARNAs.setDividerSize(5);
251 getContentPane().add(VARNAs, BorderLayout.CENTER);
252 getContentPane().add(_tools, BorderLayout.NORTH);
257 _vpMaster.setBackground(_backgroundColor);
258 _vpMaster.addVARNAListener(this);
259 _vpMaster.setTitle("Meilleur repliement - Séquence courante");
260 _vpMaster.setBPStyle(BP_STYLE.SIMPLE);
261 _vpMaster.getVARNAUI().UIRadiate();
262 _vpMaster.setTitleFontSize(26f);
263 _vpMaster.setTitleFontStyle(Font.PLAIN);
265 _vpTarget.setBackground(Color.decode("#308099"));
266 _vpTarget.setModifiable(false);
267 _vpTarget.setTitle("Repliement cible");
268 _vpTarget.setBPStyle(BP_STYLE.SIMPLE);
269 _vpTarget.setBackboneColor(Color.white);
270 _vpTarget.setDefaultBPColor(Color.white);
271 _vpTarget.setBaseNumbersColor(Color.white);
272 _vpTarget.setBaseOutlineColor(Color.white);
273 _vpTarget.setTitleColor(Color.white);
274 _vpTarget.setTitleFontSize(26f);
277 _okColor = Color.decode("#F39126");
278 _koColor = new Color(250,200,200);
280 _seqPanel.setBackground(Color.decode("#E33729"));
281 _infos.setBackground(Color.decode("#E33729"));
285 _vpMaster.addVARNABasesListener(this);
286 setTitle("Fête de la science 2015 - Inria AMIB - Design d'ARN");
288 setTarget(secstr[0]);
292 private synchronized void showSolution()
294 ArrayList<String> sols = getStructs();
295 _infos.setInfo(sols, count(getSeq()));
296 if ((sols.size()==1)&&(sols.get(0).equals(_struct.getSelectedItem().toString())))
298 /*JOptionPane.showMessageDialog(null,
299 "Vous avez trouvé une séquence pour cette structure !!!\n Saurez vous faire le design de molécules plus complexes ?",
301 JOptionPane.INFORMATION_MESSAGE);*/
306 this._vpMaster.setTitle("Meilleur repliement - Séquence courante");
311 public void setTarget(String target)
314 _vpTarget.drawRNA(String.format("%"+target.length()+"s", ""),target);
315 _vpTarget.setBaseNumbersColor(Color.white);
316 _vpTarget.setBaseOutlineColor(Color.white);
317 //_vpTarget.toggleDrawOutlineBases();
320 onStructureRedrawn();
321 } catch (ExceptionNonEqualLength e) {
322 // TODO Auto-generated catch block
327 private void createDummySeq()
329 RNA r = _vpTarget.getRNA();
330 String seq = new String();
331 for (int i=0;i<r.getSize();i++)
337 rn.setRNA(seq,r.getStructDBN());
338 for(ModeleBP mbp: r.getAllBPs())
340 rn.getBaseAt(mbp.getIndex5()).setContent("A");
341 rn.getBaseAt(mbp.getIndex3()).setContent("U");
343 _vpMaster.drawRNA(rn);
345 _seq1.setText(_vpMaster.getRNA().getSeq());
346 } catch (ExceptionUnmatchedClosingParentheses e) {
347 // TODO Auto-generated catch block
349 } catch (ExceptionFileFormatOrSyntax e) {
350 // TODO Auto-generated catch block
356 public String getSeq()
358 return (""+_seq1.getText()).toUpperCase();
362 private boolean canBasePairAll(char a, char b)
367 private boolean canBasePairBasic(char a, char b)
369 if ((a=='G')&&(b=='C'))
371 if ((a=='C')&&(b=='G'))
373 if ((a=='U')&&(b=='A'))
375 if ((a=='A')&&(b=='U'))
380 private double basePairScoreBasic(char a, char b)
382 if ((a=='G')&&(b=='C'))
384 if ((a=='C')&&(b=='G'))
386 if ((a=='U')&&(b=='A'))
388 if ((a=='A')&&(b=='U'))
390 return Double.NEGATIVE_INFINITY;
394 private boolean canBasePairNussinov(char a, char b)
396 if ((a=='G')&&(b=='C'))
398 if ((a=='C')&&(b=='G'))
400 if ((a=='U')&&(b=='A'))
402 if ((a=='A')&&(b=='U'))
404 if ((a=='U')&&(b=='G'))
406 if ((a=='G')&&(b=='U'))
411 private double basePairScoreNussinov(char a, char b)
413 if ((a=='G')&&(b=='C'))
415 if ((a=='C')&&(b=='G'))
417 if ((a=='U')&&(b=='A'))
419 if ((a=='A')&&(b=='U'))
421 if ((a=='U')&&(b=='G'))
423 if ((a=='G')&&(b=='U'))
425 return Double.NEGATIVE_INFINITY;
428 private boolean canBasePairINRIA(char a, char b)
430 if ((a=='U')&&(b=='A'))
432 if ((a=='A')&&(b=='U'))
434 if ((a=='G')&&(b=='C'))
436 if ((a=='C')&&(b=='G'))
439 if ((a=='A')&&(b=='G'))
441 if ((a=='G')&&(b=='A'))
443 if ((a=='U')&&(b=='C'))
445 if ((a=='C')&&(b=='U'))
447 if ((a=='A')&&(b=='A'))
449 if ((a=='U')&&(b=='U'))
452 if ((a=='U')&&(b=='G'))
454 if ((a=='G')&&(b=='U'))
456 if ((a=='A')&&(b=='C'))
458 if ((a=='C')&&(b=='A'))
463 private double basePairScoreINRIA(char a, char b)
465 if ((a=='U')&&(b=='A'))
467 if ((a=='A')&&(b=='U'))
469 if ((a=='G')&&(b=='C'))
471 if ((a=='C')&&(b=='G'))
474 if ((a=='A')&&(b=='G'))
476 if ((a=='G')&&(b=='A'))
478 if ((a=='U')&&(b=='C'))
480 if ((a=='C')&&(b=='U'))
482 if ((a=='A')&&(b=='A'))
484 if ((a=='U')&&(b=='U'))
487 if ((a=='U')&&(b=='G'))
489 if ((a=='G')&&(b=='U'))
491 if ((a=='A')&&(b=='C'))
493 if ((a=='C')&&(b=='A'))
495 return Double.NEGATIVE_INFINITY;
498 private boolean canBasePair(char a, char b)
500 return canBasePairBasic(a,b);
501 //return canBasePairNussinov(a,b);
502 //return canBasePairINRIA(a,b);
505 private double basePairScore(char a, char b)
507 return basePairScoreBasic(a,b);
508 //return basePairScoreNussinov(a,b);
509 //return basePairScoreINRIA(a,b);
512 public double[][] fillMatrix(String seq)
514 int n = seq.length();
515 double[][] tab = new double[n][n];
516 for(int m=1;m<=n;m++)
518 for(int i=0;i<n-m+1;i++)
524 tab[i][j] = Math.max(tab[i][j], tab[i+1][j]);
525 for (int k=i+1;k<=j;k++)
527 if (canBasePair(seq.charAt(i),seq.charAt(k)))
532 fact1 = tab[i+1][k-1];
539 tab[i][j] = Math.max(tab[i][j],basePairScore(seq.charAt(i),seq.charAt(k))+fact1+fact2);
548 public static ArrayList<Double> combine(double bonus, ArrayList<Double> part1, ArrayList<Double> part2)
550 ArrayList<Double> base = new ArrayList<Double>();
551 for(double d1: part1)
553 for(double d2: part2)
555 base.add(bonus+d1+d2);
561 public static ArrayList<Double> selectBests(ArrayList<Double> base)
563 ArrayList<Double> result = new ArrayList<Double>();
564 double best = Double.NEGATIVE_INFINITY;
565 for(double val: base)
567 best = Math.max(val, best);
569 for(double val: base)
578 private ArrayList<String> backtrack(double[][] tab, String seq)
580 return backtrack(tab,seq, 0, seq.length()-1);
583 private ArrayList<String> backtrack(double[][] tab, String seq, int i, int j)
585 ArrayList<String> result = new ArrayList<String>();
588 ArrayList<Integer> indices = new ArrayList<Integer>();
590 for (int k=i+1;k<=j;k++)
594 for (int k : indices)
598 if (tab[i][j] == tab[i+1][j])
600 for (String s:backtrack(tab, seq, i+1,j))
608 if (canBasePair(seq.charAt(i),seq.charAt(k)))
613 fact1 = tab[i+1][k-1];
620 if (tab[i][j]==basePairScore(seq.charAt(i),seq.charAt(k))+fact1+fact2)
622 for (String s1:backtrack(tab, seq, i+1,k-1))
624 for (String s2:backtrack(tab, seq, k+1,j))
626 result.add("("+s1+")"+s2);
645 public BigInteger count(String seq)
647 int n = seq.length();
649 BigInteger[][] tab = new BigInteger[n][n];
650 for(int m=1;m<=n;m++)
652 for(int i=0;i<n-m+1;i++)
655 tab[i][j] = BigInteger.ZERO;
658 tab[i][j] = tab[i][j].add(tab[i+1][j]);
659 for (int k=i+1;k<=j;k++)
661 if (canBasePair(seq.charAt(i),seq.charAt(k)))
663 BigInteger fact1 = BigInteger.ONE;
666 fact1 = tab[i+1][k-1];
668 BigInteger fact2 = BigInteger.ONE;
673 tab[i][j] = tab[i][j].add(fact1.multiply(fact2));
679 tab[i][j] = BigInteger.ONE;
686 private String _cache = "";
687 ArrayList<String> _cacheStructs = new ArrayList<String>();
689 public ArrayList<String> getStructs() {
690 String seq = getSeq();
691 seq = seq.toUpperCase();
692 if (!_cache.equals(seq))
694 double[][] mfe = fillMatrix(seq);
695 _cacheStructs = backtrack(mfe,seq);
698 return _cacheStructs;
701 public VARNAPanel get_varnaPanel() {
705 public void set_varnaPanel(VARNAPanel surface) {
710 public JLabel get_info() {
714 public void set_info(JLabel _info) {
715 this._actions = _info;
718 public static void main(String[] args) {
719 NussinovDesignDemo d = new NussinovDesignDemo();
720 d.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
725 public void onStructureRedrawn() {
729 public void onWarningEmitted(String s) {
730 // TODO Auto-generated method stub
734 public void onLoad(String path) {
735 // TODO Auto-generated method stub
739 public void onLoaded() {
740 // TODO Auto-generated method stub
744 public void onUINewStructure(VARNAConfig v, RNA r) {
745 // TODO Auto-generated method stub
749 static final String[] _bases = {"A","C","G","U"};
750 static final String[] _basesComp = {"U","G","C","A"};
752 public void onBaseClicked(ModeleBase mb, MouseEvent e) {
754 for(int i =0;i<_bases.length;i++)
756 if (mb.getContent().equalsIgnoreCase(_bases[i]))
761 index = (index+1)%_bases.length;
762 mb.setContent(_bases[index].toUpperCase());
763 ArrayList<ModeleBase> partners =_vpTarget.getRNA().getAllPartners(mb.getIndex());
764 if (partners.size()!=0)
766 ModeleBase mbPartner = _vpMaster.getRNA().getBaseAt(partners.get(0).getIndex());
767 mbPartner.setContent(_basesComp[index].toUpperCase());
770 _seq1.setText(_vpMaster.getRNA().getSeq());
771 new Temporizer(_vpMaster.getRNA().getSeq()).start();
774 private class Temporizer extends Thread{
776 public Temporizer(String seq)
783 if (_vpMaster.getRNA().getSeq().equalsIgnoreCase(_seq))
787 } catch (InterruptedException e) {
788 // TODO Auto-generated catch block
793 public void onZoomLevelChanged() {
794 // TODO Auto-generated method stub
798 public void onTranslationChanged() {
799 // TODO Auto-generated method stub
803 public void itemStateChanged(ItemEvent arg0) {
804 // TODO Auto-generated method stub
805 System.out.println();
809 public static void formatLabel(JLabel j)
811 j.setHorizontalTextPosition(JLabel.LEFT);
812 j.setPreferredSize(new Dimension(NussinovDemo.marginTools, 25));
813 j.setFont(labelsFont);
814 j.setForeground(Color.white);
817 public static void formatLabel(JTextArea j)
819 j.setPreferredSize(new Dimension(NussinovDemo.marginTools, 25));
820 j.setFont(labelsFont);
821 j.setForeground(Color.white);
824 public class InfoPanel extends JPanel
826 ArrayList<String> _sols = new ArrayList<String>();
827 BigInteger _nbFolds = BigInteger.ZERO;
828 JLabel _text = new JLabel("");
829 JLabel _subopts = new JLabel("");
830 JPanel _suboptBrowser = new JPanel();
831 JPanel _suboptCount = new JPanel();
832 int _selectedIndex = 0;
833 JButton next = new JButton(">");
834 JButton previous = new JButton("<");
838 this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
839 setLayout(new BorderLayout());
840 add(_suboptBrowser,BorderLayout.SOUTH);
841 add(_suboptCount,BorderLayout.NORTH);
843 next.addActionListener(new ActionListener(){
844 public void actionPerformed(ActionEvent arg0) {
847 setSelectedIndex((_selectedIndex+1)%_sols.size());
852 previous.addActionListener(new ActionListener(){
853 public void actionPerformed(ActionEvent arg0) {
856 setSelectedIndex((_selectedIndex+_sols.size()-1)%_sols.size());
860 next.setEnabled(false);
861 previous.setEnabled(false);
863 JLabel nbLab = new JLabel("#Repliements");
864 NussinovDesignDemo.formatLabel(nbLab);
867 JLabel cooptlab = new JLabel("#Co-optimaux");
868 NussinovDesignDemo.formatLabel(cooptlab);
870 NussinovDesignDemo.formatLabel(_text);
871 NussinovDesignDemo.formatLabel(_subopts);
874 _suboptCount.setLayout(new BorderLayout());
875 _suboptCount.add(nbLab,BorderLayout.WEST);
876 _suboptCount.add(_text,BorderLayout.CENTER);
877 _suboptCount.setBackground(Color.decode("#E33729"));
880 JPanel commands = new JPanel();
881 commands.add(previous);
883 commands.setBackground(Color.decode("#E33729"));
885 JPanel jp = new JPanel();
886 jp.setLayout(new BorderLayout());
887 jp.add(_subopts,BorderLayout.WEST);
888 jp.add(commands,BorderLayout.CENTER);
889 jp.setBackground(Color.decode("#E33729"));
891 _suboptBrowser.setLayout(new BorderLayout());
892 _suboptBrowser.add(cooptlab,BorderLayout.WEST);
893 _suboptBrowser.add(jp,BorderLayout.CENTER);
894 _suboptBrowser.setBackground(Color.decode("#E33729"));
899 /*public void setSelectedIndex(int i)
902 RNA rfolded = new RNA();
904 rfolded.setRNA(getSeq(), _sols.get(i));
905 rfolded.drawRNARadiate(_vpMaster.getConfig());
906 _vpMaster.showRNAInterpolated(rfolded);
907 } catch (ExceptionUnmatchedClosingParentheses e) {
908 // TODO Auto-generated catch block
910 } catch (ExceptionFileFormatOrSyntax e) {
911 // TODO Auto-generated catch block
914 //_struct.setText(_sols.get(i));
918 public void setSelectedIndex(int i)
921 RNA rfolded = new RNA();
923 rfolded.setRNA(getSeq(), _sols.get(i));
924 RNA target = _vpTarget.getRNA();
925 for(ModeleBase mb: rfolded.get_listeBases())
927 ModeleBase mbref = target.getBaseAt(mb.getIndex());
928 if (mb.getElementStructure()==mbref.getElementStructure())
930 mb.getStyleBase().setBaseInnerColor(_okColor);
931 mb.getStyleBase().setBaseNameColor(Color.white);
934 for(ModeleBase mb: target.get_listeBases())
936 ModeleBase mbref = rfolded.getBaseAt(mb.getIndex());
937 if (mb.getElementStructure()==mbref.getElementStructure())
939 mb.getStyleBase().setBaseInnerColor(_okColor);
943 mb.getStyleBase().setBaseInnerColor(Color.white);
946 rfolded.drawRNARadiate(_vpMaster.getConfig());
947 if ((_sols.size()==1)&& (target.getStructDBN().equals(_sols.get(0))))
948 rfolded.setName("Félicitations !");
950 rfolded.setName("Repliement stable - "+(i+1)+"/"+_sols.size());
951 _vpMaster.showRNAInterpolated(rfolded);
953 } catch (ExceptionUnmatchedClosingParentheses e) {
954 // TODO Auto-generated catch block
956 } catch (ExceptionFileFormatOrSyntax e) {
957 // TODO Auto-generated catch block
960 //_struct.setSelectedItem(_sols.get(i));
964 // public void setFont(Font f)
970 // _text.setOpaque(false);
972 // if(_subopts!=null)
974 // _subopts.setFont(f);
975 // _subopts.setOpaque(false);
978 public void setInfo(ArrayList<String> sols, BigInteger nbFolds)
986 private void formatDescription()
988 _text.setText(""+_nbFolds);
989 _subopts.setText(""+_sols.size());
990 next.setEnabled(_sols.size()>1);
991 previous.setEnabled(_sols.size()>1);