X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fhmmer%2FHMMSearch.java;h=64802c7dc206053582e22e2d79225d15a630cf8f;hb=79d76d41dc80b2c5a71201f26f832af337b7809f;hp=57786e592f2be26be37f21d9a051f23d7f2a6178;hpb=24514ffaa8ef17fa371dcdd64a4693282d0e93d6;p=jalview.git diff --git a/src/jalview/hmmer/HMMSearch.java b/src/jalview/hmmer/HMMSearch.java index 57786e5..64802c7 100644 --- a/src/jalview/hmmer/HMMSearch.java +++ b/src/jalview/hmmer/HMMSearch.java @@ -34,37 +34,6 @@ public class HMMSearch extends HmmerCommand { static final String HMMSEARCH = "hmmsearch"; - /* - * constants for i18n lookup of passed parameter names - */ - static final String DATABASE_KEY = "label.database"; - - static final String THIS_ALIGNMENT_KEY = "label.this_alignment"; - - static final String USE_ACCESSIONS_KEY = "label.use_accessions"; - - static final String AUTO_ALIGN_SEQS_KEY = "label.auto_align_seqs"; - - static final String NUMBER_OF_RESULTS_KEY = "label.number_of_results"; - - static final String TRIM_TERMINI_KEY = "label.trim_termini"; - - static final String REPORTING_CUTOFF_KEY = "label.reporting_cutoff"; - - static final String CUTOFF_NONE = "None"; - - static final String CUTOFF_SCORE = "Score"; - - static final String CUTOFF_EVALUE = "E-Value"; - - static final String SEQ_EVALUE_KEY = "label.seq_evalue"; - - static final String DOM_EVALUE_KEY = "label.dom_evalue"; - - static final String SEQ_SCORE_KEY = "label.seq_score"; - - static final String DOM_SCORE_KEY = "label.dom_score"; - boolean realign = false; boolean trim = false; @@ -104,7 +73,7 @@ public class HMMSearch extends HmmerCommand SequenceI hmmSeq = hmm.getConsensusSequence(); long msgId = System.currentTimeMillis(); - af.setProgressBar(MessageManager.getString("status.running_hmmsearch"), + af.setProgressBar(MessageManager.getString("status.running_search"), msgId); try @@ -306,11 +275,7 @@ public class HMMSearch extends HmmerCommand databaseFile = FileUtils.createTempFile("database", ".sto"); AlignmentI al = af.getViewport().getAlignment(); AlignmentI copy = new Alignment(al); - List hmms = copy.getHmmSequences(); - for (SequenceI hmmSeq : hmms) - { - copy.deleteSequence(hmmSeq); - } + deleteHmmSequences(copy); exportStockholm(copy.getSequencesArray(), databaseFile, null); } @@ -481,17 +446,10 @@ public class HMMSearch extends HmmerCommand && !"".equals(line)) { SequenceI seq = seqs[index]; - AlignmentAnnotation pp = seq - .getAlignmentAnnotations("", "Posterior Probability") - .get(0); Scanner scanner = new Scanner(line); - String str = scanner.next(); - addScoreAnnotation(str, seq, "hmmsearch E-value", - "Full sequence E-value", pp); - str = scanner.next(); - addScoreAnnotation(str, seq, "hmmsearch Score", - "Full sequence bit score", pp); - seq.removeAlignmentAnnotation(pp); + String evalue = scanner.next(); + String score = scanner.next(); + addScoreAnnotations(evalue, score, seq); scanner.close(); line = br.readLine(); index++; @@ -500,58 +458,35 @@ public class HMMSearch 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) - { - addScoreAnnotation(value, seq, label, description, null); - } - /** - * 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) + protected void addScoreAnnotations(String eValue, String bitScore, + SequenceI seq) { + String label = "Search Scores"; + String description = "Full sequence bit score and E-Value"; + try { - AlignmentAnnotation annot = null; - if (pp == null) - { - new AlignmentAnnotation(label, + AlignmentAnnotation annot = new AlignmentAnnotation(label, description, null); - } - else - { - annot = new AlignmentAnnotation(pp); - annot.label = label; - annot.description = description; - } + + annot.label = label; + annot.description = description; + annot.setCalcId(HMMSEARCH); - double eValue = Double.parseDouble(value); - annot.setScore(eValue); + + double dEValue = Double.parseDouble(eValue); + annot.setEValue(dEValue); + + double dBitScore = Double.parseDouble(bitScore); + annot.setBitScore(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); } }