X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=alignmentdb.cpp;h=9fec737778e01704e98f5c813e3c0554e7ab0981;hp=df4eaec783dbb81e33c09c3d97473c02425ba1ce;hb=d1c97b8c04bb75faca1e76ffad60b37a4d789d3d;hpb=ae57e166b2ed7b475ec3f466106bd76fabadd063 diff --git a/alignmentdb.cpp b/alignmentdb.cpp index df4eaec..9fec737 100644 --- a/alignmentdb.cpp +++ b/alignmentdb.cpp @@ -13,33 +13,6 @@ #include "blastdb.hpp" #include "referencedb.h" -/**************************************************************************************************/ -//deep copy -AlignmentDB::AlignmentDB(const AlignmentDB& adb) : numSeqs(adb.numSeqs), longest(adb.longest), method(adb.method), emptySequence(adb.emptySequence), threadID(adb.threadID) { - try { - - m = MothurOut::getInstance(); - if (adb.method == "blast") { - search = new BlastDB(*((BlastDB*)adb.search)); - }else if(adb.method == "kmer") { - search = new KmerDB(*((KmerDB*)adb.search)); - }else if(adb.method == "suffix") { - search = new SuffixDB(*((SuffixDB*)adb.search)); - }else { - m->mothurOut("[ERROR]: cannot create copy of alignment database, unrecognized method - " + adb.method); m->mothurOutEndLine(); - } - - for (int i = 0; i < adb.templateSequences.size(); i++) { - Sequence temp(adb.templateSequences[i]); - templateSequences.push_back(temp); - } - } - catch(exception& e) { - m->errorOut(e, "AlignmentDB", "AlignmentDB"); - exit(1); - } - -} /**************************************************************************************************/ AlignmentDB::AlignmentDB(string fastaFileName, string s, int kmerSize, float gapOpen, float gapExtend, float match, float misMatch, int tid){ // This assumes that the template database is in fasta format, may try { // need to alter this in the future? @@ -69,12 +42,14 @@ AlignmentDB::AlignmentDB(string fastaFileName, string s, int kmerSize, float gap numSeqs = templateSequences.size(); if (!silent) { m->mothurOut("It took " + toString(time(NULL) - start) + " to load " + toString(rdb->referenceSeqs.size()) + " sequences.");m->mothurOutEndLine(); } - + }else { int start = time(NULL); m->mothurOutEndLine(); m->mothurOut("Reading in the " + fastaFileName + " template sequences...\t"); cout.flush(); - + //bool aligned = false; + int tempLength = 0; + #ifdef USE_MPI int pid, processors; vector positions; @@ -129,6 +104,9 @@ AlignmentDB::AlignmentDB(string fastaFileName, string s, int kmerSize, float gap //save longest base if (temp.getUnaligned().length() >= longest) { longest = temp.getUnaligned().length()+1; } + if (tempLength != 0) { + if (tempLength != temp.getAligned().length()) { m->mothurOut("[ERROR]: template is not aligned, aborting.\n"); m->control_pressed=true; } + }else { tempLength = temp.getAligned().length(); } } } @@ -152,6 +130,10 @@ AlignmentDB::AlignmentDB(string fastaFileName, string s, int kmerSize, float gap //save longest base if (temp.getUnaligned().length() >= longest) { longest = (temp.getUnaligned().length()+1); } + + if (tempLength != 0) { + if (tempLength != temp.getAligned().length()) { m->mothurOut("[ERROR]: template is not aligned, aborting.\n"); m->control_pressed=true; } + }else { tempLength = temp.getAligned().length(); } } } fastaFile.close();