- /**
- * Appends command line arguments to the given list, to specify input and
- * output files for the search, and any additional options that may have been
- * passed from the parameters dialog
- *
- * @param args
- * @param searchOutputFile
- * @param hitsAlignmentFile
- * @param hmmFile
- * @throws IOException
- */
- protected void buildArguments(List<String> args, File searchOutputFile,
- File hitsAlignmentFile, File hmmFile) throws IOException
- {
- args.add("-o");
- args.add(getFilePath(searchOutputFile));
- args.add("-A");
- args.add(getFilePath(hitsAlignmentFile));
-
- boolean dbFound = false;
- String dbPath = "";
- File databaseFile = null;
-
- boolean useEvalueCutoff = false;
- boolean useScoreCutoff = false;
- String seqEvalueCutoff = null;
- String domEvalueCutoff = null;
- String seqScoreCutoff = null;
- String domScoreCutoff = null;
- databaseName = "Alignment";
- boolean searchAlignment = false;
-
- if (params != null)
- {
- for (ArgumentI arg : params)
- {
- String name = arg.getName();
- if (MessageManager.getString(NUMBER_OF_RESULTS_KEY)
- .equals(name))
- {
- seqsToReturn = Integer.parseInt(arg.getValue());
- }
- else if (MessageManager.getString("action.search").equals(name))
- {
- searchAlignment = arg.getValue().equals(
- MessageManager.getString(HMMSearch.THIS_ALIGNMENT_KEY));
- }
- else if (MessageManager.getString(DATABASE_KEY).equals(name))
- {
- dbPath = arg.getValue();
- int pos = dbPath.lastIndexOf(File.separator);
- databaseName = dbPath.substring(pos + 1);
- databaseFile = new File(dbPath);
- }
- else if (MessageManager.getString(AUTO_ALIGN_SEQS_KEY)
- .equals(name))
- {
- realign = true;
- }
- else if (MessageManager.getString(USE_ACCESSIONS_KEY)
- .equals(name))
- {
- args.add("--acc");
- }
- else if (MessageManager.getString(REPORTING_CUTOFF_KEY)
- .equals(name))
- {
- if (CUTOFF_EVALUE.equals(arg.getValue()))
- {
- useEvalueCutoff = true;
- }
- else if (CUTOFF_SCORE.equals(arg.getValue()))
- {
- useScoreCutoff = true;
- }
- }
- else if (MessageManager.getString(SEQ_EVALUE_KEY).equals(name))
- {
- seqEvalueCutoff = arg.getValue();
- }
- else if (MessageManager.getString(SEQ_SCORE_KEY).equals(name))
- {
- seqScoreCutoff = arg.getValue();
- }
- else if (MessageManager.getString(DOM_EVALUE_KEY)
- .equals(name))
- {
- domEvalueCutoff = arg.getValue();
- }
- else if (MessageManager.getString(DOM_SCORE_KEY).equals(name))
- {
- domScoreCutoff = arg.getValue();
- }
- else if (MessageManager.getString(TRIM_TERMINI_KEY)
- .equals(name))
- {
- trim = true;
- }
- else if (MessageManager.getString(DATABASE_KEY).equals(name))
- {
- dbFound = true;
- dbPath = arg.getValue();
- if (!MessageManager.getString(THIS_ALIGNMENT_KEY)
- .equals(dbPath))
- {
- int pos = dbPath.lastIndexOf(File.separator);
- databaseName = dbPath.substring(pos + 1);
- databaseFile = new File(dbPath);
- }
- }
- }
- }
-
- if (useEvalueCutoff)
- {
- args.add("-E");
- args.add(seqEvalueCutoff);
- args.add("--domE");
- args.add(domEvalueCutoff);
- }
- else if (useScoreCutoff)
- {
- args.add("-T");
- args.add(seqScoreCutoff);
- args.add("--domT");
- args.add(domScoreCutoff);
- }
-
-// if (!dbFound || MessageManager.getString(THIS_ALIGNMENT_KEY)
-// .equals(dbPath))
- if (searchAlignment)
- {
- /*
- * no external database specified for search, so
- * export current alignment as 'database' to search,
- * excluding any HMM consensus sequences it contains
- */
- databaseFile = FileUtils.createTempFile("database", ".sto");
- AlignmentI al = af.getViewport().getAlignment();
- AlignmentI copy = new Alignment(al);
- List<SequenceI> hmms = copy.getHmmSequences();
- for (SequenceI hmmSeq : hmms)
- {
- copy.deleteSequence(hmmSeq);
- }
- exportStockholm(copy.getSequencesArray(), databaseFile, null);
- }
-
- args.add(getFilePath(hmmFile));
- args.add(getFilePath(databaseFile));
- }