import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener;
import fr.orsay.lri.varna.models.VARNAConfig;
+import fr.orsay.lri.varna.models.rna.ModeleBaseNucleotide;
+import fr.orsay.lri.varna.models.rna.ModeleStyleBP;
import fr.orsay.lri.varna.models.rna.RNA;
} catch (ExceptionFileFormatOrSyntax e3) {
e3.printStackTrace();
}
+ rnaList.add(trimRNA(rna1));
rnaList.add(rna1);
- rnaList.add(trimRNA(rna1));
+ rna1.setName("consenus_"+rna1.getName());
+
vab = new AppVarnaBinding(rnaList);
//vab = new AppVarnaBinding(seq,struc);
}
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);
+ RNA rnaTrim = new RNA("trim_"+rna.getName());
+ try {
+ rnaTrim.setRNA(rna.getSeq(),rna.getStructDBN());
+ } catch (ExceptionUnmatchedClosingParentheses e2) {
+ e2.printStackTrace();
+ } catch (ExceptionFileFormatOrSyntax e3) {
+ e3.printStackTrace();
+ }
+
+ StringBuffer seq=new StringBuffer(rnaTrim.getSeq());
+ StringBuffer struc=new StringBuffer(rnaTrim.getStructDBN());
+ for(int i=0;i<rnaTrim.getSeq().length();i++){
+ if(seq.substring(i, i+1).compareTo("-")==0 || seq.substring(i, i+1).compareTo(".")==0){
+ if(!rnaTrim.findPair(i).isEmpty()){
+ System.out.println(rnaTrim.findPair(i));
+ int m=rnaTrim.findPair(i).get(1);
+ int l=rnaTrim.findPair(i).get(0);
+
+ struc.replace(m, m+1, "*");
+ struc.replace(l, l+1, "*");
+ }else{
+ struc.replace(i, i+1, "*");
+ }
}
}
+
+ String newSeq=rnaTrim.getSeq().replace("-", "");
+ rnaTrim.getSeq().replace(".", "");
+ String newStruc=struc.toString().replace("*", "");
+
try {
rnaTrim.setRNA(newSeq,newStruc);
- } catch (ExceptionUnmatchedClosingParentheses e) {
+ } catch (ExceptionUnmatchedClosingParentheses e) {
// TODO Auto-generated catch block
e.printStackTrace();
- } catch (ExceptionFileFormatOrSyntax e) {
+ } catch (ExceptionFileFormatOrSyntax e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
- //System.out.println(newSeq+"\t"+newStruc);
- return rnaTrim;
+ }
+
+ return rnaTrim;
}
public void showPanel(boolean show){
vp.setPreferredSize(new Dimension(400, 400));
for(int i=0;i<rnaInList.size();i++){
if(i<rnaInList.size()-1){
- _rnaList.add(vp.getConfig().clone(),rnaInList.get(i),generateDefaultName());
+ _rnaList.add(vp.getConfig().clone(),rnaInList.get(i),rnaInList.get(i).getName());
}else{
- _rnaList.add(vp.getConfig().clone(),rnaInList.get(i),generateDefaultName(),true);
+ _rnaList.add(vp.getConfig().clone(),rnaInList.get(i),rnaInList.get(i).getName(),true);
}
}