import jalview.util.Format;
import java.io.IOException;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
import java.util.StringTokenizer;
import java.util.Vector;
{
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 pssecstr = new StringBuffer();
+ StringBuffer consstr = new StringBuffer();
+ Vector<String> headers = new Vector<>();
+ Map<String, StringBuffer> seqhash = new HashMap<>();
StringBuffer tempseq;
String line, id;
StringTokenizer str;
{
top = true;
}
- if (line.indexOf(" ") != 0)
+ boolean isConservation = line.startsWith(SPACE)
+ || line.startsWith(TAB);
+ if (!isConservation)
{
- str = new StringTokenizer(line, " ");
+ str = new StringTokenizer(line);
if (str.hasMoreTokens())
{
{
if (seqhash.containsKey(id))
{
- tempseq = (StringBuffer) seqhash.get(id);
+ tempseq = seqhash.get(id);
}
else
{
}
Sequence newSeq = parseId(headers.elementAt(i).toString());
- newSeq.setSequence(seqhash.get(headers.elementAt(i).toString())
- .toString());
+ newSeq.setSequence(
+ seqhash.get(headers.elementAt(i).toString()).toString());
seqs.addElement(newSeq);
}
else
{
- System.err
- .println("Clustal File Reader: Can't find sequence for "
- + headers.elementAt(i));
+ System.err.println("Clustal File Reader: Can't find sequence for "
+ + headers.elementAt(i));
}
}
AlignmentAnnotation lastssa = null;
if (pssecstr.length() == maxLength)
{
- Vector ss = new Vector();
+ Vector<AlignmentAnnotation> ss = new Vector<>();
AlignmentAnnotation ssa = lastssa = StockholmFile
.parseAnnotationRow(ss, "secondary structure",
pssecstr.toString());
}
if (consstr.length() == maxLength)
{
- Vector ss = new Vector();
+ Vector<AlignmentAnnotation> 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('-', '.')))
+ if (lastssa == null || !lastssa.getRNAStruc()
+ .equals(ssa.getRNAStruc().replace('-', '.')))
{
annotations.addElement(ssa);
}
while ((j < s.length) && (s[j] != null))
{
- out.append(new Format("%-" + maxid + "s").form(printId(s[j],
- jvsuffix) + " "));
+ out.append(new Format("%-" + maxid + "s")
+ .form(printId(s[j], jvsuffix) + " "));
- int start = i * len;
- int end = start + len;
+ int chunkStart = i * len;
+ int chunkEnd = chunkStart + len;
int length = s[j].getLength();
- if ((end < length) && (start < length))
+ if ((chunkEnd < length) && (chunkStart < length))
{
- out.append(s[j].getSequenceAsString(start, end));
+ out.append(s[j].getSequenceAsString(chunkStart, chunkEnd));
}
else
{
- if (start < length)
+ if (chunkStart < length)
{
- out.append(s[j].getSequenceAsString().substring(start));
+ out.append(s[j].getSequenceAsString().substring(chunkStart));
}
}