import jalview.gui.AlignFrame;
import jalview.gui.JvOptionPane;
import jalview.gui.Preferences;
+import jalview.io.FastaFile;
import jalview.io.HMMFile;
import jalview.io.StockholmFile;
import jalview.util.FileUtils;
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
protected final List<ArgumentI> params;
+ /*
+ * 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";
+
+ static final String ARG_TRIM = "--trim";
+
/**
* Constructor
*
writer.close();
}
+ public void exportFasta(SequenceI[] seqs, File toFile)
+ {
+ FastaFile file = new FastaFile();
+ String output = file.print(seqs, false);
+ PrintWriter writer;
+ try
+ {
+ writer = new PrintWriter(toFile);
+ writer.println(output);
+ writer.close();
+ } catch (FileNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+
+ }
+
/**
* Answers the full path to the given hmmer executable, or null if file cannot
* be found or is not executable
}
}
+ // TODO is needed?
+ /**
+ * Exports a sequence to the specified file
+ *
+ * @param hmm
+ * @param hmmFile
+ * @throws IOException
+ */
+ public void exportSequence(SequenceI seq, File seqFile) throws IOException
+ {
+ if (seq != null)
+ {
+ FastaFile file = new FastaFile();
+ PrintWriter writer = new PrintWriter(seqFile);
+ writer.print(file.print(new SequenceI[] { seq }, false));
+ writer.close();
+ }
+ }
+
/**
* Answers the HMM profile for the profile sequence the user selected (default
* is just the first HMM sequence in the alignment)
}
/**
+ * Answers the HMM profile for the profile sequence the user selected (default
+ * is just the first HMM sequence in the alignment)
+ *
+ * @return
+ */
+ protected SequenceI getSequence()
+ {
+ String alignToParamName = MessageManager
+ .getString("label.use_sequence");
+ for (ArgumentI arg : params)
+ {
+ String name = arg.getName();
+ if (name.equals(alignToParamName))
+ {
+ String seqName = arg.getValue();
+ SequenceI seq = alignment.findName(seqName);
+ return seq;
+ }
+ }
+ return null;
+ }
+
+ /**
* Answers an absolute path to the given file, in a format suitable for
* processing by a hmmer command. On a Windows platform, the native Windows file
* path is converted to Cygwin format, by replacing '\'with '/' and drive letter