- // Concise format allows no comments or non comma-formatted data
- StringTokenizer str = new StringTokenizer(line, ":");
- String id = "";
-
- if (!str.hasMoreTokens())
- {
- continue;
- }
-
- id = str.nextToken();
-
- String seqsym = str.nextToken();
- StringTokenizer symbols = new StringTokenizer(seqsym, ",");
-
- // decide if we have more than just alphanumeric symbols
- int numSymbols = symbols.countTokens();
-
- if (numSymbols == 0)
- {
- continue;
- }
-
- if (seqsym.length() != (2 * numSymbols))
- {
- // Set of scalars for some property
- if (Scores.containsKey(id))
- {
- int i = 1;
-
- while (Scores.containsKey(id + "_" + i))
- {
- i++;
- }
-
- id = id + "_" + i;
- }
-
- Vector scores = new Vector();
-
- // Typecheck from first entry
- int i = 0;
- String ascore = "dead";
-
- try
- {
- // store elements as floats...
- while (symbols.hasMoreTokens())
- {
- ascore = symbols.nextToken();
-
- Float score = new Float(ascore);
- scores.addElement((Object) score);
- }
-
- Scores.put(id, scores);
- }
- catch (Exception e)
- {
- // or just keep them as strings
- i = scores.size();
-
- for (int j = 0; j < i; j++)
- {
- scores.setElementAt(
- (Object) ((Float) scores.elementAt(j)).toString(), j);
- }
-
- scores.addElement((Object) ascore);
-
- while (symbols.hasMoreTokens())
- {
- ascore = symbols.nextToken();
- scores.addElement((Object) ascore);
- }
-
- Scores.put(id, scores);
- }
- }
- else if (id.equals("jnetconf"))
- {
- // log.debug System.out.println("here");
- id = "Prediction Confidence";
- this.conf = new Vector(numSymbols);
-
- for (int i = 0; i < numSymbols; i++)
- {
- conf.setElementAt( symbols.nextToken(), i);
- }
- }
- else
- {
- // Sequence or a prediction string (rendered as sequence)
- StringBuffer newseq = new StringBuffer();
-
- for (int i = 0; i < numSymbols; i++)
- {
- newseq.append(symbols.nextToken());
- }
-
- if (id.indexOf(";") > -1)
- {
- seq_entries.addElement(newseq);
-
- int i = 1;
- String name = id.substring(id.indexOf(";") + 1);
-
- while (ids.lastIndexOf(name) > -1)
- {
- name = id.substring(id.indexOf(";") + 1) + "_" + ++i;
- }
-
- ids.addElement(name);
-
- noSeqs++;
- }
- else
- {
- if (id.equals("JNETPRED"))
- {
- id = "Predicted Secondary Structure";
- }
-
- seq_entries.addElement(newseq.toString());
- ids.addElement(id);
- Symscores.put((Object) id,
- (Object) new Integer(ids.size() - 1));
- }
- }
+ // or just keep them as strings
+ i = scores.size();
+
+ for (int j = 0; j < i; j++)
+ {
+ scores.setElementAt(
+ (Object) ( (Float) scores.elementAt(j)).toString(), j);
+ }
+
+ scores.addElement( (Object) ascore);
+
+ while (symbols.hasMoreTokens())
+ {
+ ascore = symbols.nextToken();
+ scores.addElement( (Object) ascore);
+ }
+
+ Scores.put(id, scores);