while (!" ------ inclusion threshold ------".equals(line)
&& !"".equals(line))
{
+ SequenceI seq = seqs[index];
Scanner scanner = new Scanner(line);
-
- String str = scanner.next(); // full sequence eValue score
- // float eValue = Float.parseFloat(str);
- // int seqLength = seqs[index].getLength();
- // Annotation[] annots = new Annotation[seqLength];
- // for (int j = 0; j < seqLength; j++)
- // {
- // annots[j] = new Annotation(eValue);
- // }
- AlignmentAnnotation annot = new AlignmentAnnotation("E-value",
- "Score", null);
- annot.setCalcId(HMMSEARCH);
- double eValue = Double.parseDouble(str);
- annot.setScore(eValue);
- annot.setSequenceRef(seqs[index]);
- seqs[index].addAlignmentAnnotation(annot);
-
+ String str = scanner.next();
+ addScoreAnnotation(str, seq, "hmmsearch E-value",
+ "Full sequence E-value");
+ str = scanner.next();
+ addScoreAnnotation(str, seq, "hmmsearch Score",
+ "Full sequence bit score");
scanner.close();
line = br.readLine();
index++;
br.close();
}
+ /**
+ * A helper method that adds one score-only (non-positional) annotation to a
+ * sequence
+ *
+ * @param value
+ * @param seq
+ * @param label
+ * @param description
+ */
+ protected void addScoreAnnotation(String value, SequenceI seq,
+ String label, String description)
+ {
+ try
+ {
+ AlignmentAnnotation annot = new AlignmentAnnotation(label,
+ description, null);
+ annot.setCalcId(HMMSEARCH);
+ double eValue = Double.parseDouble(value);
+ annot.setScore(eValue);
+ annot.setSequenceRef(seq);
+ seq.addAlignmentAnnotation(annot);
+ } catch (NumberFormatException e)
+ {
+ System.err.println("Error parsing " + label + " from " + value);
+ }
+ }
+
}