Permalink
Browse files

Merge branch '1.39.0' into Windows_vsearch

  • Loading branch information...
2 parents bf8bc84 + eba2e8b commit 3d3d27f88572692dbbc78d11ea4d339c919622c2 @mothur-westcott mothur-westcott committed on GitHub Jan 19, 2017
Showing with 51,738 additions and 1,310 deletions.
  1. +58 −10 Mothur.xcodeproj/project.pbxproj
  2. +1 −9 TestMothur/dataset.h
  3. +46,955 −0 TestMothur/distcdataset.cpp
  4. +32 −0 TestMothur/distcdataset.h
  5. +2,578 −0 TestMothur/distpdataset.cpp
  6. +30 −0 TestMothur/distpdataset.h
  7. +3 −2 TestMothur/testcontainers/testfastqread.cpp
  8. +101 −0 TestMothur/testcontainers/testoptimatrix.cpp
  9. +31 −0 TestMothur/testcontainers/testoptimatrix.h
  10. +142 −0 TestMothur/testopticluster.cpp
  11. +36 −0 TestMothur/testopticluster.h
  12. +3 −3 TestMothur/testvsearchfileparser.cpp
  13. +0 −1 TestMothur/testvsearchfileparser.h
  14. +2 −2 source/cluster.cpp
  15. +4 −6 source/cluster.hpp
  16. +199 −16 source/commands/clustercommand.cpp
  17. +10 −5 source/commands/clustercommand.h
  18. +227 −48 source/commands/clustersplitcommand.cpp
  19. +11 −6 source/commands/clustersplitcommand.h
  20. +0 −432 source/commands/getotuscommand.cpp
  21. +0 −55 source/commands/getotuscommand.h
  22. +4 −6 source/commands/mgclustercommand.cpp
  23. +0 −439 source/commands/removeotuscommand.cpp
  24. +0 −52 source/commands/removeotuscommand.h
  25. +24 −21 source/commands/sensspeccommand.cpp
  26. +1 −1 source/commands/sensspeccommand.h
  27. +3 −11 source/commands/sffinfocommand.cpp
  28. +4 −2 source/commands/sharedcommand.cpp
  29. +5 −1 source/commands/sracommand.cpp
  30. +1 −1 source/commands/sracommand.h
  31. +1 −1 source/datastructures/counttable.h
  32. +445 −0 source/datastructures/optimatrix.cpp
  33. +60 −0 source/datastructures/optimatrix.h
  34. +1 −1 source/datastructures/sequencecountparser.cpp
  35. +1 −1 source/linearalgebra.cpp
  36. +0 −171 source/makefile
  37. +4 −3 source/mothur.cpp
  38. +46 −1 source/mothurout.cpp
  39. +2 −0 source/mothurout.h
  40. +632 −0 source/opticluster.cpp
  41. +66 −0 source/opticluster.h
  42. +12 −1 source/read/splitmatrix.cpp
  43. +3 −1 source/read/splitmatrix.h
  44. +0 −1 source/singlelinkage.cpp

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -25,11 +25,7 @@ class TestDataSet {
GroupMap* getGroupMap() { fillGroup(); return gMap; }
CountTable* getCountTable() { createCountTable(); return ct; }
vector<SharedRAbundVector*> getLookup() { fillLookup(); return lookup; }
- vector<FastqRead> getForwardFastq() { return fastqData.getForwardFastq(); }
- vector<FastqRead> getReverseFastq() { return fastqData.getReverseFastq(); }
- vector<string> getSubsetFRFastq(int n) { return fastqData.getSubsetFRFastq(n); }
-
- vector<string> getSubsetFNGFiles(int); //number of uniques passed in. 3 files returned -> Fasta, name, group.
+ vector<string> getSubsetFNGFiles(int); //number of uniques, Fasta, name, group returned
private:
MothurOut* m;
@@ -39,15 +35,11 @@ class TestDataSet {
CountTable* ct;
GroupMap* gMap;
vector<SharedRAbundVector*> lookup;
- vector<FastqRead> ffastqReads; //F8D0 Sample
- vector<FastqRead> rfastqReads; //F8D0 Sample
void fillNames();
void fillSeqs();
void fillGroup();
void createCountTable();
void fillLookup();
- void fillForwardFastq();
- void fillReverseFastq();
};
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,32 @@
+//
+// distcdataset.h
+// Mothur
+//
+// Created by Sarah Westcott on 6/8/16.
+// Copyright (c) 2016 Schloss Lab. All rights reserved.
+//
+
+#ifndef __Mothur__distcdataset__
+#define __Mothur__distcdataset__
+
+#include "mothurout.h"
+
+class DistCDataSet {
+
+public:
+
+ DistCDataSet();
+ ~DistCDataSet() {}
+ string getColumnFile() { return writeColumnFile(); }
+ vector<string> getFiles(int);
+ string getCountFile() { return writeCountFile(); }
+
+private:
+ MothurOut* m;
+ string writeColumnFile();
+ string writeCountFile();
+
+};
+
+
+#endif /* defined(__Mothur__distcdataset__) */
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,30 @@
+//
+// distdataset.h
+// Mothur
+//
+// Created by Sarah Westcott on 6/6/16.
+// Copyright (c) 2016 Schloss Lab. All rights reserved.
+//
+
+#ifndef __Mothur__distdataset__
+#define __Mothur__distdataset__
+
+#include "mothurout.h"
+
+class DistPDataSet {
+
+public:
+
+ DistPDataSet();
+ ~DistPDataSet() {}
+
+ string getPhylipFile() { return writePhylipFile(); }
+
+private:
+ MothurOut* m;
+ string writePhylipFile();
+
+};
+
+
+#endif /* defined(__Mothur__distdataset__) */
@@ -13,7 +13,7 @@
/**************************************************************************************************/
TestFastqRead::TestFastqRead() { //setup
m = MothurOut::getInstance();
- TestDataSet data;
+ TestFastqDataSet data;
reads = data.getForwardFastq();
filenames = data.getSubsetFRFastq(100);
}
@@ -25,6 +25,7 @@ TestFastqRead::~TestFastqRead() {
/**************************************************************************************************/
TEST_CASE("Testing FastqRead Class") {
+ /*
TestFastqRead testFastq;
SECTION("Testing (Sequence, Quality) Constructor ") {
@@ -60,6 +61,6 @@ TEST_CASE("Testing FastqRead Class") {
CHECK(read.getScores()[0] == testFastq.reads[0].getScores()[0]);
}
-
+ */
}
/**************************************************************************************************/
@@ -0,0 +1,101 @@
+//
+// testoptimatrix.cpp
+// Mothur
+//
+// Created by Sarah Westcott on 6/6/16.
+// Copyright (c) 2016 Schloss Lab. All rights reserved.
+//
+
+#include "catch.hpp"
+#include "testoptimatrix.h"
+#include "distancecommand.h"
+#include "dataset.h"
+
+/**************************************************************************************************/
+TestOptiMatrix::TestOptiMatrix() { //setup
+ m = MothurOut::getInstance();
+ TestDataSet data;
+ filenames = data.getSubsetFNGFiles(100); //Fasta, name, group returned
+
+ string inputString = "fasta=" + filenames[0];
+ m->mothurOut("/******************************************/"); m->mothurOutEndLine();
+ m->mothurOut("Running command: dist.seqs(" + inputString + ")"); m->mothurOutEndLine();
+ m->mothurCalling = true;
+
+ Command* distCommand = new DistanceCommand(inputString);
+ distCommand->execute();
+
+ map<string, vector<string> > outputFilenames = distCommand->getOutputFiles();
+
+ delete distCommand;
+ m->mothurCalling = false;
+
+ columnFile = outputFilenames["column"][0];
+ m->mothurOut("/******************************************/"); m->mothurOutEndLine();
+
+ inputString = "fasta=" + filenames[0] + ", output=lt";
+ m->mothurOut("/******************************************/"); m->mothurOutEndLine();
+ m->mothurOut("Running command: dist.seqs(" + inputString + ")"); m->mothurOutEndLine();
+ m->mothurCalling = true;
+
+ Command* dist2Command = new DistanceCommand(inputString);
+ dist2Command->execute();
+
+ outputFilenames = dist2Command->getOutputFiles();
+
+ delete dist2Command;
+ m->mothurCalling = false;
+
+ phylipFile = outputFilenames["phylip"][0];
+ m->mothurOut("/******************************************/"); m->mothurOutEndLine();
+}
+/**************************************************************************************************/
+TestOptiMatrix::~TestOptiMatrix() {
+ for (int i = 0; i < filenames.size(); i++) { m->mothurRemove(filenames[i]); } //teardown
+ m->mothurRemove(columnFile);
+ m->mothurRemove(phylipFile);
+}
+/**************************************************************************************************/
+TEST_CASE("Testing OptiMatrix Class") {
+ TestOptiMatrix testOMatrix;
+ OptiMatrix matrix(testOMatrix.columnFile, testOMatrix.filenames[1], "name", 0.03, false);
+ OptiMatrix pmatrix(testOMatrix.phylipFile, "", "", 0.03, false);
+
+ SECTION("Testing Column Read") {
+ INFO("Using First 100 sequences of final.fasta and final.names") // Only appears on a FAIL
+
+ CAPTURE(matrix.print(cout)); // Displays this variable on a FAIL
+
+ CHECK(matrix.print(cout) == 112); //numdists in matrix
+ }
+
+ SECTION("Testing Phylip Read") {
+ INFO("Using First 100 sequences of final.fasta and final.names") // Only appears on a FAIL
+
+ CAPTURE(pmatrix.print(cout)); // Displays this variable on a FAIL
+
+ CHECK(pmatrix.print(cout) == 112); //numdists in matrix
+ }
+
+ /* First few rows of matrix
+ 12 23 44
+ 10 23 32 36
+ 16 25 33 48
+ 38
+ 22 45 52
+ */
+
+ SECTION("Testing isClose") {
+ INFO("Sequences 0 and 1") // Only appears on a FAIL
+
+ CAPTURE(matrix.isClose(0, 12));
+ CHECK(matrix.isClose(0, 12) == true);
+ CAPTURE(matrix.isClose(0, 44));
+ CHECK(matrix.isClose(0, 44) == true);
+ CAPTURE(matrix.isClose(1, 23));
+ CHECK(matrix.isClose(1, 23) == true);
+ CAPTURE(matrix.isClose(1, 36));
+ CHECK(matrix.isClose(1, 36) == true);
+ }
+}
+/**************************************************************************************************/
@@ -0,0 +1,31 @@
+//
+// testoptimatrix.h
+// Mothur
+//
+// Created by Sarah Westcott on 6/6/16.
+// Copyright (c) 2016 Schloss Lab. All rights reserved.
+//
+
+#ifndef __Mothur__testoptimatrix__
+#define __Mothur__testoptimatrix__
+
+#include "optimatrix.h"
+
+class TestOptiMatrix : public OptiMatrix {
+
+public:
+
+ TestOptiMatrix();
+ ~TestOptiMatrix();
+
+ using OptiMatrix::getCloseSeqs;
+ using OptiMatrix::findDistFormat;
+ using OptiMatrix::readPhylip;
+ using OptiMatrix::readColumn;
+
+ string columnFile, phylipFile;
+ vector<string> filenames;
+
+};
+
+#endif /* defined(__Mothur__testoptimatrix__) */
@@ -0,0 +1,142 @@
+//
+// testopticluster.cpp
+// Mothur
+//
+// Created by Sarah Westcott on 6/15/16.
+// Copyright (c) 2016 Schloss Lab. All rights reserved.
+//
+
+#include "testopticluster.h"
+#include "catch.hpp"
+#include "optimatrix.h"
+#include "distancecommand.h"
+#include "dataset.h"
+
+/**************************************************************************************************/
+TestOptiCluster::TestOptiCluster() { //setup
+ m = MothurOut::getInstance();
+ TestDataSet data;
+ filenames = data.getSubsetFNGFiles(100); //Fasta, name, group returned
+
+ string inputString = "fasta=" + filenames[0];
+ m->mothurOut("/******************************************/"); m->mothurOutEndLine();
+ m->mothurOut("Running command: dist.seqs(" + inputString + ")"); m->mothurOutEndLine();
+ m->mothurCalling = true;
+
+ Command* distCommand = new DistanceCommand(inputString);
+ distCommand->execute();
+
+ map<string, vector<string> > outputFilenames = distCommand->getOutputFiles();
+
+ delete distCommand;
+ m->mothurCalling = false;
+
+ columnFile = outputFilenames["column"][0];
+}
+/**************************************************************************************************/
+TestOptiCluster::~TestOptiCluster() {
+ for (int i = 0; i < filenames.size(); i++) { m->mothurRemove(filenames[i]); } //teardown
+ m->mothurRemove(columnFile);
+}
+/**************************************************************************************************/
+TEST_CASE("Testing OptiCluster Class") {
+ TestOptiCluster testOcluster;
+ OptiMatrix matrix(testOcluster.columnFile, testOcluster.filenames[1], "name", 0.03, false);
+ testOcluster.setVariables(&matrix, "mcc");
+
+ SECTION("Testing Initialize") {
+ INFO("Using First 100 sequences of final.fasta and final.names") // Only appears on a FAIL
+
+ double initialMetricValue;
+
+ CAPTURE(testOcluster.initialize(initialMetricValue, true)); //
+
+ CHECK(testOcluster.initialize(initialMetricValue, true) == 0); //metric value
+ }
+
+ SECTION("Testing calcMCC") {
+ INFO("Using tp=5000, tn=10000, fp=10, fn=200") // Only appears on a FAIL
+
+ double tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
+
+ CAPTURE(testOcluster.calcMCC(tp,tn,fp,fn)); // Displays this variable on a FAIL
+
+ CHECK((int)(testOcluster.calcMCC(tp,tn,fp,fn)*10000) == 9694); //metric value
+ }
+
+ SECTION("Testing calcSens") {
+ INFO("Using tp=5000, tn=10000, fp=10, fn=200") // Only appears on a FAIL
+
+ double tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
+
+ CAPTURE(testOcluster.calcSens(tp,tn,fp,fn)); // Displays this variable on a FAIL
+
+ CHECK((int)(testOcluster.calcSens(tp,tn,fp,fn)*10000) == 9615); //metric value
+ }
+
+ SECTION("Testing calcSpec") {
+ INFO("Using tp=5000, tn=10000, fp=10, fn=200") // Only appears on a FAIL
+
+ double tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
+
+ CAPTURE(testOcluster.calcSpec(tp,tn,fp,fn)); // Displays this variable on a FAIL
+
+ CHECK((int)(testOcluster.calcSpec(tp,tn,fp,fn)*10000) == 9990); //metric value
+ }
+
+ SECTION("Testing calcTPTN") {
+ INFO("Using tp=5000, tn=10000, fp=10, fn=200") // Only appears on a FAIL
+
+ double tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
+
+ CAPTURE(testOcluster.calcTPTN(tp,tn,fp,fn)); // Displays this variable on a FAIL
+
+ CHECK((int)(testOcluster.calcTPTN(tp,tn,fp,fn)*10000) == 9861); //metric value
+ }
+
+ SECTION("Testing calcTP2TN") {
+ INFO("Using tp=5000, tn=10000, fp=10, fn=200") // Only appears on a FAIL
+
+ double tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
+
+ CAPTURE(testOcluster.calcTP2TN(tp,tn,fp,fn)); // Displays this variable on a FAIL
+
+ CHECK((int)(testOcluster.calcTP2TN(tp,tn,fp,fn)*10000) == 16436); //metric value
+ }
+
+ SECTION("Testing calcFPFN") {
+ INFO("Using tp=5000, tn=10000, fp=10, fn=200") // Only appears on a FAIL
+
+ double tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
+
+ CAPTURE(testOcluster.calcFPFN(tp,tn,fp,fn)); // Displays this variable on a FAIL
+
+ CHECK((int)(testOcluster.calcFPFN(tp,tn,fp,fn)*10000) == 9861); //metric value
+ }
+
+ SECTION("Testing moveAdjustTFValues") {
+ INFO("Using tp=5000, tn=10000, fp=10, fn=200 and mcc") // Only appears on a FAIL
+
+ double tp,tn,fp,fn; tp=5000; tn=10000; fp=10; fn=200;
+ double initialMetricValue;
+ testOcluster.initialize(initialMetricValue, false); //no randomization
+
+ CAPTURE(testOcluster.moveAdjustTFValues(0, 10, 1, tp,tn,fp,fn)); // Displays this variable on a FAIL
+
+ CHECK((int)(testOcluster.moveAdjustTFValues(0, 10, 1, tp,tn,fp,fn)*10000) == 9700); //metric value
+ }
+
+ SECTION("Testing update") {
+ INFO("Using mcc") // Only appears on a FAIL
+
+ double initialMetricValue;
+ testOcluster.initialize(initialMetricValue, false); //no randomization
+ testOcluster.update(initialMetricValue);
+
+ CAPTURE(initialMetricValue); // Displays this variable on a FAIL
+
+ CHECK((int)(initialMetricValue*10000) == 7853); //metric value
+ }
+
+}
+/**************************************************************************************************/
Oops, something went wrong.

0 comments on commit 3d3d27f

Please sign in to comment.