X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fhmmer%2FJackHMMER.java;h=1731439584254cee92069207abebb5c947af379f;hb=79d76d41dc80b2c5a71201f26f832af337b7809f;hp=85b97f9aa0a752006128b0f407cd9fe16d6c3b8d;hpb=1beac3545a78d4c5c3274dbb53296708d693efe0;p=jalview.git diff --git a/src/jalview/hmmer/JackHMMER.java b/src/jalview/hmmer/JackHMMER.java index 85b97f9..1731439 100644 --- a/src/jalview/hmmer/JackHMMER.java +++ b/src/jalview/hmmer/JackHMMER.java @@ -246,7 +246,9 @@ public class JackHMMER extends HmmerCommand */ databaseFile = FileUtils.createTempFile("database", ".fa"); AlignmentI al = af.getViewport().getAlignment(); - exportFasta(al.getSequencesArray(), databaseFile); + AlignmentI copy = new Alignment(al); + deleteHmmSequences(copy); + exportFasta(copy, databaseFile); } args.add(getFilePath(seqFile, true)); @@ -325,22 +327,12 @@ public class JackHMMER extends HmmerCommand && !"".equals(line)) { SequenceI seq = seqs[index]; - AlignmentAnnotation pp = null; - if (seq.getAlignmentAnnotations("", "Posterior Probability") - .size() != 0) - { - pp = seq.getAlignmentAnnotations("", "Posterior Probability") - .get(0); - } + Scanner scanner = new Scanner(line); - String str = scanner.next(); - str = scanner.next(); - addScoreAnnotation(str, seq, "jackhmmer E-value", - "Full sequence E-value", pp); - str = scanner.next(); - addScoreAnnotation(str, seq, "jackhmmer Score", - "Full sequence bit score", pp); - seq.removeAlignmentAnnotation(pp); + String evalue = scanner.next(); + evalue = scanner.next(); + String score = scanner.next(); + addScoreAnnotations(evalue, score, seq); scanner.close(); line = br.readLine(); index++; @@ -349,58 +341,37 @@ public class JackHMMER extends HmmerCommand 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) + protected void addScoreAnnotations(String eValue, String bitScore, + SequenceI seq) { - addScoreAnnotation(value, seq, label, description, null); - } + String label = "Search Scores"; + String description = "Full sequence bit score and E-Value"; - /** - * A helper method that adds one score-only (non-positional) annotation to a - * sequence - * - * @param value - * @param seq - * @param label - * @param description - * @param pp - * existing posterior probability annotation - values - * copied to new annotation row - */ - protected void addScoreAnnotation(String value, SequenceI seq, - String label, String description, AlignmentAnnotation pp) - { try { - AlignmentAnnotation annot = null; - if (pp == null) - { - annot = new AlignmentAnnotation(label, description, null); - } - else - { - annot = new AlignmentAnnotation(pp); - annot.label = label; - annot.description = description; - } + AlignmentAnnotation annot = new AlignmentAnnotation(label, + description, null); + + annot.label = label; + annot.description = description; + annot.setCalcId(JACKHMMER); - double eValue = Double.parseDouble(value); - annot.setScore(eValue); + + double dEValue = Double.parseDouble(eValue); + annot.setEValue(dEValue); + + double dBitScore = Double.parseDouble(bitScore); + annot.setEValue(dBitScore); + annot.setSequenceRef(seq); seq.addAlignmentAnnotation(annot); } catch (NumberFormatException e) { - System.err.println("Error parsing " + label + " from " + value); + System.err.println("Error parsing " + label + " from " + eValue + + " & " + bitScore); } } + + }