X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FClustalFile.java;fp=src%2Fjalview%2Fio%2FClustalFile.java;h=710ef4a252a97939ef0df455982512a54da1767e;hb=1933431422afc7955684a0bae6c7028a2f8484c8;hp=1e198c475c8cd6eb424482723177f9c1107a7d17;hpb=c24d7fddcbce270e9d766872238e3f14b6bf6719;p=jalview.git diff --git a/src/jalview/io/ClustalFile.java b/src/jalview/io/ClustalFile.java index 1e198c4..710ef4a 100755 --- a/src/jalview/io/ClustalFile.java +++ b/src/jalview/io/ClustalFile.java @@ -49,7 +49,9 @@ public class ClustalFile extends AlignFile { int i = 0; boolean flag = false; - + boolean rna=false; + boolean top=false; + StringBuffer pssecstr=new StringBuffer(),consstr=new StringBuffer(); Vector headers = new Vector(); Hashtable seqhash = new Hashtable(); StringBuffer tempseq; @@ -60,6 +62,10 @@ public class ClustalFile extends AlignFile { while ((line = nextLine()) != null) { + if (line.length()==0) + { + top=true; + } if (line.indexOf(" ") != 0) { str = new StringTokenizer(line, " "); @@ -95,6 +101,7 @@ public class ClustalFile extends AlignFile { tempseq.append(str.nextToken()); } + top=false; } } } @@ -102,6 +109,16 @@ public class ClustalFile extends AlignFile { flag = true; } + } else { + if (line.matches("\\s+(-|\\.|\\(|\\[|\\]|\\))+")) + { + if (top) + { + pssecstr.append(line.trim()); + } else { + consstr.append(line.trim()); + } + } } } } catch (IOException e) @@ -139,9 +156,26 @@ public class ClustalFile extends AlignFile + headers.elementAt(i)); } } + AlignmentAnnotation lastssa=null; + if (pssecstr.length()==maxLength) + { + Vector ss=new Vector(); + AlignmentAnnotation ssa=lastssa=StockholmFile.parseAnnotationRow(ss, "secondary structure", pssecstr.toString()); + ssa.label="Secondary Structure"; + annotations.addElement(ssa); + } + if (consstr.length()==maxLength) + { + Vector ss=new Vector(); + AlignmentAnnotation ssa=StockholmFile.parseAnnotationRow(ss, "secondary structure", consstr.toString()); + ssa.label="Consensus Secondary Structure"; + if (lastssa==null || !lastssa.getRNAStruc().equals(ssa.getRNAStruc().replace('-', '.'))) + { + annotations.addElement(ssa); + } + } } } - public String print() { return print(getSeqsAsArray());