OptionParser parser(option);
map<string, string> parameters = parser.getParameters();
- ValidParameters validParameter;
+ ValidParameters validParameter("align.seqs");
map<string, string>::iterator it;
//check to make sure all parameters are valid for command
if (pid == 0) {
#endif
- ableToOpen = openInputFile(candidateFileNames[i], in);
- in.close();
-
+ ableToOpen = openInputFile(candidateFileNames[i], in, "noerror");
+
+ //if you can't open it, try default location
+ if (ableToOpen == 1) {
+ if (m->getDefaultPath() != "") { //default path is set
+ string tryPath = m->getDefaultPath() + getSimpleName(candidateFileNames[i]);
+ m->mothurOut("Unable to open " + candidateFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+ ableToOpen = openInputFile(tryPath, in, "noerror");
+ candidateFileNames[i] = tryPath;
+ }
+ }
+ in.close();
#ifdef USE_MPI
for (int j = 1; j < processors; j++) {
MPI_Send(&ableToOpen, 1, MPI_INT, j, 2001, MPI_COMM_WORLD);
#endif
if (ableToOpen == 1) {
- m->mothurOut(candidateFileNames[i] + " will be disregarded."); m->mothurOutEndLine();
+ m->mothurOut("Unable to open " + candidateFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine();
//erase from file list
candidateFileNames.erase(candidateFileNames.begin()+i);
i--;
#ifdef USE_MPI
int pid, end, numSeqsPerProcessor;
int tag = 2001;
- vector<long> MPIPos;
+ vector<unsigned long int> MPIPos;
MPIWroteAccnos = false;
MPI_Status status;
int outMode=MPI_MODE_CREATE|MPI_MODE_WRONLY;
int inMode=MPI_MODE_RDONLY;
- //char* outAlignFilename = new char[alignFileName.length()];
- //memcpy(outAlignFilename, alignFileName.c_str(), alignFileName.length());
-
char outAlignFilename[1024];
strcpy(outAlignFilename, alignFileName.c_str());
-
- //char* outReportFilename = new char[reportFileName.length()];
- //memcpy(outReportFilename, reportFileName.c_str(), reportFileName.length());
char outReportFilename[1024];
strcpy(outReportFilename, reportFileName.c_str());
-
- //char* outAccnosFilename = new char[accnosFileName.length()];
- //memcpy(outAccnosFilename, accnosFileName.c_str(), accnosFileName.length());
char outAccnosFilename[1024];
strcpy(outAccnosFilename, accnosFileName.c_str());
-
- //char* inFileName = new char[candidateFileNames[s].length()];
- //memcpy(inFileName, candidateFileNames[s].c_str(), candidateFileNames[s].length());
char inFileName[1024];
strcpy(inFileName, candidateFileNames[s].c_str());
if(processors == 1){
ifstream inFASTA;
openInputFile(candidateFileNames[s], inFASTA);
- numFastaSeqs=count(istreambuf_iterator<char>(inFASTA),istreambuf_iterator<char>(), '>');
+ getNumSeqs(inFASTA, numFastaSeqs);
inFASTA.close();
lines.push_back(new linePair(0, numFastaSeqs));
}
}
else{
- vector<int> positions;
+ vector<unsigned long int> positions;
processIDS.resize(0);
ifstream inFASTA;
while(!inFASTA.eof()){
input = getline(inFASTA);
if (input.length() != 0) {
- if(input[0] == '>'){ long int pos = inFASTA.tellg(); positions.push_back(pos - input.length() - 1); }
+ if(input[0] == '>'){ unsigned long int pos = inFASTA.tellg(); positions.push_back(pos - input.length() - 1); }
}
}
inFASTA.close();
int numSeqsPerProcessor = numFastaSeqs / processors;
for (int i = 0; i < processors; i++) {
- long int startPos = positions[ i * numSeqsPerProcessor ];
+ unsigned long int startPos = positions[ i * numSeqsPerProcessor ];
if(i == processors - 1){
numSeqsPerProcessor = numFastaSeqs - i * numSeqsPerProcessor;
}
#else
ifstream inFASTA;
openInputFile(candidateFileNames[s], inFASTA);
- numFastaSeqs=count(istreambuf_iterator<char>(inFASTA),istreambuf_iterator<char>(), '>');
+ getNumSeqs(inFASTA, numFastaSeqs);
inFASTA.close();
lines.push_back(new linePair(0, numFastaSeqs));
}
//**********************************************************************************************************************
#ifdef USE_MPI
-int AlignCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File& alignFile, MPI_File& reportFile, MPI_File& accnosFile, vector<long>& MPIPos){
+int AlignCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File& alignFile, MPI_File& reportFile, MPI_File& accnosFile, vector<unsigned long int>& MPIPos){
try {
string outputString = "";
MPI_Status statusReport;