]> git.donarmstrong.com Git - mothur.git/blobdiff - ccode.cpp
added name option to read.tree for use in unifrac and parimony commands
[mothur.git] / ccode.cpp
index 0f1dd50aba5fec78ddd3aff3667533fcdef500b4..c474d7a0ad7cb54729f809cf9921ed234f48d5db 100644 (file)
--- a/ccode.cpp
+++ b/ccode.cpp
@@ -13,7 +13,7 @@
 
 
 //***************************************************************************************************************
-Ccode::Ccode(string filename, string temp) {  fastafile = filename;  templateFile = temp;  }
+Ccode::Ccode(string filename, string temp, string o) {  fastafile = filename;  templateFile = temp;  outputDir = o; }
 //***************************************************************************************************************
 
 Ccode::~Ccode() {
@@ -32,7 +32,7 @@ void Ccode::print(ostream& out) {
                
                mothurOutEndLine();
                
-               string mapInfo = getRootName(fastafile) + "mapinfo";
+               string mapInfo = outputDir + getRootName(getSimpleName(fastafile)) + "mapinfo";
                ofstream out2;
                openOutputFile(mapInfo, out2);
                
@@ -128,7 +128,7 @@ void Ccode::print(ostream& out) {
 }
 
 //***************************************************************************************************************
-void Ccode::getChimeras() {
+int Ccode::getChimeras() {
        try {
                
                //read in query sequences and subject sequences
@@ -139,6 +139,8 @@ void Ccode::getChimeras() {
                
                int numSeqs = querySeqs.size();
                
+               if (unaligned) { mothurOut("Your sequences need to be aligned when you use the bellerophon ccode."); mothurOutEndLine(); return 1;  }
+               
                closest.resize(numSeqs);
                
                refCombo.resize(numSeqs, 0);
@@ -297,7 +299,8 @@ void Ccode::getChimeras() {
                for (int i = 0; i < lines.size(); i++)                                  {       delete lines[i];                                }
                delete distCalc;
                delete decalc;
-                       
+               
+               return 0;
        }
        catch(exception& e) {
                errorOut(e, "Ccode", "getChimeras");
@@ -423,15 +426,15 @@ vector<int> Ccode::findWindows(int query) {
                it = trim[query].begin();
                
                int length = it->second - it->first;
-               
+       
                //default is wanted = 10% of total length
                if (windowSizes[query] > length) { 
                        mothurOut("You have slected a window larger than your sequence length after all filters, masks and trims have been done. I will use the default 10% of sequence length.");
                        windowSizes[query] = length / 10;
                }else if (windowSizes[query] == 0) { windowSizes[query] = length / 10;  }
-               else if (windowSizes[query] > (length 20)) {
+               else if (windowSizes[query] > (length * 0.20)) {
                        mothurOut("You have selected a window that is larger than 20% of your sequence length.  This is not recommended, but I will continue anyway."); mothurOutEndLine();
-               }else if (windowSizes[query] < (length 5)) {
+               }else if (windowSizes[query] < (length * 0.05)) {
                        mothurOut("You have selected a window that is smaller than 5% of your sequence length.  This is not recommended, but I will continue anyway."); mothurOutEndLine();
                }
                
@@ -1480,7 +1483,7 @@ void Ccode::createProcessesVariances() {
                        
                        //find the averages for the query 
                        for (int i = 0; i < querySeqs.size(); i++) {
-                               findVarianceQuery(i);  //fills varQuery[i] and sdQuery[i] also sets minimum error rate to 0.001 to avoid divide by 0.
+                               findVarianceQuery(i);  //fills v arQuery[i] and sdQuery[i] also sets minimum error rate to 0.001 to avoid divide by 0.
                        }
 #endif         
        }