Пример #1
0
//**********************************************************************************************************************
vector<string> MGClusterCommand::setParameters(){	
	try {
		CommandParameter pblast("blast", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pblast);
		CommandParameter pname("name", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pname);
		CommandParameter plength("length", "Number", "", "5", "", "", "",false,false); parameters.push_back(plength);
		CommandParameter ppenalty("penalty", "Number", "", "0.10", "", "", "",false,false); parameters.push_back(ppenalty);
		CommandParameter pcutoff("cutoff", "Number", "", "0.70", "", "", "",false,false); parameters.push_back(pcutoff);
		CommandParameter pprecision("precision", "Number", "", "100", "", "", "",false,false); parameters.push_back(pprecision);
		CommandParameter pmethod("method", "Multiple", "furthest-nearest-average", "average", "", "", "",false,false); parameters.push_back(pmethod);
		CommandParameter phard("hard", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(phard);
		CommandParameter pmin("min", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(pmin);
		CommandParameter pmerge("merge", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(pmerge);
		CommandParameter phcluster("hcluster", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(phcluster);
		CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
		CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
		
		vector<string> myArray;
		for (int i = 0; i < parameters.size(); i++) {	myArray.push_back(parameters[i].name);		}
		return myArray;
	}
	catch(exception& e) {
		m->errorOut(e, "MGClusterCommand", "setParameters");
		exit(1);
	}
}
void copy(char *fromDir, char *fname, char *toDir)
{
      FILE    *nul;       /* nul will redirect stdout to DOS 'nul' */
      char    from[FILENAME_MAX], to[FILENAME_MAX], comd[128];
      int     bytesRead, oldStdout;

      /* Create the strings to describe the paths                  */

      pmerge(from, NULL, fromDir, fname, NULL);
      pmerge(to, NULL, toDir, fname, NULL);

      /* Construct 'comd' string which is a dos command for a copy */

      strcpy(comd, "copy ");
      strcat(comd, from); strcat(comd, " ");
      strcat(comd, to);

      /* Redirect stdout to a nul file, kills output to the screen */

      nul = fopen("NUL", "w");
      oldStdout = dup(STDOUT);
      dup2(fileno(nul), STDOUT);
      fclose(nul);

      system(comd);           /* COPY file */

      /* Restore stdout and close nul file */

      dup2(oldStdout, STDOUT);
      close(oldStdout);

      /* Display file source and target,      */
      /* otherwise comment out the next line. */

      printf("\n%s copied to %s",from,to);
}