From 8ca2f06dc9062ace4ee3cb3b0072188336f54465 Mon Sep 17 00:00:00 2001 From: Sarah Westcott Date: Tue, 19 Jul 2016 15:38:25 -0400 Subject: [PATCH] Benches classify.rf command --- Mothur.xcodeproj/project.pbxproj | 36 ++++------ TestMothur/testtrimoligos.cpp | 43 ++++++++++++ TestMothur/testtrimoligos.hpp | 38 +++++++++++ source/commandfactory.cpp | 2 +- source/commands/classifyrfsharedcommand.cpp | 14 ++-- source/randomforest/abstractrandomforest.cpp | 59 ---------------- source/randomforest/abstractrandomforest.hpp | 67 ------------------- .../randomforest/regularizedrandomforest.cpp | 63 ----------------- source/randomforest/regularizedrandomforest.h | 30 --------- 9 files changed, 102 insertions(+), 250 deletions(-) create mode 100644 TestMothur/testtrimoligos.cpp create mode 100644 TestMothur/testtrimoligos.hpp delete mode 100644 source/randomforest/abstractrandomforest.cpp delete mode 100644 source/randomforest/abstractrandomforest.hpp delete mode 100644 source/randomforest/regularizedrandomforest.cpp delete mode 100644 source/randomforest/regularizedrandomforest.h diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index bdeb919b4..a4d9cc117 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -324,12 +324,10 @@ 481FB6671AC1B8450076CFF3 /* randomnumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A77B7186173D4041002163C2 /* randomnumber.cpp */; }; 481FB6681AC1B8450076CFF3 /* rarecalc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B7A512D37EC400DA6239 /* rarecalc.cpp */; }; 481FB6691AC1B8520076CFF3 /* abstractdecisiontree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7386C241619E52200651424 /* abstractdecisiontree.cpp */; }; - 481FB66A1AC1B8520076CFF3 /* abstractrandomforest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48705AC319BE32C50075E977 /* abstractrandomforest.cpp */; }; 481FB66B1AC1B8520076CFF3 /* decisiontree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7386C28161A110700651424 /* decisiontree.cpp */; }; 481FB66C1AC1B8520076CFF3 /* randomforest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A77E1937161B201E00DB1A2A /* randomforest.cpp */; }; 481FB66D1AC1B8520076CFF3 /* rftreenode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A77E193A161B289600DB1A2A /* rftreenode.cpp */; }; 481FB66E1AC1B8520076CFF3 /* forest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83F25B0A163B031200ABE73D /* forest.cpp */; }; - 481FB66F1AC1B8520076CFF3 /* regularizedrandomforest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 834D9D561656D7C400E7FAB9 /* regularizedrandomforest.cpp */; }; 481FB6701AC1B8820076CFF3 /* raredisplay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B7A712D37EC400DA6239 /* raredisplay.cpp */; }; 481FB6711AC1B8820076CFF3 /* rarefact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B7A912D37EC400DA6239 /* rarefact.cpp */; }; 481FB6721AC1B8820076CFF3 /* refchimeratest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E6BE10912F710D8007ADDBE /* refchimeratest.cpp */; }; @@ -369,11 +367,11 @@ 4827A4DC1CB3ED2200345170 /* fastqdataset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4827A4DA1CB3ED2100345170 /* fastqdataset.cpp */; }; 4829D9671B8387D0002EEED4 /* testbiominfocommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4829D9651B8387D0002EEED4 /* testbiominfocommand.cpp */; }; 483C952E188F0CAD0035E7B7 /* (null) in Sources */ = {isa = PBXBuildFile; }; + 4846AD8A1D3810DD00DE9913 /* testtrimoligos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4846AD881D3810DD00DE9913 /* testtrimoligos.cpp */; }; 48705AC419BE32C50075E977 /* getmimarkspackagecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48705ABB19BE32C50075E977 /* getmimarkspackagecommand.cpp */; }; 48705AC519BE32C50075E977 /* oligos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48705ABD19BE32C50075E977 /* oligos.cpp */; }; 48705AC619BE32C50075E977 /* mergesfffilecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48705ABF19BE32C50075E977 /* mergesfffilecommand.cpp */; }; 48705AC719BE32C50075E977 /* sharedrjsd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48705AC119BE32C50075E977 /* sharedrjsd.cpp */; }; - 48705AC819BE32C50075E977 /* abstractrandomforest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48705AC319BE32C50075E977 /* abstractrandomforest.cpp */; }; 487C5A871AB88B93002AF48A /* mimarksattributescommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 487C5A851AB88B93002AF48A /* mimarksattributescommand.cpp */; }; 487D09EB1CB2CEF3007039BF /* vsearchfileparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 489B55701BCD7F0100FB7DC8 /* vsearchfileparser.cpp */; }; 487D09EC1CB2CEFE007039BF /* averagelinkage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2114A7671C654D7400D3D8D9 /* averagelinkage.cpp */; }; @@ -403,7 +401,6 @@ 48EDB76C1D1320DD00F76E93 /* chimeravsearchcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48EDB76A1D1320DD00F76E93 /* chimeravsearchcommand.cpp */; }; 48F98E4D1A9CFD670005E81B /* completelinkage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48F98E4C1A9CFD670005E81B /* completelinkage.cpp */; }; 7E6BE10A12F710D8007ADDBE /* refchimeratest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E6BE10912F710D8007ADDBE /* refchimeratest.cpp */; }; - 834D9D581656D7C400E7FAB9 /* regularizedrandomforest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 834D9D561656D7C400E7FAB9 /* regularizedrandomforest.cpp */; }; 835FE03D19F00640005AA754 /* classifysvmsharedcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B2181FE17AD777B00286E6A /* classifysvmsharedcommand.cpp */; }; 835FE03E19F00A4D005AA754 /* svm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B21820117AD77BD00286E6A /* svm.cpp */; }; 83F25B0C163B031200ABE73D /* forest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83F25B0A163B031200ABE73D /* forest.cpp */; }; @@ -808,8 +805,9 @@ 4827A4DB1CB3ED2100345170 /* fastqdataset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fastqdataset.h; sourceTree = ""; }; 4829D9651B8387D0002EEED4 /* testbiominfocommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = testbiominfocommand.cpp; sourceTree = ""; }; 4829D9661B8387D0002EEED4 /* testbiominfocommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = testbiominfocommand.h; sourceTree = ""; }; + 4846AD881D3810DD00DE9913 /* testtrimoligos.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = testtrimoligos.cpp; sourceTree = ""; }; + 4846AD891D3810DD00DE9913 /* testtrimoligos.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = testtrimoligos.hpp; sourceTree = ""; }; 484F21691BA1C5F8001C1B5F /* makefile-internal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "makefile-internal"; sourceTree = SOURCE_ROOT; }; - 48705ABA19BE32C50075E977 /* abstractrandomforest.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = abstractrandomforest.hpp; path = source/randomforest/abstractrandomforest.hpp; sourceTree = SOURCE_ROOT; }; 48705ABB19BE32C50075E977 /* getmimarkspackagecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = getmimarkspackagecommand.cpp; path = source/commands/getmimarkspackagecommand.cpp; sourceTree = SOURCE_ROOT; }; 48705ABC19BE32C50075E977 /* getmimarkspackagecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = getmimarkspackagecommand.h; path = source/commands/getmimarkspackagecommand.h; sourceTree = SOURCE_ROOT; }; 48705ABD19BE32C50075E977 /* oligos.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = oligos.cpp; path = source/datastructures/oligos.cpp; sourceTree = SOURCE_ROOT; }; @@ -818,7 +816,6 @@ 48705AC019BE32C50075E977 /* mergesfffilecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mergesfffilecommand.h; path = source/commands/mergesfffilecommand.h; sourceTree = SOURCE_ROOT; }; 48705AC119BE32C50075E977 /* sharedrjsd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sharedrjsd.cpp; path = source/calculators/sharedrjsd.cpp; sourceTree = SOURCE_ROOT; }; 48705AC219BE32C50075E977 /* sharedrjsd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sharedrjsd.h; path = source/calculators/sharedrjsd.h; sourceTree = SOURCE_ROOT; }; - 48705AC319BE32C50075E977 /* abstractrandomforest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = abstractrandomforest.cpp; path = source/randomforest/abstractrandomforest.cpp; sourceTree = SOURCE_ROOT; }; 487C5A851AB88B93002AF48A /* mimarksattributescommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mimarksattributescommand.cpp; path = source/commands/mimarksattributescommand.cpp; sourceTree = SOURCE_ROOT; }; 487C5A861AB88B93002AF48A /* mimarksattributescommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mimarksattributescommand.h; path = source/commands/mimarksattributescommand.h; sourceTree = SOURCE_ROOT; }; 48844B261AA74AF9006EF2B8 /* compare.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = compare.h; path = source/datastructures/compare.h; sourceTree = SOURCE_ROOT; }; @@ -860,8 +857,6 @@ 7E6BE10812F710D8007ADDBE /* refchimeratest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = refchimeratest.h; path = source/refchimeratest.h; sourceTree = ""; }; 7E6BE10912F710D8007ADDBE /* refchimeratest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = refchimeratest.cpp; path = source/refchimeratest.cpp; sourceTree = ""; }; 7E78911B135F3E8600E725D2 /* eachgapdistignorens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = eachgapdistignorens.h; path = source/calculators/eachgapdistignorens.h; sourceTree = SOURCE_ROOT; }; - 834D9D561656D7C400E7FAB9 /* regularizedrandomforest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = regularizedrandomforest.cpp; path = source/randomforest/regularizedrandomforest.cpp; sourceTree = SOURCE_ROOT; }; - 834D9D571656D7C400E7FAB9 /* regularizedrandomforest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = regularizedrandomforest.h; path = source/randomforest/regularizedrandomforest.h; sourceTree = SOURCE_ROOT; }; 83F25B0A163B031200ABE73D /* forest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = forest.cpp; path = source/randomforest/forest.cpp; sourceTree = SOURCE_ROOT; }; 83F25B0B163B031200ABE73D /* forest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = forest.h; path = source/randomforest/forest.h; sourceTree = SOURCE_ROOT; }; 8DD76FB20486AB0100D96B5E /* mothur */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mothur; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1723,6 +1718,8 @@ 48D6E96A1CA4262A008DF76B /* dataset.h */, 4827A4DA1CB3ED2100345170 /* fastqdataset.cpp */, 4827A4DB1CB3ED2100345170 /* fastqdataset.h */, + 4846AD881D3810DD00DE9913 /* testtrimoligos.cpp */, + 4846AD891D3810DD00DE9913 /* testtrimoligos.hpp */, 48D6E9661CA42389008DF76B /* testvsearchfileparser.cpp */, 48D6E9671CA42389008DF76B /* testvsearchfileparser.h */, 481FB5221AC0AA010076CFF3 /* testcontainers */, @@ -1777,8 +1774,6 @@ children = ( A7386C1B1619CACB00651424 /* abstractdecisiontree.hpp */, A7386C241619E52200651424 /* abstractdecisiontree.cpp */, - 48705ABA19BE32C50075E977 /* abstractrandomforest.hpp */, - 48705AC319BE32C50075E977 /* abstractrandomforest.cpp */, A7386C1D1619CACB00651424 /* decisiontree.hpp */, A7386C28161A110700651424 /* decisiontree.cpp */, A7386C1E1619CACB00651424 /* macros.h */, @@ -1788,8 +1783,6 @@ A77E193A161B289600DB1A2A /* rftreenode.cpp */, 83F25B0A163B031200ABE73D /* forest.cpp */, 83F25B0B163B031200ABE73D /* forest.h */, - 834D9D561656D7C400E7FAB9 /* regularizedrandomforest.cpp */, - 834D9D571656D7C400E7FAB9 /* regularizedrandomforest.h */, ); name = randomforest; path = /Users/sarahwestcott/Desktop/mothur; @@ -2735,6 +2728,7 @@ 481FB5E61AC1B77E0076CFF3 /* normalizesharedcommand.cpp in Sources */, 481FB5E71AC1B77E0076CFF3 /* nmdscommand.cpp in Sources */, 481FB52B1AC1B09F0076CFF3 /* setseedcommand.cpp in Sources */, + 4846AD8A1D3810DD00DE9913 /* testtrimoligos.cpp in Sources */, 481FB5261AC0ADA00076CFF3 /* sequence.cpp in Sources */, 481FB5C61AC1B74F0076CFF3 /* getrelabundcommand.cpp in Sources */, 481FB6571AC1B8100076CFF3 /* inputdata.cpp in Sources */, @@ -2755,7 +2749,6 @@ 481FB5DD1AC1B77E0076CFF3 /* matrixoutputcommand.cpp in Sources */, 481FB5771AC1B6EA0076CFF3 /* spearman.cpp in Sources */, 481FB6031AC1B7970076CFF3 /* secondarystructurecommand.cpp in Sources */, - 481FB66F1AC1B8520076CFF3 /* regularizedrandomforest.cpp in Sources */, 481FB5361AC1B5DC0076CFF3 /* getopt_long.cpp in Sources */, 481FB5A41AC1B7300076CFF3 /* clustercommand.cpp in Sources */, 481FB5671AC1B6AD0076CFF3 /* sharedmorisitahorn.cpp in Sources */, @@ -2800,7 +2793,6 @@ 481FB5831AC1B6FF0076CFF3 /* ccode.cpp in Sources */, 481FB5681AC1B6B20076CFF3 /* sharedochiai.cpp in Sources */, 481FB66E1AC1B8520076CFF3 /* forest.cpp in Sources */, - 481FB66A1AC1B8520076CFF3 /* abstractrandomforest.cpp in Sources */, 481FB56A1AC1B6B80076CFF3 /* sharedsobs.cpp in Sources */, 481FB6671AC1B8450076CFF3 /* randomnumber.cpp in Sources */, 481FB5DB1AC1B75C0076CFF3 /* makelefsecommand.cpp in Sources */, @@ -3170,7 +3162,6 @@ A7E9B95D12D37EC400DA6239 /* sharedsorclass.cpp in Sources */, A7E9B95E12D37EC400DA6239 /* sharedsorest.cpp in Sources */, A7E9B95F12D37EC400DA6239 /* sharedthetan.cpp in Sources */, - 48705AC819BE32C50075E977 /* abstractrandomforest.cpp in Sources */, A7E9B96012D37EC400DA6239 /* sharedthetayc.cpp in Sources */, A7E9B96112D37EC400DA6239 /* sharedutilities.cpp in Sources */, A7E9B96212D37EC400DA6239 /* shen.cpp in Sources */, @@ -3287,7 +3278,6 @@ A721AB72161C572A009860A1 /* kmertree.cpp in Sources */, A721AB77161C573B009860A1 /* taxonomynode.cpp in Sources */, 83F25B0C163B031200ABE73D /* forest.cpp in Sources */, - 834D9D581656D7C400E7FAB9 /* regularizedrandomforest.cpp in Sources */, A7496D2E167B531B00CC7D7C /* kruskalwalliscommand.cpp in Sources */, A79EEF8616971D4A0006DEC1 /* filtersharedcommand.cpp in Sources */, A74C06E916A9C0A9008390A3 /* primerdesigncommand.cpp in Sources */, @@ -3334,7 +3324,7 @@ "DYLIB_CURRENT_VERSION[sdk=*]" = ""; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 3; + GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "VERSION=\"\\\"1.37.1\\\"\"", "RELEASE_DATE=\"\\\"04/11/2016\\\"\"", @@ -3369,7 +3359,7 @@ DEPLOYMENT_LOCATION = YES; DSTROOT = TARGET_BUILD_DIR; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 3; + GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "VERSION=\"\\\"1.37.1\\\"\"", "RELEASE_DATE=\"\\\"04/11/2016\\\"\"", @@ -3397,17 +3387,17 @@ buildSettings = { CLANG_WARN_UNREACHABLE_CODE = YES; DEPLOYMENT_LOCATION = NO; - GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_C_LANGUAGE_STANDARD = c11; GCC_ENABLE_SSE3_EXTENSIONS = NO; GCC_ENABLE_SSE41_EXTENSIONS = NO; GCC_ENABLE_SSE42_EXTENSIONS = NO; - GCC_OPTIMIZATION_LEVEL = 3; + GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "MOTHUR_FILES=\"\\\"/Users/sarahwestcott/desktop/release\\\"\"", "VERSION=\"\\\"1.36.0\\\"\"", "RELEASE_DATE=\"\\\"07/23/2015\\\"\"", ); - GCC_VERSION = "/usr/bin/c++"; + GCC_VERSION = ""; "GCC_VERSION[arch=*]" = ""; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; @@ -3444,10 +3434,10 @@ buildSettings = { CLANG_WARN_UNREACHABLE_CODE = YES; DEPLOYMENT_LOCATION = NO; - GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_C_LANGUAGE_STANDARD = c11; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_MODEL_TUNING = ""; - GCC_OPTIMIZATION_LEVEL = 3; + GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "VERSION=\"\\\"1.37.6\\\"\"", "RELEASE_DATE=\"\\\"06/20/2016\\\"\"", diff --git a/TestMothur/testtrimoligos.cpp b/TestMothur/testtrimoligos.cpp new file mode 100644 index 000000000..64b747b53 --- /dev/null +++ b/TestMothur/testtrimoligos.cpp @@ -0,0 +1,43 @@ +// +// testtrimoligos.cpp +// Mothur +// +// Created by Sarah Westcott on 7/14/16. +// Copyright © 2016 Schloss Lab. All rights reserved. +// + +#include "catch.hpp" +#include "testtrimoligos.hpp" + +/**************************************************************************************************/ +TestTrimOligos::TestTrimOligos() { //setup + m = MothurOut::getInstance(); + + //set up barcodes, primers, pairedBarcodes and pairedPrimers + + //Set up vector of seqs with barcodes and primers + + //Set up vector of seqs with pairedbarcodes and pairedprimers + +} +/**************************************************************************************************/ +TestTrimOligos::~TestTrimOligos() { + +} +/**************************************************************************************************/ + +TEST_CASE("Testing TrimOligos Class") { + TestTrimOligos testTrim; + + + //Create trimoligos classes with various constructors + + + //run all public strip functions + + + //run private functions + + +} +/**************************************************************************************************/ diff --git a/TestMothur/testtrimoligos.hpp b/TestMothur/testtrimoligos.hpp new file mode 100644 index 000000000..e150c3dde --- /dev/null +++ b/TestMothur/testtrimoligos.hpp @@ -0,0 +1,38 @@ +// +// testtrimoligos.hpp +// Mothur +// +// Created by Sarah Westcott on 7/14/16. +// Copyright © 2016 Schloss Lab. All rights reserved. +// + +#ifndef testtrimoligos_hpp +#define testtrimoligos_hpp + +#include "trimoligos.h" +#include "sequence.hpp" + +class TestTrimOligos : public TrimOligos { + + +public: + + TestTrimOligos(); + ~TestTrimOligos(); + + MothurOut* m; + vector seqs; + vector pairedSeqs; + + map barcodes; + map primers; + map pairedPrimers; + map pairedBarcodes; + + using TrimOligos::compareDNASeq(string, string); + using TrimOligos::countDiffs(string, string); + +}; + + +#endif /* testtrimoligos_hpp */ diff --git a/source/commandfactory.cpp b/source/commandfactory.cpp index 010021ef0..bec2db3c4 100644 --- a/source/commandfactory.cpp +++ b/source/commandfactory.cpp @@ -305,7 +305,7 @@ CommandFactory::CommandFactory(){ commands["make.table"] = "make.table"; commands["sff.multiple"] = "sff.multiple"; commands["quit"] = "quit"; - commands["classify.rf"] = "classify.rf"; + //commands["classify.rf"] = "classify.rf"; commands["classify.svm"] = "classify.svm"; commands["filter.shared"] = "filter.shared"; commands["primer.design"] = "primer.design"; diff --git a/source/commands/classifyrfsharedcommand.cpp b/source/commands/classifyrfsharedcommand.cpp index 8c81cd8d2..2258e3a80 100644 --- a/source/commands/classifyrfsharedcommand.cpp +++ b/source/commands/classifyrfsharedcommand.cpp @@ -403,15 +403,15 @@ void ClassifyRFSharedCommand::processSharedAndDesignData(vector variables; variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + "RF."; @@ -419,7 +419,7 @@ void ClassifyRFSharedCommand::processSharedAndDesignData(vector variable; variable["[filename]"] = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + "misclassifications."; @@ -428,7 +428,7 @@ void ClassifyRFSharedCommand::processSharedAndDesignData(vectormothurOutEndLine(); } catch(exception& e) { diff --git a/source/randomforest/abstractrandomforest.cpp b/source/randomforest/abstractrandomforest.cpp deleted file mode 100644 index 59e3bafe5..000000000 --- a/source/randomforest/abstractrandomforest.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// -// abstractrandomforest.cpp -// Mothur -// -// Created by Sarah Westcott on 10/1/12. -// Copyright (c) 2012 Schloss Lab. All rights reserved. -// - -#include "abstractrandomforest.hpp" - -/***********************************************************************/ -AbstractRandomForest::AbstractRandomForest(const std::vector < std::vector > dataSet, - const int numDecisionTrees, - const string treeSplitCriterion = "informationGain") -: dataSet(dataSet), -numDecisionTrees(numDecisionTrees), -numSamples((int)dataSet.size()), -numFeatures((int)(dataSet[0].size() - 1)), -globalDiscardedFeatureIndices(getGlobalDiscardedFeatureIndices()), -globalVariableImportanceList(numFeatures, 0), -treeSplitCriterion(treeSplitCriterion) { - m = MothurOut::getInstance(); - // TODO: double check if the implemenatation of 'globalOutOfBagEstimates' is correct -} - -/***********************************************************************/ - -vector AbstractRandomForest::getGlobalDiscardedFeatureIndices() { - try { - vector globalDiscardedFeatureIndices; - - // calculate feature vectors - vector< vector > featureVectors(numFeatures, vector(numSamples, 0)); - for (int i = 0; i < numSamples; i++) { - if (m->control_pressed) { return globalDiscardedFeatureIndices; } - for (int j = 0; j < numFeatures; j++) { featureVectors[j][i] = dataSet[i][j]; } - } - - for (int i = 0; i < featureVectors.size(); i++) { - if (m->control_pressed) { return globalDiscardedFeatureIndices; } - double standardDeviation = m->getStandardDeviation(featureVectors[i]); - if (standardDeviation <= 0){ globalDiscardedFeatureIndices.push_back(i); } - } - - if (m->debug) { - m->mothurOut("number of global discarded features: " + toString(globalDiscardedFeatureIndices.size())+ "\n"); - m->mothurOut("total features: " + toString(featureVectors.size())+ "\n"); - } - - return globalDiscardedFeatureIndices; - } - catch(exception& e) { - m->errorOut(e, "AbstractRandomForest", "getGlobalDiscardedFeatureIndices"); - exit(1); - } -} - -/***********************************************************************/ - diff --git a/source/randomforest/abstractrandomforest.hpp b/source/randomforest/abstractrandomforest.hpp deleted file mode 100644 index 3be91b9b9..000000000 --- a/source/randomforest/abstractrandomforest.hpp +++ /dev/null @@ -1,67 +0,0 @@ -// -// abstractrandomforest.hpp -// rrf-fs-prototype -// -// Created by Abu Zaher Faridee on 7/20/12. -// Copyright (c) 2012 Schloss Lab. All rights reserved. -// - -#ifndef rrf_fs_prototype_abstractrandomforest_hpp -#define rrf_fs_prototype_abstractrandomforest_hpp - -#include "mothurout.h" -#include "macros.h" -#include "abstractdecisiontree.hpp" - -#define DEBUG_MODE - -/***********************************************************************/ - -class AbstractRandomForest{ -public: - // intialization with vectors - AbstractRandomForest(const std::vector < std::vector > dataSet, - const int numDecisionTrees, - const string); - virtual ~AbstractRandomForest(){ } - virtual int populateDecisionTrees() = 0; - virtual int calcForrestErrorRate() = 0; - virtual int calcForrestVariableImportance(string) = 0; - -/***********************************************************************/ - -protected: - - // TODO: create a better way of discarding feature - // currently we just set FEATURE_DISCARD_SD_THRESHOLD to 0 to solved this - // it can be tuned for better selection - // also, there might be other factors like Mean or other stuffs - // same would apply for createLocalDiscardedFeatureList in the TreeNode class - - // TODO: Another idea is getting an aggregated discarded feature indices after the run, from combining - // the local discarded feature indices - // this would penalize a feature, even if in global space the feature looks quite good - // the penalization would be averaged, so this woould unlikely to create a local optmina - - vector getGlobalDiscardedFeatureIndices(); - - int numDecisionTrees; - int numSamples; - int numFeatures; - vector< vector > dataSet; - vector globalDiscardedFeatureIndices; - vector globalVariableImportanceList; - string treeSplitCriterion; - // This is a map of each feature to outcome count of each classes - // e.g. 1 => [2 7] means feature 1 has 2 outcome of 0 and 7 outcome of 1 - map > globalOutOfBagEstimates; - - // TODO: fix this, do we use pointers? - vector decisionTrees; - - MothurOut* m; - -private: - -}; -#endif diff --git a/source/randomforest/regularizedrandomforest.cpp b/source/randomforest/regularizedrandomforest.cpp deleted file mode 100644 index 0a33f4e3b..000000000 --- a/source/randomforest/regularizedrandomforest.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// -// regularizedrandomforest.cpp -// Mothur -// -// Created by Kathryn Iverson on 11/16/12. -// Copyright (c) 2012 Schloss Lab. All rights reserved. -// - -#include "regularizedrandomforest.h" - -RegularizedRandomForest::RegularizedRandomForest(const vector > dataSet, - const int numDecisionTrees, - const string treeSplitCriterion = "gainratio") - // TODO: update ctor according to basic RandomForest Class - : Forest(dataSet, - numDecisionTrees, - treeSplitCriterion, - false, 0.9, true, 0.4, "log2", 0.0) { - m = MothurOut::getInstance(); -} - -int RegularizedRandomForest::calcForrestErrorRate() { - // - try { - return 0; - } - catch(exception& e) { - m->errorOut(e, "RegularizedRandomForest", "calcForrestErrorRate"); - exit(1); - } -} - -int RegularizedRandomForest::calcForrestVariableImportance(string filename) { - // - try { - return 0; - } - catch(exception& e) { - m->errorOut(e, "RegularizedRandomForest", "calcForrestVariableImportance"); - exit(1); - } -} - -int RegularizedRandomForest::populateDecisionTrees() { - // - try { - return 0; - } - catch(exception& e) { - m->errorOut(e, "RegularizedRandomForest", "populateDecisionTrees"); - exit(1); - } -} - -int RegularizedRandomForest::updateGlobalOutOfBagEstimates(DecisionTree *decisionTree) { - try { - return 0; - } - catch(exception& e) { - m->errorOut(e, "RegularizedRandomForest", "updateGlobalOutOfBagEstimates"); - exit(1); - } -} diff --git a/source/randomforest/regularizedrandomforest.h b/source/randomforest/regularizedrandomforest.h deleted file mode 100644 index 94bd624f9..000000000 --- a/source/randomforest/regularizedrandomforest.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// regularizedrandomforest.h -// Mothur -// -// Created by Kathryn Iverson on 11/16/12. -// Copyright (c) 2012 Schloss Lab. All rights reserved. -// - -#ifndef __Mothur__regularizedrandomforest__ -#define __Mothur__regularizedrandomforest__ - -#include "forest.h" -#include "decisiontree.hpp" - -class RegularizedRandomForest: public Forest { -public: - // - RegularizedRandomForest(const vector > dataSet,const int numDecisionTrees, const string); - - int calcForrestErrorRate(); - int calcForrestVariableImportance(string); - int populateDecisionTrees(); - int updateGlobalOutOfBagEstimates(DecisionTree* decisionTree); - -private: - // - MothurOut* m; -}; - -#endif /* defined(__Mothur__regularizedrandomforest__) */