Permalink
Please sign in to comment.
Browse files
Merge pull request #271 from mothur/TaxSpaces_265
Tax spaces 265
- Loading branch information...
Showing
with
1,170 additions
and 439 deletions.
- +18 −7 Mothur.xcodeproj/project.pbxproj
- +0 −1 TestMothur/main.cpp
- +129 −0 TestMothur/testclassifier/testphylotree.cpp
- +32 −0 TestMothur/testclassifier/testphylotree.hpp
- +2 −2 TestMothur/testtrimoligos.hpp
- +0 −1 source/classifier/classify.cpp
- +6 −10 source/classifier/phylosummary.cpp
- +8 −5 source/classifier/phylotree.cpp
- +5 −0 source/classifier/phylotree.h
- +26 −15 source/classifier/taxonomyequalizer.cpp
- +3 −3 source/commands/classifyotucommand.cpp
- +2 −1 source/commands/classifyseqscommand.cpp
- +2 −4 source/commands/getgroupscommand.cpp
- +4 −6 source/commands/getlineagecommand.cpp
- +2 −4 source/commands/getseqscommand.cpp
- +2 −5 source/commands/listseqscommand.cpp
- +6 −2 source/commands/makebiomcommand.cpp
- +123 −19 source/commands/makecontigscommand.cpp
- +626 −166 source/commands/makecontigscommand.h
- +25 −10 source/commands/mergetaxsummarycommand.cpp
- +3 −4 source/commands/pcrseqscommand.cpp
- +1 −29 source/commands/phylotypecommand.cpp
- +0 −2 source/commands/phylotypecommand.h
- +2 −4 source/commands/removegroupscommand.cpp
- +4 −5 source/commands/removelineagecommand.cpp
- +3 −5 source/commands/removeseqscommand.cpp
- +3 −2 source/commands/screenseqscommand.cpp
- +4 −4 source/commands/sortseqscommand.cpp
- +2 −2 source/commands/subsamplecommand.cpp
- +56 −57 source/commands/summarytaxcommand.cpp
- +1 −0 source/commands/summarytaxcommand.h
- +43 −60 source/mothurout.cpp
- +1 −0 source/mothurout.h
- +20 −4 source/optionparser.cpp
- +6 −0 source/trimoligos.h
| @@ -0,0 +1,129 @@ | ||
| +// | ||
| +// testphylotree.cpp | ||
| +// Mothur | ||
| +// | ||
| +// Created by Sarah Westcott on 8/29/16. | ||
| +// Copyright © 2016 Schloss Lab. All rights reserved. | ||
| +// | ||
| + | ||
| +#include "catch.hpp" | ||
| +#include "testphylotree.hpp" | ||
| + | ||
| +/**************************************************************************************************/ | ||
| +TestPhyloTree::TestPhyloTree() { //setup | ||
| + m = MothurOut::getInstance(); | ||
| + | ||
| + string tax1WithSpaces = "Bacteria(100);Bacteroidetes 7(100);Bacteroidia(100);Bacteroidales(100);S24-7(100);"; | ||
| + string tax2WithSpaces = "Bacteria(100);Bacteroidetes 7(100);Bacteroidia(98);Bacteroidales(98);Bacteroidaceae(98);Bacteroides(98);"; | ||
| + string tax3WithSpaces = "Bacteria(100);Firmicutes(100);Clostridia B(100);Clostridiales(100);Lachnospiraceae(100);Blautia(92);"; | ||
| + string tax4WithSpaces = "Bacteria(100);Firmicutes(100);Clostridia B(100);Clostridiales(100);Ruminococcaceae(100);Anaerotruncus(100);"; | ||
| + string tax5WithSpaces = "Bacteria(100);Firmicutes(100);Clostridia B(100);Clostridiales(100);Lachnospiraceae(100);Incertae_Sedis(97);"; | ||
| + | ||
| + string tax1WithOutSpaces = "Bacteria(100);Bacteroidetes(100);Bacteroidia(100);Bacteroidales(100);S24-7(100);"; | ||
| + string tax2WithOutSpaces = "Bacteria(100);Bacteroidetes(100);Bacteroidia(98);Bacteroidales(98);Bacteroidaceae(98);Bacteroides(98);"; | ||
| + string tax3WithOutSpaces = "Bacteria(100);Firmicutes(100);Clostridia(100);Clostridiales(100);Lachnospiraceae(100);Blautia(92);"; | ||
| + string tax4WithOutSpaces = "Bacteria(100);Firmicutes(100);Clostridia(100);Clostridiales(100);Ruminococcaceae(100);Anaerotruncus(100);"; | ||
| + string tax5WithOutSpaces = "Bacteria(100);Firmicutes(100);Clostridia(100);Clostridiales(100);Lachnospiraceae(100);Incertae_Sedis(97);"; | ||
| + | ||
| + phylo.addSeqToTree("seq1", tax1WithSpaces); | ||
| + phylo.addSeqToTree("seq2", tax2WithSpaces); | ||
| + phylo.addSeqToTree("seq3", tax3WithSpaces); | ||
| + phylo.addSeqToTree("seq4", tax4WithSpaces); | ||
| + phylo.addSeqToTree("seq5", tax5WithSpaces); | ||
| + phylo.addSeqToTree("seq6", tax1WithOutSpaces); | ||
| + phylo.addSeqToTree("seq7", tax2WithOutSpaces); | ||
| + phylo.addSeqToTree("seq8", tax3WithOutSpaces); | ||
| + phylo.addSeqToTree("seq9", tax4WithOutSpaces); | ||
| + phylo.addSeqToTree("seq10", tax5WithOutSpaces); | ||
| +} | ||
| +/**************************************************************************************************/ | ||
| +TestPhyloTree::~TestPhyloTree() {} | ||
| +/**************************************************************************************************/ | ||
| + | ||
| +TEST_CASE("Testing PhyloTree Class") { | ||
| + TestPhyloTree testPTree; | ||
| + | ||
| + string tax1WithSpaces = "Bacteria(100);Bacteroidetes 7(100);Bacteroidia(100);Bacteroidales(100);S24-7(100);"; | ||
| + string tax2WithSpaces = "Bacteria(100);Bacteroidetes 7(100);Bacteroidia(98);Bacteroidales(98);Bacteroidaceae(98);Bacteroides(98);"; | ||
| + string tax3WithSpaces = "Bacteria(100);Firmicutes(100);Clostridia B(100);Clostridiales(100);Lachnospiraceae(100);Blautia(92);"; | ||
| + string tax4WithSpaces = "Bacteria(100);Firmicutes(100);Clostridia B(100);Clostridiales(100);Ruminococcaceae(100);Anaerotruncus(100);"; | ||
| + string tax5WithSpaces = "Bacteria(100);Firmicutes(100);Clostridia B(100);Clostridiales(100);Lachnospiraceae(100);Incertae_Sedis(97);"; | ||
| + | ||
| + string tax1WithOutSpaces = "Bacteria(100);Bacteroidetes(100);Bacteroidia(100);Bacteroidales(100);S24-7(100);"; | ||
| + string tax2WithOutSpaces = "Bacteria(100);Bacteroidetes(100);Bacteroidia(98);Bacteroidales(98);Bacteroidaceae(98);Bacteroides(98);"; | ||
| + string tax3WithOutSpaces = "Bacteria(100);Firmicutes(100);Clostridia(100);Clostridiales(100);Lachnospiraceae(100);Blautia(92);"; | ||
| + string tax4WithOutSpaces = "Bacteria(100);Firmicutes(100);Clostridia(100);Clostridiales(100);Ruminococcaceae(100);Anaerotruncus(100);"; | ||
| + string tax5WithOutSpaces = "Bacteria(100);Firmicutes(100);Clostridia(100);Clostridiales(100);Lachnospiraceae(100);Incertae_Sedis(97);"; | ||
| + | ||
| + SECTION("Add Sequences to Tree") { | ||
| + INFO("Using taxonomies with and without spaces") // Only appears on a FAIL | ||
| + | ||
| + CAPTURE(testPTree.addSeqToTree("seq1", tax1WithSpaces)); | ||
| + CHECK(testPTree.addSeqToTree("seq1", tax1WithSpaces) == 5); | ||
| + | ||
| + CAPTURE(testPTree.addSeqToTree("seq2", tax2WithSpaces)); | ||
| + CHECK(testPTree.addSeqToTree("seq2", tax2WithSpaces) == 6); | ||
| + | ||
| + CAPTURE(testPTree.addSeqToTree("seq3", tax3WithSpaces)); | ||
| + CHECK(testPTree.addSeqToTree("seq3", tax3WithSpaces) == 6); | ||
| + | ||
| + CAPTURE(testPTree.addSeqToTree("seq4", tax4WithSpaces)); | ||
| + CHECK(testPTree.addSeqToTree("seq4", tax4WithSpaces) == 6); | ||
| + | ||
| + CAPTURE(testPTree.addSeqToTree("seq5", tax5WithSpaces)); | ||
| + CHECK(testPTree.addSeqToTree("seq5", tax5WithSpaces) == 6); | ||
| + | ||
| + CAPTURE(testPTree.addSeqToTree("seq6", tax1WithOutSpaces)); | ||
| + CHECK(testPTree.addSeqToTree("seq6", tax1WithOutSpaces) == 5); | ||
| + | ||
| + CAPTURE(testPTree.addSeqToTree("seq7", tax2WithOutSpaces)); | ||
| + CHECK(testPTree.addSeqToTree("seq7", tax2WithOutSpaces) == 6); | ||
| + | ||
| + CAPTURE(testPTree.addSeqToTree("seq8", tax3WithOutSpaces)); | ||
| + CHECK(testPTree.addSeqToTree("seq8", tax3WithOutSpaces) == 6); | ||
| + | ||
| + CAPTURE(testPTree.addSeqToTree("seq9", tax4WithOutSpaces)); | ||
| + CHECK(testPTree.addSeqToTree("seq9", tax4WithOutSpaces) == 6); | ||
| + | ||
| + CAPTURE(testPTree.addSeqToTree("seq10", tax5WithOutSpaces)); | ||
| + CHECK(testPTree.addSeqToTree("seq10", tax5WithOutSpaces) == 6); | ||
| + } | ||
| + | ||
| + SECTION("Get Seqs") { | ||
| + INFO("Using taxonomies with and without spaces") // Only appears on a FAIL | ||
| + | ||
| + CAPTURE(testPTree.phylo.getSeqs("Bacteroidetes 7").size()); | ||
| + CHECK((testPTree.phylo.getSeqs("Bacteroidetes 7").size()) == 2); | ||
| + | ||
| + vector<string> Bacteroidetes_7 = testPTree.phylo.getSeqs("Bacteroidetes 7"); | ||
| + CHECK(Bacteroidetes_7[0] == "seq1"); | ||
| + CHECK(Bacteroidetes_7[1] == "seq2"); | ||
| + | ||
| + CAPTURE(testPTree.phylo.getSeqs("Clostridia").size()); | ||
| + CHECK((testPTree.phylo.getSeqs("Clostridia").size()) == 3); | ||
| + | ||
| + vector<string> Clostridia = testPTree.phylo.getSeqs("Clostridia"); | ||
| + CHECK(Clostridia[0] == "seq8"); | ||
| + CHECK(Clostridia[1] == "seq9"); | ||
| + CHECK(Clostridia[2] == "seq10"); | ||
| + } | ||
| + | ||
| + SECTION("Get Genus Totals") { | ||
| + INFO("Using taxonomies with and without spaces") // Only appears on a FAIL | ||
| + | ||
| + CAPTURE(testPTree.phylo.getGenusTotals().size()); | ||
| + CHECK(testPTree.phylo.getGenusTotals().size() == 10); | ||
| + } | ||
| + | ||
| + SECTION("Get Full Taxonomy") { | ||
| + INFO("Using taxonomies with and without spaces") // Only appears on a FAIL | ||
| + | ||
| + CAPTURE(testPTree.phylo.getFullTaxonomy("seq1")); | ||
| + CHECK(testPTree.phylo.getFullTaxonomy("seq1") == "Bacteria;Bacteroidetes 7;Bacteroidia;Bacteroidales;S24-7;"); | ||
| + | ||
| + CAPTURE(testPTree.phylo.getFullTaxonomy("seq10")); | ||
| + CHECK(testPTree.phylo.getFullTaxonomy("seq1") == "Bacteria;Firmicutes;Clostridia;Clostridiales;Lachnospiraceae;Incertae_Sedis;"); | ||
| + } | ||
| + | ||
| +} | ||
| +/**************************************************************************************************/ |
| @@ -0,0 +1,32 @@ | ||
| +// | ||
| +// testphylotree.hpp | ||
| +// Mothur | ||
| +// | ||
| +// Created by Sarah Westcott on 8/29/16. | ||
| +// Copyright © 2016 Schloss Lab. All rights reserved. | ||
| +// | ||
| + | ||
| +#ifndef testphylotree_hpp | ||
| +#define testphylotree_hpp | ||
| + | ||
| +#include "phylotree.h" | ||
| + | ||
| +class TestPhyloTree : public PhyloTree { | ||
| + | ||
| + | ||
| +public: | ||
| + | ||
| + TestPhyloTree(); | ||
| + ~TestPhyloTree(); | ||
| + | ||
| + MothurOut* m; | ||
| + | ||
| + PhyloTree phylo; | ||
| + | ||
| + //using PhyloTree:: | ||
| + //using PhyloTree:: | ||
| + | ||
| +}; | ||
| + | ||
| + | ||
| +#endif /* testphylotree_hpp */ |
Oops, something went wrong.
0 comments on commit
a23ea7d