diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index 9f6bc0ab..48a38e69 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -379,6 +379,8 @@ 488841621CC515A000C5E972 /* (null) in Sources */ = {isa = PBXBuildFile; }; 488841651CC6C34900C5E972 /* renamefilecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 488841631CC6C34900C5E972 /* renamefilecommand.cpp */; }; 488841661CC6C35500C5E972 /* renamefilecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 488841631CC6C34900C5E972 /* renamefilecommand.cpp */; }; + 48910D431D5243E500F60EDB /* mergecountcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48910D411D5243E500F60EDB /* mergecountcommand.cpp */; }; + 48910D441D5243E500F60EDB /* mergecountcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48910D411D5243E500F60EDB /* mergecountcommand.cpp */; }; 4893DE2918EEF28100C615DF /* (null) in Sources */ = {isa = PBXBuildFile; }; 489B55721BCD7F0100FB7DC8 /* vsearchfileparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 489B55701BCD7F0100FB7DC8 /* vsearchfileparser.cpp */; }; 48A11C6E1CDA40F0003481D8 /* testrenamefilecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48A11C6C1CDA40F0003481D8 /* testrenamefilecommand.cpp */; }; @@ -791,22 +793,22 @@ 219C1DE11552C508004209F9 /* newcommandtemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = newcommandtemplate.h; path = source/commands/newcommandtemplate.h; sourceTree = SOURCE_ROOT; }; 219C1DE31559BCCD004209F9 /* getcoremicrobiomecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = getcoremicrobiomecommand.cpp; path = source/commands/getcoremicrobiomecommand.cpp; sourceTree = SOURCE_ROOT; }; 219C1DE51559BCF2004209F9 /* getcoremicrobiomecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = getcoremicrobiomecommand.h; path = source/commands/getcoremicrobiomecommand.h; sourceTree = SOURCE_ROOT; }; - 480E8DAF1CAB12ED00A0D137 /* testfastqread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testfastqread.cpp; path = testcontainers/testfastqread.cpp; sourceTree = ""; }; - 480E8DB01CAB12ED00A0D137 /* testfastqread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testfastqread.h; path = testcontainers/testfastqread.h; sourceTree = ""; }; + 480E8DAF1CAB12ED00A0D137 /* testfastqread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testfastqread.cpp; path = TestMothur/testcontainers/testfastqread.cpp; sourceTree = SOURCE_ROOT; }; + 480E8DB01CAB12ED00A0D137 /* testfastqread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testfastqread.h; path = TestMothur/testcontainers/testfastqread.h; sourceTree = SOURCE_ROOT; }; 481623E11B56A2DB004C60B7 /* pcrseqscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pcrseqscommand.cpp; path = source/commands/pcrseqscommand.cpp; sourceTree = SOURCE_ROOT; }; 481623E31B58267D004C60B7 /* INSTALL.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = INSTALL.md; sourceTree = SOURCE_ROOT; }; 481FB5191AC0A63E0076CFF3 /* TestMothur */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TestMothur; sourceTree = BUILT_PRODUCTS_DIR; }; - 481FB51B1AC0A63E0076CFF3 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; - 481FB5201AC0A6B60076CFF3 /* catch.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch.hpp; sourceTree = ""; }; + 481FB51B1AC0A63E0076CFF3 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = TestMothur/main.cpp; sourceTree = SOURCE_ROOT; }; + 481FB5201AC0A6B60076CFF3 /* catch.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch.hpp; path = TestMothur/catch.hpp; sourceTree = SOURCE_ROOT; }; 481FB5281AC19F8B0076CFF3 /* setseedcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = setseedcommand.cpp; path = source/commands/setseedcommand.cpp; sourceTree = SOURCE_ROOT; }; 481FB5291AC19F8B0076CFF3 /* setseedcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = setseedcommand.h; path = source/commands/setseedcommand.h; sourceTree = SOURCE_ROOT; }; - 481FB52D1AC1B0CB0076CFF3 /* testsetseedcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testsetseedcommand.cpp; path = testcommands/testsetseedcommand.cpp; sourceTree = ""; }; - 4827A4DA1CB3ED2100345170 /* fastqdataset.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fastqdataset.cpp; sourceTree = ""; }; - 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 = ""; }; + 481FB52D1AC1B0CB0076CFF3 /* testsetseedcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testsetseedcommand.cpp; path = TestMothur/testcommands/testsetseedcommand.cpp; sourceTree = SOURCE_ROOT; }; + 4827A4DA1CB3ED2100345170 /* fastqdataset.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fastqdataset.cpp; path = TestMothur/fastqdataset.cpp; sourceTree = SOURCE_ROOT; }; + 4827A4DB1CB3ED2100345170 /* fastqdataset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fastqdataset.h; path = TestMothur/fastqdataset.h; sourceTree = SOURCE_ROOT; }; + 4829D9651B8387D0002EEED4 /* testbiominfocommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testbiominfocommand.cpp; path = TestMothur/testbiominfocommand.cpp; sourceTree = SOURCE_ROOT; }; + 4829D9661B8387D0002EEED4 /* testbiominfocommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testbiominfocommand.h; path = TestMothur/testbiominfocommand.h; sourceTree = SOURCE_ROOT; }; + 4846AD881D3810DD00DE9913 /* testtrimoligos.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testtrimoligos.cpp; path = TestMothur/testtrimoligos.cpp; sourceTree = SOURCE_ROOT; }; + 4846AD891D3810DD00DE9913 /* testtrimoligos.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = testtrimoligos.hpp; path = TestMothur/testtrimoligos.hpp; sourceTree = SOURCE_ROOT; }; 484F21691BA1C5F8001C1B5F /* makefile-internal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "makefile-internal"; 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; }; @@ -821,41 +823,43 @@ 48844B261AA74AF9006EF2B8 /* compare.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = compare.h; path = source/datastructures/compare.h; sourceTree = SOURCE_ROOT; }; 488841631CC6C34900C5E972 /* renamefilecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = renamefilecommand.cpp; path = source/commands/renamefilecommand.cpp; sourceTree = SOURCE_ROOT; }; 488841641CC6C34900C5E972 /* renamefilecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = renamefilecommand.h; path = source/commands/renamefilecommand.h; sourceTree = SOURCE_ROOT; }; - 489B55701BCD7F0100FB7DC8 /* vsearchfileparser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = vsearchfileparser.cpp; path = source/vsearchfileparser.cpp; sourceTree = ""; }; - 489B55711BCD7F0100FB7DC8 /* vsearchfileparser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vsearchfileparser.h; path = source/vsearchfileparser.h; sourceTree = ""; }; - 48A11C6C1CDA40F0003481D8 /* testrenamefilecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testrenamefilecommand.cpp; path = testcommands/testrenamefilecommand.cpp; sourceTree = ""; }; - 48A11C6D1CDA40F0003481D8 /* testrenamefilecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testrenamefilecommand.h; path = testcommands/testrenamefilecommand.h; sourceTree = ""; }; - 48B662011BBB1B6600997EE4 /* testrenameseqscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testrenameseqscommand.cpp; path = testcommands/testrenameseqscommand.cpp; sourceTree = ""; }; - 48B662021BBB1B6600997EE4 /* testrenameseqscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testrenameseqscommand.h; path = testcommands/testrenameseqscommand.h; sourceTree = ""; }; + 48910D411D5243E500F60EDB /* mergecountcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mergecountcommand.cpp; path = source/commands/mergecountcommand.cpp; sourceTree = SOURCE_ROOT; }; + 48910D421D5243E500F60EDB /* mergecountcommand.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = mergecountcommand.hpp; path = source/commands/mergecountcommand.hpp; sourceTree = SOURCE_ROOT; }; + 489B55701BCD7F0100FB7DC8 /* vsearchfileparser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = vsearchfileparser.cpp; path = source/vsearchfileparser.cpp; sourceTree = SOURCE_ROOT; }; + 489B55711BCD7F0100FB7DC8 /* vsearchfileparser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vsearchfileparser.h; path = source/vsearchfileparser.h; sourceTree = SOURCE_ROOT; }; + 48A11C6C1CDA40F0003481D8 /* testrenamefilecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testrenamefilecommand.cpp; path = TestMothur/testcommands/testrenamefilecommand.cpp; sourceTree = SOURCE_ROOT; }; + 48A11C6D1CDA40F0003481D8 /* testrenamefilecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testrenamefilecommand.h; path = TestMothur/testcommands/testrenamefilecommand.h; sourceTree = SOURCE_ROOT; }; + 48B662011BBB1B6600997EE4 /* testrenameseqscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testrenameseqscommand.cpp; path = TestMothur/testcommands/testrenameseqscommand.cpp; sourceTree = SOURCE_ROOT; }; + 48B662021BBB1B6600997EE4 /* testrenameseqscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testrenameseqscommand.h; path = TestMothur/testcommands/testrenameseqscommand.h; sourceTree = SOURCE_ROOT; }; 48C51DEE1A76B870004ECDF1 /* fastqread.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = fastqread.h; path = source/datastructures/fastqread.h; sourceTree = SOURCE_ROOT; }; 48C51DEF1A76B888004ECDF1 /* fastqread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fastqread.cpp; path = source/datastructures/fastqread.cpp; sourceTree = SOURCE_ROOT; }; 48C51DF11A793EFE004ECDF1 /* kmeralign.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = kmeralign.cpp; path = source/datastructures/kmeralign.cpp; sourceTree = SOURCE_ROOT; }; 48C51DF21A793EFE004ECDF1 /* kmeralign.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = kmeralign.h; path = source/datastructures/kmeralign.h; sourceTree = SOURCE_ROOT; }; - 48C728641B66A77800D40830 /* testsequence.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testsequence.cpp; path = testcontainers/testsequence.cpp; sourceTree = ""; }; - 48C728681B69598400D40830 /* testmergegroupscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testmergegroupscommand.cpp; path = testcommands/testmergegroupscommand.cpp; sourceTree = ""; }; - 48C728691B69598400D40830 /* testmergegroupscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testmergegroupscommand.h; path = testcommands/testmergegroupscommand.h; sourceTree = ""; }; - 48C7286F1B6AB3B900D40830 /* testremovegroupscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testremovegroupscommand.cpp; path = testcommands/testremovegroupscommand.cpp; sourceTree = ""; }; - 48C728701B6AB3B900D40830 /* testremovegroupscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testremovegroupscommand.h; path = testcommands/testremovegroupscommand.h; sourceTree = ""; }; - 48C728731B6AB4CD00D40830 /* testgetgroupscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testgetgroupscommand.cpp; path = testcommands/testgetgroupscommand.cpp; sourceTree = ""; }; - 48C728741B6AB4CD00D40830 /* testgetgroupscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testgetgroupscommand.h; path = testcommands/testgetgroupscommand.h; sourceTree = ""; }; - 48C728761B6AB4EE00D40830 /* testsequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testsequence.h; path = testcontainers/testsequence.h; sourceTree = ""; }; + 48C728641B66A77800D40830 /* testsequence.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testsequence.cpp; path = TestMothur/testcontainers/testsequence.cpp; sourceTree = SOURCE_ROOT; }; + 48C728681B69598400D40830 /* testmergegroupscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testmergegroupscommand.cpp; path = TestMothur/testcommands/testmergegroupscommand.cpp; sourceTree = SOURCE_ROOT; }; + 48C728691B69598400D40830 /* testmergegroupscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testmergegroupscommand.h; path = TestMothur/testcommands/testmergegroupscommand.h; sourceTree = SOURCE_ROOT; }; + 48C7286F1B6AB3B900D40830 /* testremovegroupscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testremovegroupscommand.cpp; path = TestMothur/testcommands/testremovegroupscommand.cpp; sourceTree = SOURCE_ROOT; }; + 48C728701B6AB3B900D40830 /* testremovegroupscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testremovegroupscommand.h; path = TestMothur/testcommands/testremovegroupscommand.h; sourceTree = SOURCE_ROOT; }; + 48C728731B6AB4CD00D40830 /* testgetgroupscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testgetgroupscommand.cpp; path = TestMothur/testcommands/testgetgroupscommand.cpp; sourceTree = SOURCE_ROOT; }; + 48C728741B6AB4CD00D40830 /* testgetgroupscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testgetgroupscommand.h; path = TestMothur/testcommands/testgetgroupscommand.h; sourceTree = SOURCE_ROOT; }; + 48C728761B6AB4EE00D40830 /* testsequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testsequence.h; path = TestMothur/testcontainers/testsequence.h; sourceTree = SOURCE_ROOT; }; 48C728771B728D6B00D40830 /* biominfocommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = biominfocommand.cpp; path = source/commands/biominfocommand.cpp; sourceTree = SOURCE_ROOT; }; 48C728781B728D6B00D40830 /* biominfocommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = biominfocommand.h; path = source/commands/biominfocommand.h; sourceTree = SOURCE_ROOT; }; - 48D6E9661CA42389008DF76B /* testvsearchfileparser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = testvsearchfileparser.cpp; sourceTree = ""; }; - 48D6E9671CA42389008DF76B /* testvsearchfileparser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = testvsearchfileparser.h; sourceTree = ""; }; - 48D6E9691CA4262A008DF76B /* dataset.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dataset.cpp; sourceTree = ""; }; - 48D6E96A1CA4262A008DF76B /* dataset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dataset.h; sourceTree = ""; }; + 48D6E9661CA42389008DF76B /* testvsearchfileparser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testvsearchfileparser.cpp; path = TestMothur/testvsearchfileparser.cpp; sourceTree = SOURCE_ROOT; }; + 48D6E9671CA42389008DF76B /* testvsearchfileparser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testvsearchfileparser.h; path = TestMothur/testvsearchfileparser.h; sourceTree = SOURCE_ROOT; }; + 48D6E9691CA4262A008DF76B /* dataset.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dataset.cpp; path = TestMothur/dataset.cpp; sourceTree = SOURCE_ROOT; }; + 48D6E96A1CA4262A008DF76B /* dataset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dataset.h; path = TestMothur/dataset.h; sourceTree = SOURCE_ROOT; }; 48DB37B11B3B27E000C372A4 /* makefilecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = makefilecommand.cpp; path = source/commands/makefilecommand.cpp; sourceTree = SOURCE_ROOT; }; 48DB37B21B3B27E000C372A4 /* makefilecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = makefilecommand.h; path = source/commands/makefilecommand.h; sourceTree = SOURCE_ROOT; }; - 48EDB76A1D1320DD00F76E93 /* chimeravsearchcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = chimeravsearchcommand.cpp; path = source/commands/chimeravsearchcommand.cpp; sourceTree = ""; }; - 48EDB76B1D1320DD00F76E93 /* chimeravsearchcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = chimeravsearchcommand.h; path = source/commands/chimeravsearchcommand.h; sourceTree = ""; }; + 48EDB76A1D1320DD00F76E93 /* chimeravsearchcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = chimeravsearchcommand.cpp; path = source/commands/chimeravsearchcommand.cpp; sourceTree = SOURCE_ROOT; }; + 48EDB76B1D1320DD00F76E93 /* chimeravsearchcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = chimeravsearchcommand.h; path = source/commands/chimeravsearchcommand.h; sourceTree = SOURCE_ROOT; }; 48F98E4C1A9CFD670005E81B /* completelinkage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = completelinkage.cpp; path = source/completelinkage.cpp; sourceTree = SOURCE_ROOT; }; 7B2181FE17AD777B00286E6A /* classifysvmsharedcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = classifysvmsharedcommand.cpp; path = source/commands/classifysvmsharedcommand.cpp; sourceTree = SOURCE_ROOT; }; 7B2181FF17AD777B00286E6A /* classifysvmsharedcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = classifysvmsharedcommand.h; path = source/commands/classifysvmsharedcommand.h; sourceTree = SOURCE_ROOT; }; 7B21820117AD77BD00286E6A /* svm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = svm.cpp; path = source/svm/svm.cpp; sourceTree = SOURCE_ROOT; }; 7B21820217AD77BD00286E6A /* svm.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = svm.hpp; path = source/svm/svm.hpp; sourceTree = SOURCE_ROOT; }; - 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 = ""; }; + 7E6BE10812F710D8007ADDBE /* refchimeratest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = refchimeratest.h; path = source/refchimeratest.h; sourceTree = SOURCE_ROOT; }; + 7E6BE10912F710D8007ADDBE /* refchimeratest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = refchimeratest.cpp; path = source/refchimeratest.cpp; sourceTree = SOURCE_ROOT; }; 7E78911B135F3E8600E725D2 /* eachgapdistignorens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = eachgapdistignorens.h; path = source/calculators/eachgapdistignorens.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; }; @@ -931,8 +935,8 @@ A7730EFE13967241007433A3 /* countseqscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = countseqscommand.cpp; path = source/commands/countseqscommand.cpp; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; A774101214695AF60098E6AC /* shhhseqscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = shhhseqscommand.h; path = source/commands/shhhseqscommand.h; sourceTree = SOURCE_ROOT; }; A774101314695AF60098E6AC /* shhhseqscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = shhhseqscommand.cpp; path = source/commands/shhhseqscommand.cpp; sourceTree = SOURCE_ROOT; }; - A774104614696F320098E6AC /* myseqdist.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = myseqdist.cpp; path = source/myseqdist.cpp; sourceTree = ""; }; - A774104714696F320098E6AC /* myseqdist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = myseqdist.h; path = source/myseqdist.h; sourceTree = ""; }; + A774104614696F320098E6AC /* myseqdist.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = myseqdist.cpp; path = source/myseqdist.cpp; sourceTree = SOURCE_ROOT; }; + A774104714696F320098E6AC /* myseqdist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = myseqdist.h; path = source/myseqdist.h; sourceTree = SOURCE_ROOT; }; A77410F414697C300098E6AC /* seqnoise.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = seqnoise.cpp; path = source/seqnoise.cpp; sourceTree = ""; }; A77410F514697C300098E6AC /* seqnoise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = seqnoise.h; path = source/seqnoise.h; sourceTree = ""; }; A778FE69134CA6CA00C0BA33 /* getcommandinfocommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = getcommandinfocommand.h; path = source/commands/getcommandinfocommand.h; sourceTree = SOURCE_ROOT; }; @@ -1964,12 +1968,14 @@ A7E6F69D17427D06006775E2 /* makelookupcommand.cpp */, A7E9B74A12D37EC400DA6239 /* matrixoutputcommand.h */, A7E9B74912D37EC400DA6239 /* matrixoutputcommand.cpp */, - 48705ABF19BE32C50075E977 /* mergesfffilecommand.cpp */, - 48705AC019BE32C50075E977 /* mergesfffilecommand.h */, + 48910D411D5243E500F60EDB /* mergecountcommand.cpp */, + 48910D421D5243E500F60EDB /* mergecountcommand.hpp */, A7E9B75412D37EC400DA6239 /* mergefilecommand.h */, A7E9B75312D37EC400DA6239 /* mergefilecommand.cpp */, A71FE12A12EDF72400963CA7 /* mergegroupscommand.h */, A71FE12B12EDF72400963CA7 /* mergegroupscommand.cpp */, + 48705AC019BE32C50075E977 /* mergesfffilecommand.h */, + 48705ABF19BE32C50075E977 /* mergesfffilecommand.cpp */, A799314816CBD0BC0017E888 /* mergetaxsummarycommand.h */, A799314A16CBD0CD0017E888 /* mergetaxsummarycommand.cpp */, A7E9B75812D37EC400DA6239 /* metastatscommand.h */, @@ -2666,6 +2672,7 @@ 481FB6881AC1B8B80076CFF3 /* weightedlinkage.cpp in Sources */, 480E8DB21CAB1F5E00A0D137 /* vsearchfileparser.cpp in Sources */, 481FB61E1AC1B7AC0076CFF3 /* unifracweightedcommand.cpp in Sources */, + 48910D441D5243E500F60EDB /* mergecountcommand.cpp in Sources */, 481FB5951AC1B71B0076CFF3 /* chimerabellerophoncommand.cpp in Sources */, 481FB68D1AC1BA9E0076CFF3 /* classify.cpp in Sources */, 481FB65F1AC1B8450076CFF3 /* myseqdist.cpp in Sources */, @@ -3011,6 +3018,7 @@ A7E9B8C512D37EC400DA6239 /* fileoutput.cpp in Sources */, A7E9B8C612D37EC400DA6239 /* filterseqscommand.cpp in Sources */, A7E9B8C812D37EC400DA6239 /* flowdata.cpp in Sources */, + 48910D431D5243E500F60EDB /* mergecountcommand.cpp in Sources */, A7E9B8C912D37EC400DA6239 /* formatcolumn.cpp in Sources */, A7E9B8CA12D37EC400DA6239 /* formatphylip.cpp in Sources */, A7E9B8CB12D37EC400DA6239 /* fullmatrix.cpp in Sources */, diff --git a/source/commandfactory.cpp b/source/commandfactory.cpp index bec2db3c..259ad5c9 100644 --- a/source/commandfactory.cpp +++ b/source/commandfactory.cpp @@ -152,6 +152,7 @@ #include "biominfocommand.h" #include "renamefilecommand.h" #include "chimeravsearchcommand.h" +#include "mergecountcommand.hpp" //needed for testing project //CommandFactory* CommandFactory::_uniqueInstance; @@ -327,6 +328,7 @@ CommandFactory::CommandFactory(){ commands["biom.info"] = "biom.info"; commands["set.seed"] = "set.seed"; commands["rename.file"] = "rename.file"; + commands["merge.count"] = "merge.count"; } @@ -526,6 +528,7 @@ Command* CommandFactory::getCommand(string commandName, string optionString){ else if(commandName == "corr.axes") { command = new CorrAxesCommand(optionString); } else if(commandName == "remove.rare") { command = new RemoveRareCommand(optionString); } else if(commandName == "merge.groups") { command = new MergeGroupsCommand(optionString); } + else if(commandName == "merge.count") { command = new MergeCountCommand(optionString); } else if(commandName == "amova") { command = new AmovaCommand(optionString); } else if(commandName == "homova") { command = new HomovaCommand(optionString); } else if(commandName == "mantel") { command = new MantelCommand(optionString); } @@ -699,6 +702,7 @@ Command* CommandFactory::getCommand(string commandName, string optionString, str else if(commandName == "corr.axes") { pipecommand = new CorrAxesCommand(optionString); } else if(commandName == "remove.rare") { pipecommand = new RemoveRareCommand(optionString); } else if(commandName == "merge.groups") { pipecommand = new MergeGroupsCommand(optionString); } + else if(commandName == "merge.count") { pipecommand = new MergeCountCommand(optionString); } else if(commandName == "amova") { pipecommand = new AmovaCommand(optionString); } else if(commandName == "homova") { pipecommand = new HomovaCommand(optionString); } else if(commandName == "mantel") { pipecommand = new MantelCommand(optionString); } @@ -858,6 +862,7 @@ Command* CommandFactory::getCommand(string commandName){ else if(commandName == "corr.axes") { shellcommand = new CorrAxesCommand(); } else if(commandName == "remove.rare") { shellcommand = new RemoveRareCommand(); } else if(commandName == "merge.groups") { shellcommand = new MergeGroupsCommand(); } + else if(commandName == "merge.count") { shellcommand = new MergeCountCommand(); } else if(commandName == "amova") { shellcommand = new AmovaCommand(); } else if(commandName == "homova") { shellcommand = new HomovaCommand(); } else if(commandName == "mantel") { shellcommand = new MantelCommand(); } @@ -973,11 +978,15 @@ bool CommandFactory::isValidCommand(string command, string noError) { /***********************************************************************/ void CommandFactory::printCommands(ostream& out) { try { - out << "Valid commands are: "; - for (it = commands.begin(); it != commands.end(); it++) { - out << it->first << ","; + it = commands.begin(); + out << "Valid commands are: " << it->first << ", "; + it++; + out << it->first; + it++; + for (; it != commands.end(); it++) { + out << ", " << it->first; } - out << endl; + out << "." << endl; } catch(exception& e) { m->errorOut(e, "CommandFactory", "printCommands"); diff --git a/source/commands/clustercommand.cpp b/source/commands/clustercommand.cpp index 1c0de93d..652355dd 100644 --- a/source/commands/clustercommand.cpp +++ b/source/commands/clustercommand.cpp @@ -30,8 +30,7 @@ vector ClusterCommand::setParameters(){ CommandParameter pshowabund("showabund", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(pshowabund); CommandParameter ptiming("timing", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(ptiming); CommandParameter psim("sim", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(psim); - CommandParameter phard("hard", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(phard); - CommandParameter pseed("seed", "Number", "", "0", "", "", "","",false,false); parameters.push_back(pseed); + CommandParameter pseed("seed", "Number", "", "0", "", "", "","",false,false); parameters.push_back(pseed); CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir); //CommandParameter padjust("adjust", "String", "", "F", "", "", "","",false,false); parameters.push_back(padjust); CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir); @@ -49,7 +48,7 @@ vector ClusterCommand::setParameters(){ string ClusterCommand::getHelpString(){ try { string helpString = ""; - helpString += "The cluster command parameter options are phylip, column, name, count, method, cuttoff, hard, precision, sim, showabund and timing. Fasta or Phylip or column and name are required.\n"; + helpString += "The cluster command parameter options are phylip, column, name, count, method, cutoff, precision, sim, showabund and timing. Fasta or Phylip or column and name are required.\n"; //helpString += "The adjust parameter is used to handle missing distances. If you set a cutoff, adjust=f by default. If not, adjust=t by default. Adjust=f, means ignore missing distances and adjust cutoff as needed with the average neighbor method. Adjust=t, will treat missing distances as 1.0. You can also set the value the missing distances should be set to, adjust=0.5 would give missing distances a value of 0.5.\n"; helpString += "The phylip and column parameter allow you to enter your distance file. \n"; helpString += "The fasta parameter allows you to enter your fasta file for use with the agc or dgc methods. \n"; @@ -249,10 +248,7 @@ ClusterCommand::ClusterCommand(string option) { if (temp == "not found") { temp = "100"; } //saves precision legnth for formatting below length = temp.length(); - m->mothurConvert(temp, precision); - - temp = validParameter.validFile(parameters, "hard", false); if (temp == "not found") { temp = "T"; } - hard = m->isTrue(temp); + m->mothurConvert(temp, precision); temp = validParameter.validFile(parameters, "sim", false); if (temp == "not found") { temp = "F"; } sim = m->isTrue(temp); @@ -282,7 +278,6 @@ ClusterCommand::ClusterCommand(string option) { if (temp == "not found") { temp = "10"; } //else { cutoffSet = true; } m->mothurConvert(temp, cutoff); - if ((method != "agc") && (method != "dgc")) { cutoff += (5 / (precision * 10.0)); } showabund = validParameter.validFile(parameters, "showabund", false); if (showabund == "not found") { showabund = "T"; } @@ -315,9 +310,7 @@ int ClusterCommand::execute(){ else if (countfile != "") { inputString += ", count=" + countfile; } inputString += ", precision=" + toString(precision); inputString += ", method=" + method; - if (hard) { inputString += ", hard=T"; } - else { inputString += ", hard=F"; } - if (sim) { inputString += ", sim=T"; } + if (sim) { inputString += ", sim=T"; } else { inputString += ", sim=F"; } @@ -689,12 +682,7 @@ int ClusterCommand::runMothurCluster(){ cluster->update(cutoff); float dist = matrix->getSmallDist(); - float rndDist; - if (hard) { - rndDist = m->ceilDist(dist, precision); - }else{ - rndDist = m->roundDist(dist, precision); - } + float rndDist = m->ceilDist(dist, precision); if(previousDist <= 0.0000 && dist != previousDist){ printData("unique", counts); @@ -733,10 +721,8 @@ int ClusterCommand::runMothurCluster(){ } listFile.close(); - if (saveCutoff != cutoff) { - if (hard) { saveCutoff = m->ceilDist(saveCutoff, precision); } - else { saveCutoff = m->roundDist(saveCutoff, precision); } - + if (saveCutoff != cutoff) { + saveCutoff = m->ceilDist(saveCutoff, precision); m->mothurOut("changed cutoff to " + toString(cutoff)); m->mothurOutEndLine(); } diff --git a/source/commands/clustercommand.h b/source/commands/clustercommand.h index e55cf3d8..d4f0c8c4 100644 --- a/source/commands/clustercommand.h +++ b/source/commands/clustercommand.h @@ -52,7 +52,7 @@ class ClusterCommand : public Command { RAbundVector oldRAbund; ListVector oldList; - bool abort, hard, sim; + bool abort, sim; string method, fileroot, tag, outputDir, phylipfile, columnfile, namefile, format, distfile, countfile, fastafile, inputDir, vsearchLocation; double cutoff; diff --git a/source/commands/clusterdoturcommand.cpp b/source/commands/clusterdoturcommand.cpp index b4a4fdab..695e9a7a 100644 --- a/source/commands/clusterdoturcommand.cpp +++ b/source/commands/clusterdoturcommand.cpp @@ -19,7 +19,6 @@ vector ClusterDoturCommand::setParameters(){ CommandParameter pcutoff("cutoff", "Number", "", "10", "", "", "","",false,false,true); parameters.push_back(pcutoff); CommandParameter pprecision("precision", "Number", "", "100", "", "", "","",false,false); parameters.push_back(pprecision); CommandParameter pmethod("method", "Multiple", "furthest-nearest-average-weighted", "average", "", "", "","",false,false); parameters.push_back(pmethod); - CommandParameter phard("hard", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(phard); CommandParameter psim("sim", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(psim); CommandParameter pseed("seed", "Number", "", "0", "", "", "","",false,false); parameters.push_back(pseed); CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir); @@ -39,7 +38,7 @@ string ClusterDoturCommand::getHelpString(){ try { string helpString = ""; helpString += "The cluster.classic command clusters using the algorithm from dotur. \n"; - helpString += "The cluster.classic command parameter options are phylip, name, count, method, cuttoff, hard, sim, precision. Phylip is required, unless you have a valid current file.\n"; + helpString += "The cluster.classic command parameter options are phylip, name, count, method, cuttoff, sim, precision. Phylip is required, unless you have a valid current file.\n"; helpString += "The cluster.classic command should be in the following format: \n"; helpString += "cluster.classic(phylip=yourDistanceMatrix, method=yourMethod, cutoff=yourCutoff, precision=yourPrecision) \n"; helpString += "The acceptable cluster methods are furthest, nearest, weighted and average. If no method is provided then average is assumed.\n"; @@ -183,11 +182,7 @@ ClusterDoturCommand::ClusterDoturCommand(string option) { temp = validParameter.validFile(parameters, "cutoff", false); if (temp == "not found") { temp = "10"; } - m->mothurConvert(temp, cutoff); - cutoff += (5 / (precision * 10.0)); - - temp = validParameter.validFile(parameters, "hard", false); if (temp == "not found") { temp = "T"; } - hard = m->isTrue(temp); + m->mothurConvert(temp, cutoff); temp = validParameter.validFile(parameters, "sim", false); if (temp == "not found") { temp = "F"; } sim = m->isTrue(temp); @@ -280,12 +275,7 @@ int ClusterDoturCommand::execute(){ cluster->update(cutoff); float dist = cluster->getSmallDist(); - float rndDist; - if (hard) { - rndDist = m->ceilDist(dist, precision); - }else{ - rndDist = m->roundDist(dist, precision); - } + float rndDist = m->ceilDist(dist, precision); if(previousDist <= 0.0000 && dist != previousDist){ printData("unique", counts); diff --git a/source/commands/clusterdoturcommand.h b/source/commands/clusterdoturcommand.h index 1cf1e1d1..9bc47752 100644 --- a/source/commands/clusterdoturcommand.h +++ b/source/commands/clusterdoturcommand.h @@ -37,7 +37,7 @@ class ClusterDoturCommand : public Command { void help() { m->mothurOut(getHelpString()); } private: - bool abort, hard, sim; + bool abort, sim; string method, fileroot, tag, outputDir, phylipfile, namefile, countfile; double cutoff; int precision, length; diff --git a/source/commands/clustersplitcommand.cpp b/source/commands/clustersplitcommand.cpp index 41f61b70..dd68d514 100644 --- a/source/commands/clustersplitcommand.cpp +++ b/source/commands/clustersplitcommand.cpp @@ -31,7 +31,6 @@ vector ClusterSplitCommand::setParameters(){ CommandParameter pcutoff("cutoff", "Number", "", "0.25", "", "", "","",false,false,true); parameters.push_back(pcutoff); CommandParameter pprecision("precision", "Number", "", "100", "", "", "","",false,false); parameters.push_back(pprecision); CommandParameter pmethod("method", "Multiple", "furthest-nearest-average-weighted-agc-dgc", "average", "", "", "","",false,false,true); parameters.push_back(pmethod); - CommandParameter phard("hard", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(phard); CommandParameter pislist("islist", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(pislist); CommandParameter pclassic("classic", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(pclassic); CommandParameter pseed("seed", "Number", "", "0", "", "", "","",false,false); parameters.push_back(pseed); @@ -51,7 +50,7 @@ vector ClusterSplitCommand::setParameters(){ string ClusterSplitCommand::getHelpString(){ try { string helpString = ""; - helpString += "The cluster.split command parameter options are file, fasta, phylip, column, name, count, cutoff, precision, method, splitmethod, taxonomy, taxlevel, showabund, timing, hard, large, cluster, processors. Fasta or Phylip or column and name are required.\n"; + helpString += "The cluster.split command parameter options are file, fasta, phylip, column, name, count, cutoff, precision, method, splitmethod, taxonomy, taxlevel, showabund, timing, large, cluster, processors. Fasta or Phylip or column and name are required.\n"; helpString += "The cluster.split command can split your files in 3 ways. Splitting by distance file, by classification, or by classification also using a fasta file. \n"; helpString += "For the distance file method, you need only provide your distance file and mothur will split the file into distinct groups. \n"; helpString += "For the classification method, you need to provide your distance file and taxonomy file, and set the splitmethod to classify. \n"; @@ -325,9 +324,6 @@ ClusterSplitCommand::ClusterSplitCommand(string option) { length = temp.length(); m->mothurConvert(temp, precision); - temp = validParameter.validFile(parameters, "hard", false); if (temp == "not found") { temp = "T"; } - hard = m->isTrue(temp); - temp = validParameter.validFile(parameters, "large", false); if (temp == "not found") { temp = "F"; } large = m->isTrue(temp); @@ -367,7 +363,6 @@ ClusterSplitCommand::ClusterSplitCommand(string option) { cutoffNotSet = false; temp = validParameter.validFile(parameters, "cutoff", false); if (temp == "not found") { cutoffNotSet = true; temp = "0.25"; } m->mothurConvert(temp, cutoff); - if ((method != "agc") && (method != "dgc")) { cutoff += (5 / (precision * 10.0)); } if ((splitmethod == "distance") || (splitmethod == "classify") || (splitmethod == "fasta")) { } else { m->mothurOut("[ERROR]: " + splitmethod + " is not a valid splitting method. Valid splitting algorithms are distance, classify or fasta."); m->mothurOutEndLine(); abort = true; } @@ -1147,13 +1142,8 @@ string ClusterSplitCommand::clusterClassicFile(string thisDistFile, string thisN cluster->update(cutoff); float dist = cluster->getSmallDist(); - float rndDist; - if (hard) { - rndDist = m->ceilDist(dist, precision); - }else{ - rndDist = m->roundDist(dist, precision); - } - + float rndDist = m->ceilDist(dist, precision); + if(previousDist <= 0.0000 && dist != previousDist){ oldList.setLabel("unique"); oldList.print(listFile); @@ -1286,12 +1276,7 @@ string ClusterSplitCommand::clusterFile(string thisDistFile, string thisNamefile cluster->update(saveCutoff); float dist = matrix->getSmallDist(); - float rndDist; - if (hard) { - rndDist = m->ceilDist(dist, precision); - }else{ - rndDist = m->roundDist(dist, precision); - } + float rndDist = m->ceilDist(dist, precision); if(previousDist <= 0.0000 && dist != previousDist){ oldList.setLabel("unique"); @@ -1336,9 +1321,7 @@ string ClusterSplitCommand::clusterFile(string thisDistFile, string thisNamefile } if (saveCutoff != cutoff) { - if (hard) { saveCutoff = m->ceilDist(saveCutoff, precision); } - else { saveCutoff = m->roundDist(saveCutoff, precision); } - + saveCutoff = m->ceilDist(saveCutoff, precision); m->mothurOut("Cutoff was " + toString(cutoff) + " changed cutoff to " + toString(saveCutoff)); m->mothurOutEndLine(); } diff --git a/source/commands/clustersplitcommand.h b/source/commands/clustersplitcommand.h index 811c27f9..53964098 100644 --- a/source/commands/clustersplitcommand.h +++ b/source/commands/clustersplitcommand.h @@ -51,7 +51,7 @@ class ClusterSplitCommand : public Command { string file, method, fileroot, tag, outputDir, phylipfile, columnfile, namefile, countfile, distfile, format, showabund, timing, splitmethod, taxFile, fastafile, inputDir, vsearchLocation; double cutoff, splitcutoff; int precision, length, processors, taxLevelCutoff; - bool print_start, abort, hard, large, classic, runCluster, deleteFiles, isList, cutoffNotSet; + bool print_start, abort, large, classic, runCluster, deleteFiles, isList, cutoffNotSet; time_t start; ofstream outList, outRabund, outSabund; diff --git a/source/commands/command.hpp b/source/commands/command.hpp index 37186529..bb23311d 100644 --- a/source/commands/command.hpp +++ b/source/commands/command.hpp @@ -87,7 +87,13 @@ class Command { if (filename.length() > 0) { //rip off last "." filename = filename.substr(0, filename.length()-1); } - filename += it->second + "."; + filename += it->second + "."; + }else if ((it->first == "[group]") || (it->first == "[tag]")) { + string group = it->second; + for (int j = 0; j < group.length(); j++) { + if (group[j] == '-') { group[j] = '_'; } + } + filename += group + "."; }else { filename += it->second + "."; } } } diff --git a/source/commands/getmimarkspackagecommand.cpp b/source/commands/getmimarkspackagecommand.cpp index e05d42cc..f298eca5 100644 --- a/source/commands/getmimarkspackagecommand.cpp +++ b/source/commands/getmimarkspackagecommand.cpp @@ -589,7 +589,7 @@ set GetMIMarksPackageCommand::createGroupNames(Oligos& oligos) { //overwrite global oligos - assume fastq data like make.contigs Oligos oligos; if ((fileOption == 3) || (fileOption == 5)) { oligos.read(oligosfile, false); } //like make.contigs - else { oligos.read(oligosfile); } + else { oligos.read(oligosfile, false); } map barcodes = oligos.getPairedBarcodes(); map primers = oligos.getPairedPrimers(); diff --git a/source/commands/helpcommand.cpp b/source/commands/helpcommand.cpp index ef54dae9..87165675 100644 --- a/source/commands/helpcommand.cpp +++ b/source/commands/helpcommand.cpp @@ -8,19 +8,334 @@ */ #include "helpcommand.h" +#include "command.hpp" +#include "clustercommand.h" +#include "collectcommand.h" +#include "collectsharedcommand.h" +#include "getgroupcommand.h" +#include "getlabelcommand.h" +#include "rarefactcommand.h" +#include "summarycommand.h" +#include "summarysharedcommand.h" +#include "rarefactsharedcommand.h" +#include "quitcommand.h" +#include "helpcommand.h" +#include "commandfactory.hpp" +#include "deconvolutecommand.h" +#include "parsimonycommand.h" +#include "unifracunweightedcommand.h" +#include "unifracweightedcommand.h" +#include "libshuffcommand.h" +#include "heatmapcommand.h" +#include "heatmapsimcommand.h" +#include "filterseqscommand.h" +#include "venncommand.h" +#include "nocommands.h" +#include "binsequencecommand.h" +#include "getoturepcommand.h" +#include "treegroupscommand.h" +#include "distancecommand.h" +#include "aligncommand.h" +#include "matrixoutputcommand.h" +#include "getsabundcommand.h" +#include "getrabundcommand.h" +#include "seqsummarycommand.h" +#include "screenseqscommand.h" +#include "reversecommand.h" +#include "trimseqscommand.h" +#include "mergefilecommand.h" +#include "listseqscommand.h" +#include "getseqscommand.h" +#include "removeseqscommand.h" +#include "systemcommand.h" +#include "secondarystructurecommand.h" +#include "getsharedotucommand.h" +#include "getlistcountcommand.h" +#include "classifyseqscommand.h" +#include "phylotypecommand.h" +#include "mgclustercommand.h" +#include "preclustercommand.h" +#include "pcoacommand.h" +#include "otuhierarchycommand.h" +#include "setdircommand.h" +#include "parselistscommand.h" +#include "chimeraccodecommand.h" +#include "chimeracheckcommand.h" +#include "chimeraslayercommand.h" +#include "chimerapintailcommand.h" +#include "chimerabellerophoncommand.h" +#include "chimerauchimecommand.h" +#include "setlogfilecommand.h" +#include "phylodiversitycommand.h" +#include "makegroupcommand.h" +#include "chopseqscommand.h" +#include "clearcutcommand.h" +#include "catchallcommand.h" +#include "splitabundcommand.h" +#include "clustersplitcommand.h" +#include "classifyotucommand.h" +#include "degapseqscommand.h" +#include "getrelabundcommand.h" +#include "sensspeccommand.h" +#include "sffinfocommand.h" +#include "seqerrorcommand.h" +#include "normalizesharedcommand.h" +#include "metastatscommand.h" +#include "splitgroupscommand.h" +#include "clusterfragmentscommand.h" +#include "getlineagecommand.h" +#include "removelineagecommand.h" +#include "parsefastaqcommand.h" +#include "deuniqueseqscommand.h" +#include "pairwiseseqscommand.h" +#include "clusterdoturcommand.h" +#include "subsamplecommand.h" +#include "removegroupscommand.h" +#include "getgroupscommand.h" +#include "indicatorcommand.h" +#include "consensusseqscommand.h" +#include "trimflowscommand.h" +#include "corraxescommand.h" +#include "shhhercommand.h" +#include "pcacommand.h" +#include "nmdscommand.h" +#include "removerarecommand.h" +#include "mergegroupscommand.h" +#include "amovacommand.h" +#include "homovacommand.h" +#include "mantelcommand.h" +#include "makefastqcommand.h" +#include "anosimcommand.h" +#include "getcurrentcommand.h" +#include "setcurrentcommand.h" +#include "sharedcommand.h" +#include "getcommandinfocommand.h" +#include "deuniquetreecommand.h" +#include "countseqscommand.h" +#include "countgroupscommand.h" +#include "summarytaxcommand.h" +#include "chimeraperseuscommand.h" +#include "shhhseqscommand.h" +#include "summaryqualcommand.h" +#include "otuassociationcommand.h" +#include "sortseqscommand.h" +#include "classifytreecommand.h" +#include "cooccurrencecommand.h" +#include "pcrseqscommand.h" +#include "createdatabasecommand.h" +#include "makebiomcommand.h" +#include "getcoremicrobiomecommand.h" +#include "listotulabelscommand.h" +#include "getotulabelscommand.h" +#include "removeotulabelscommand.h" +#include "makecontigscommand.h" +#include "sffmultiplecommand.h" +#include "classifysvmsharedcommand.h" +#include "classifyrfsharedcommand.h" +#include "filtersharedcommand.h" +#include "primerdesigncommand.h" +#include "getdistscommand.h" +#include "removedistscommand.h" +#include "mergetaxsummarycommand.h" +#include "getmetacommunitycommand.h" +#include "sparcccommand.h" +#include "makelookupcommand.h" +#include "renameseqscommand.h" +#include "makelefsecommand.h" +#include "lefsecommand.h" +#include "kruskalwalliscommand.h" +#include "sracommand.h" +#include "mergesfffilecommand.h" +#include "getmimarkspackagecommand.h" +#include "mimarksattributescommand.h" +#include "setseedcommand.h" +#include "makefilecommand.h" +#include "biominfocommand.h" +#include "renamefilecommand.h" +#include "chimeravsearchcommand.h" +#include "mergecountcommand.hpp" + //********************************************************************************************************************** HelpCommand::HelpCommand(string option) { - validCommands = CommandFactory::getInstance(); + validCommands = CommandFactory::getInstance(); + + abort = false; calledHelp = false; + + //allow user to run help + if(option == "help") { help(); abort = true; calledHelp = true; } + else if(option == "citation") { citation(); abort = true; calledHelp = true;} + + commandName = option; + } //********************************************************************************************************************** int HelpCommand::execute(){ try { - validCommands->printCommands(cout); - m->mothurOut("For more information about a specific command type 'commandName(help)' i.e. 'read.dist(help)'"); m->mothurOutEndLine(); - - m->mothurOutEndLine(); m->mothurOut("For further assistance please refer to the Mothur manual on our wiki at http://www.mothur.org/wiki, or contact Pat Schloss at mothur.bugs@gmail.com.\n"); + if (commandName != "") { + if (validCommands->isValidCommand(commandName)) { + Command* command; + string optionString = "help"; + + if(commandName == "cluster") { command = new ClusterCommand(optionString); } + else if(commandName == "unique.seqs") { command = new DeconvoluteCommand(optionString); } + else if(commandName == "parsimony") { command = new ParsimonyCommand(optionString); } + else if(commandName == "help") { command = new HelpCommand(optionString); } + else if(commandName == "quit") { command = new QuitCommand(optionString); } + else if(commandName == "collect.single") { command = new CollectCommand(optionString); } + else if(commandName == "collect.shared") { command = new CollectSharedCommand(optionString); } + else if(commandName == "rarefaction.single") { command = new RareFactCommand(optionString); } + else if(commandName == "rarefaction.shared") { command = new RareFactSharedCommand(optionString); } + else if(commandName == "summary.single") { command = new SummaryCommand(optionString); } + else if(commandName == "summary.shared") { command = new SummarySharedCommand(optionString); } + else if(commandName == "unifrac.weighted") { command = new UnifracWeightedCommand(optionString); } + else if(commandName == "unifrac.unweighted") { command = new UnifracUnweightedCommand(optionString); } + else if(commandName == "get.group") { command = new GetgroupCommand(optionString); } + else if(commandName == "get.label") { command = new GetlabelCommand(optionString); } + else if(commandName == "get.sabund") { command = new GetSAbundCommand(optionString); } + else if(commandName == "get.rabund") { command = new GetRAbundCommand(optionString); } + else if(commandName == "libshuff") { command = new LibShuffCommand(optionString); } + else if(commandName == "heatmap.bin") { command = new HeatMapCommand(optionString); } + else if(commandName == "heatmap.sim") { command = new HeatMapSimCommand(optionString); } + else if(commandName == "filter.seqs") { command = new FilterSeqsCommand(optionString); } + else if(commandName == "venn") { command = new VennCommand(optionString); } + else if(commandName == "bin.seqs") { command = new BinSeqCommand(optionString); } + else if(commandName == "get.oturep") { command = new GetOTURepCommand(optionString); } + else if(commandName == "tree.shared") { command = new TreeGroupCommand(optionString); } + else if(commandName == "dist.shared") { command = new MatrixOutputCommand(optionString); } + else if(commandName == "dist.seqs") { command = new DistanceCommand(optionString); } + else if(commandName == "align.seqs") { command = new AlignCommand(optionString); } + else if(commandName == "summary.seqs") { command = new SeqSummaryCommand(optionString); } + else if(commandName == "screen.seqs") { command = new ScreenSeqsCommand(optionString); } + else if(commandName == "reverse.seqs") { command = new ReverseSeqsCommand(optionString); } + else if(commandName == "trim.seqs") { command = new TrimSeqsCommand(optionString); } + else if(commandName == "trim.flows") { command = new TrimFlowsCommand(optionString); } + else if(commandName == "shhh.flows") { command = new ShhherCommand(optionString); } + else if(commandName == "list.seqs") { command = new ListSeqsCommand(optionString); } + else if(commandName == "get.seqs") { command = new GetSeqsCommand(optionString); } + else if(commandName == "remove.seqs") { command = new RemoveSeqsCommand(optionString); } + else if(commandName == "merge.files") { command = new MergeFileCommand(optionString); } + else if(commandName == "system") { command = new SystemCommand(optionString); } + else if(commandName == "align.check") { command = new AlignCheckCommand(optionString); } + else if(commandName == "get.sharedseqs") { command = new GetSharedOTUCommand(optionString); } + else if(commandName == "get.otulist") { command = new GetListCountCommand(optionString); } + else if(commandName == "classify.seqs") { command = new ClassifySeqsCommand(optionString); } + else if(commandName == "chimera.ccode") { command = new ChimeraCcodeCommand(optionString); } + else if(commandName == "chimera.check") { command = new ChimeraCheckCommand(optionString); } + else if(commandName == "chimera.slayer") { command = new ChimeraSlayerCommand(optionString); } + else if(commandName == "chimera.uchime") { command = new ChimeraUchimeCommand(optionString); } + else if(commandName == "chimera.pintail") { command = new ChimeraPintailCommand(optionString); } + else if(commandName == "chimera.bellerophon") { command = new ChimeraBellerophonCommand(optionString); } + else if(commandName == "chimera.vsearch") { command = new ChimeraVsearchCommand(optionString); } + else if(commandName == "phylotype") { command = new PhylotypeCommand(optionString); } + else if(commandName == "mgcluster") { command = new MGClusterCommand(optionString); } + else if(commandName == "pre.cluster") { command = new PreClusterCommand(optionString); } + else if(commandName == "pcoa") { command = new PCOACommand(optionString); } + else if(commandName == "pca") { command = new PCACommand(optionString); } + else if(commandName == "nmds") { command = new NMDSCommand(optionString); } + else if(commandName == "otu.hierarchy") { command = new OtuHierarchyCommand(optionString); } + else if(commandName == "set.dir") { command = new SetDirectoryCommand(optionString); } + else if(commandName == "set.logfile") { command = new SetLogFileCommand(optionString); } + else if(commandName == "parse.list") { command = new ParseListCommand(optionString); } + else if(commandName == "phylo.diversity") { command = new PhyloDiversityCommand(optionString); } + else if(commandName == "make.group") { command = new MakeGroupCommand(optionString); } + else if(commandName == "chop.seqs") { command = new ChopSeqsCommand(optionString); } + else if(commandName == "clearcut") { command = new ClearcutCommand(optionString); } + else if(commandName == "catchall") { command = new CatchAllCommand(optionString); } + else if(commandName == "split.abund") { command = new SplitAbundCommand(optionString); } + else if(commandName == "cluster.split") { command = new ClusterSplitCommand(optionString); } + else if(commandName == "classify.otu") { command = new ClassifyOtuCommand(optionString); } + else if(commandName == "degap.seqs") { command = new DegapSeqsCommand(optionString); } + else if(commandName == "get.relabund") { command = new GetRelAbundCommand(optionString); } + else if(commandName == "sens.spec") { command = new SensSpecCommand(optionString); } + else if(commandName == "seq.error") { command = new SeqErrorCommand(optionString); } + else if(commandName == "sffinfo") { command = new SffInfoCommand(optionString); } + else if(commandName == "normalize.shared") { command = new NormalizeSharedCommand(optionString); } + else if(commandName == "metastats") { command = new MetaStatsCommand(optionString); } + else if(commandName == "split.groups") { command = new SplitGroupCommand(optionString); } + else if(commandName == "cluster.fragments") { command = new ClusterFragmentsCommand(optionString); } + else if(commandName == "get.lineage") { command = new GetLineageCommand(optionString); } + else if(commandName == "remove.lineage") { command = new RemoveLineageCommand(optionString); } + else if(commandName == "get.groups") { command = new GetGroupsCommand(optionString); } + else if(commandName == "remove.groups") { command = new RemoveGroupsCommand(optionString); } + else if((commandName == "get.otus") || (commandName == "get.otulabels")) { command = new GetOtuLabelsCommand(optionString); } + else if((commandName == "remove.otus") || (commandName == "remove.otulabels")) { command = new RemoveOtuLabelsCommand(optionString); } + else if((commandName == "list.otus") ||(commandName == "list.otulabels")) { command = new ListOtuLabelsCommand(optionString); } + else if(commandName == "fastq.info") { command = new ParseFastaQCommand(optionString); } + else if(commandName == "deunique.seqs") { command = new DeUniqueSeqsCommand(optionString); } + else if(commandName == "pairwise.seqs") { command = new PairwiseSeqsCommand(optionString); } + else if(commandName == "cluster.classic") { command = new ClusterDoturCommand(optionString); } + else if(commandName == "sub.sample") { command = new SubSampleCommand(optionString); } + else if(commandName == "indicator") { command = new IndicatorCommand(optionString); } + else if(commandName == "consensus.seqs") { command = new ConsensusSeqsCommand(optionString); } + else if(commandName == "corr.axes") { command = new CorrAxesCommand(optionString); } + else if(commandName == "remove.rare") { command = new RemoveRareCommand(optionString); } + else if(commandName == "merge.groups") { command = new MergeGroupsCommand(optionString); } + else if(commandName == "merge.count") { command = new MergeCountCommand(optionString); } + else if(commandName == "amova") { command = new AmovaCommand(optionString); } + else if(commandName == "homova") { command = new HomovaCommand(optionString); } + else if(commandName == "mantel") { command = new MantelCommand(optionString); } + else if(commandName == "make.fastq") { command = new MakeFastQCommand(optionString); } + else if(commandName == "get.current") { command = new GetCurrentCommand(optionString); } + else if(commandName == "set.current") { command = new SetCurrentCommand(optionString); } + else if(commandName == "anosim") { command = new AnosimCommand(optionString); } + else if(commandName == "make.shared") { command = new SharedCommand(optionString); } + else if(commandName == "get.commandinfo") { command = new GetCommandInfoCommand(optionString); } + else if(commandName == "deunique.tree") { command = new DeuniqueTreeCommand(optionString); } + else if((commandName == "count.seqs") || (commandName == "make.table")) { command = new CountSeqsCommand(optionString); } + else if(commandName == "count.groups") { command = new CountGroupsCommand(optionString); } + else if(commandName == "summary.tax") { command = new SummaryTaxCommand(optionString); } + else if(commandName == "summary.qual") { command = new SummaryQualCommand(optionString); } + else if(commandName == "chimera.perseus") { command = new ChimeraPerseusCommand(optionString); } + else if(commandName == "shhh.seqs") { command = new ShhhSeqsCommand(optionString); } + else if(commandName == "otu.association") { command = new OTUAssociationCommand(optionString); } + else if(commandName == "sort.seqs") { command = new SortSeqsCommand(optionString); } + else if(commandName == "classify.tree") { command = new ClassifyTreeCommand(optionString); } + else if(commandName == "cooccurrence") { command = new CooccurrenceCommand(optionString); } + else if(commandName == "pcr.seqs") { command = new PcrSeqsCommand(optionString); } + else if(commandName == "create.database") { command = new CreateDatabaseCommand(optionString); } + else if(commandName == "make.biom") { command = new MakeBiomCommand(optionString); } + else if(commandName == "get.coremicrobiome") { command = new GetCoreMicroBiomeCommand(optionString); } + else if(commandName == "make.contigs") { command = new MakeContigsCommand(optionString); } + else if(commandName == "sff.multiple") { command = new SffMultipleCommand(optionString); } + else if(commandName == "classify.svm") { command = new ClassifySvmSharedCommand(optionString); } + else if(commandName == "classify.rf") { command = new ClassifyRFSharedCommand(optionString); } + else if(commandName == "filter.shared") { command = new FilterSharedCommand(optionString); } + else if(commandName == "primer.design") { command = new PrimerDesignCommand(optionString); } + else if(commandName == "get.dists") { command = new GetDistsCommand(optionString); } + else if(commandName == "remove.dists") { command = new RemoveDistsCommand(optionString); } + else if(commandName == "merge.taxsummary") { command = new MergeTaxSummaryCommand(optionString); } + else if(commandName == "get.communitytype") { command = new GetMetaCommunityCommand(optionString); } + else if(commandName == "sparcc") { command = new SparccCommand(optionString); } + else if(commandName == "make.lookup") { command = new MakeLookupCommand(optionString); } + else if(commandName == "rename.seqs") { command = new RenameSeqsCommand(optionString); } + else if(commandName == "make.lefse") { command = new MakeLefseCommand(optionString); } + else if(commandName == "lefse") { command = new LefseCommand(optionString); } + else if(commandName == "kruskal.wallis") { command = new KruskalWallisCommand(optionString); } + else if(commandName == "make.sra") { command = new SRACommand(optionString); } + else if(commandName == "merge.sfffiles") { command = new MergeSfffilesCommand(optionString); } + else if(commandName == "get.mimarkspackage") { command = new GetMIMarksPackageCommand(optionString); } + else if(commandName == "mimarks.attributes") { command = new MimarksAttributesCommand(optionString); } + else if(commandName == "set.seed") { command = new SetSeedCommand(optionString); } + else if(commandName == "make.file") { command = new MakeFileCommand(optionString); } + else if(commandName == "biom.info") { command = new BiomInfoCommand(optionString); } + else if(commandName == "rename.file") { command = new RenameFileCommand(optionString); } + else { command = new NoCommand(optionString); } + + command->execute(); + delete command; + + }else { + m->mothurOut("[ERROR]: " + commandName + " is not a valid command."); m->mothurOutEndLine(); + validCommands->printCommands(cout); + } + }else { + validCommands->printCommands(cout); + m->mothurOut("For more information about a specific command type 'commandName(help)' i.e. 'cluster(help)'"); m->mothurOutEndLine(); + } + + m->mothurOutEndLine(); m->mothurOut("For further assistance please refer to the Mothur manual on our wiki at http://www.mothur.org/wiki, or contact Pat Schloss at mothur.bugs@gmail.com.\n"); return 0; } diff --git a/source/commands/helpcommand.h b/source/commands/helpcommand.h index aedb7b5a..dc1462a6 100644 --- a/source/commands/helpcommand.h +++ b/source/commands/helpcommand.h @@ -25,7 +25,7 @@ class HelpCommand : public Command { string getCommandName() { return "help"; } string getCommandCategory() { return "Hidden"; } string getHelpString() { return "For more information about a specific command type 'commandName(help)' i.e. 'cluster(help)'"; } - string getOutputPattern(string) { return ""; } + string getOutputPattern(string) { return ""; } string getCitation() { return "no citation"; } string getDescription() { return "help"; } @@ -35,7 +35,11 @@ class HelpCommand : public Command { private: CommandFactory* validCommands; - vector outputNames; + vector outputNames; + + bool abort, calledHelp; + + string commandName; }; diff --git a/source/commands/makecontigscommand.cpp b/source/commands/makecontigscommand.cpp index ff8ba869..68f449e0 100644 --- a/source/commands/makecontigscommand.cpp +++ b/source/commands/makecontigscommand.cpp @@ -769,7 +769,7 @@ unsigned long long MakeContigsCommand::processSingleFileOption(map& ofstream out; variables["[filename]"] = thisOutputDir + m->getRootName(m->getSimpleName(it->first)); - cout << variables["[filename]"] << endl; + //cout << variables["[filename]"] << endl; string thisGroupName = getOutputFileName("group",variables); outputNames.push_back(thisGroupName); outputTypes["group"].push_back(thisGroupName); m->openOutputFile(thisGroupName, out); @@ -2652,6 +2652,7 @@ int MakeContigsCommand::setLines(vector fasta, vector qual, vect unsigned long long size; //get num bytes in file + fasta[1] = m->getFullPathName(fasta[1]); pFile = fopen (fasta[1].c_str(),"rb"); if (pFile==NULL) perror ("Error opening file"); else{ @@ -2723,6 +2724,7 @@ int MakeContigsCommand::setLines(vector fasta, vector qual, vect unsigned long long size; //get num bytes in file + qual[0] = m->getFullPathName(qual[0]); pFile = fopen (qual[0].c_str(),"rb"); if (pFile==NULL) perror ("Error opening file"); else{ @@ -2781,6 +2783,7 @@ int MakeContigsCommand::setLines(vector fasta, vector qual, vect FILE * pFile2; //get num bytes in file + qual[1] = m->getFullPathName(qual[1]); pFile2 = fopen (qual[1].c_str(),"rb"); if (pFile2==NULL) perror ("Error opening file"); else{ diff --git a/source/commands/makefilecommand.cpp b/source/commands/makefilecommand.cpp index 83b76066..92f580f4 100644 --- a/source/commands/makefilecommand.cpp +++ b/source/commands/makefilecommand.cpp @@ -14,6 +14,7 @@ vector MakeFileCommand::setParameters(){ CommandParameter ptype("type", "Multiple", "fastq-gz", "fastq", "", "", "","",false,false); parameters.push_back(ptype); CommandParameter pnumcols("numcols", "Multiple", "2-3", "3", "", "", "","",false,false, true); parameters.push_back(pnumcols); CommandParameter pseed("seed", "Number", "", "0", "", "", "","",false,false); parameters.push_back(pseed); + CommandParameter pprefix("prefix", "String", "", "", "", "", "","",false,false); parameters.push_back(pprefix); CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir); CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir); @@ -31,10 +32,11 @@ string MakeFileCommand::getHelpString(){ try { string helpString = ""; helpString += "The make.file command takes a input directory and creates a file file containing the fastq or gz files in the directory.\n"; - helpString += "The make.fastq command parameters are inputdir, numcols and type. inputdir is required.\n"; + helpString += "The make.file command parameters are inputdir, numcols, type and prefix. inputdir is required.\n"; helpString += "May create more than one file. Mothur will attempt to match paired files. \n"; helpString += "The type parameter allows you to set the type of files to look for. Options are fastq or gz. Default=fastq. \n"; helpString += "The numcols parameter allows you to set number of columns you mothur to make in the file. Default=3, meaning groupName forwardFastq reverseFastq. The groupName is made from the beginning part of the forwardFastq file. Everything up to the first '_' or if no '_' is found then the root of the forwardFastq filename.\n"; + helpString += "The prefix parameter allows you to enter your own prefix for the output filename. Default=stability."; helpString += "The make.file command should be in the following format: \n"; helpString += "make.file(inputdir=yourInputDirectory). \n"; helpString += "Example make.group(inputdir=fastqFiles)\n"; @@ -51,7 +53,7 @@ string MakeFileCommand::getOutputPattern(string type) { try { string pattern = ""; - if (type == "file") { pattern = "[filename],[tag],file"; } + if (type == "file") { pattern = "[filename],[tag],files-[filename],files"; } else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->control_pressed = true; } return pattern; @@ -126,6 +128,8 @@ MakeFileCommand::MakeFileCommand(string option) { if ((temp != "2") && (temp != "3")) { m->mothurOut(temp + " is not a valid numcols. Options are 2 or 3. I will use 3."); m->mothurOutEndLine(); temp = "3"; } m->mothurConvert(temp, numCols); + prefix = validParameter.validFile(parameters, "prefix", false); if (prefix == "not found") { prefix = "stability"; } + } } catch(exception& e) { @@ -177,23 +181,17 @@ int MakeFileCommand::execute(){ } if (numDiffs > 1) { singles.push_back(fastqFiles[i]); lastFile = fastqFiles[i]; } else { //only one diff = paired files - int pos = simpleName1.find("R1"); - int pos2 = simpleName2.find("R2"); - if ((pos != string::npos) && (pos2 != string::npos)){ - vector temp; - if (numCols == 3) { - string groupName = "noGroup"+toString(i); - int posUnderscore = fastqFiles[i].find_first_of('_'); - if (posUnderscore == string::npos) { groupName = m->getSimpleName(m->getRootName(fastqFiles[i])); } - else{ groupName = m->getSimpleName(fastqFiles[i].substr(0, posUnderscore)); } - temp.push_back(groupName); - } - temp.push_back(fastqFiles[i]); temp.push_back(fastqFiles[i+1]); lastFile = fastqFiles[i+1]; - paired.push_back(temp); - i++; - }else { - singles.push_back(fastqFiles[i]); lastFile = fastqFiles[i]; + vector temp; + if (numCols == 3) { + string groupName = "noGroup"+toString(i); + int posUnderscore = fastqFiles[i].find_first_of('_'); + if (posUnderscore == string::npos) { groupName = m->getSimpleName(m->getRootName(fastqFiles[i])); } + else{ groupName = m->getSimpleName(fastqFiles[i].substr(0, posUnderscore)); } + temp.push_back(groupName); } + temp.push_back(fastqFiles[i]); temp.push_back(fastqFiles[i+1]); lastFile = fastqFiles[i+1]; + paired.push_back(temp); + i++; } }else{ singles.push_back(fastqFiles[i]); lastFile = fastqFiles[i]; @@ -203,8 +201,8 @@ int MakeFileCommand::execute(){ if (singles.size() != 0) { map variables; - variables["[filename]"] = outputDir + "fileList."; - variables["[tag]"] = "single"; + variables["[filename]"] = outputDir + prefix + "."; + if (paired.size() != 0) { variables["[tag]"] = "single"; } string filename = getOutputFileName("file",variables); ofstream out; m->openOutputFile(filename, out); @@ -219,8 +217,8 @@ int MakeFileCommand::execute(){ if (paired.size() != 0) { map variables; - variables["[filename]"] = outputDir + "fileList."; - variables["[tag]"] = "paired"; + variables["[filename]"] = outputDir + prefix + "."; + if (singles.size() != 0) { variables["[tag]"] = "paired"; } string filename = getOutputFileName("file",variables); ofstream out; m->openOutputFile(filename, out); diff --git a/source/commands/makefilecommand.h b/source/commands/makefilecommand.h index ec05dfb8..eb6a7bfe 100644 --- a/source/commands/makefilecommand.h +++ b/source/commands/makefilecommand.h @@ -32,7 +32,7 @@ class MakeFileCommand : public Command { private: - string inputDir, outputDir, typeFile; + string inputDir, outputDir, typeFile, prefix; vector outputNames; int numCols; bool abort; diff --git a/source/commands/makegroupcommand.cpp b/source/commands/makegroupcommand.cpp index e7b88600..1d9f89d2 100644 --- a/source/commands/makegroupcommand.cpp +++ b/source/commands/makegroupcommand.cpp @@ -186,7 +186,7 @@ MakeGroupCommand::MakeGroupCommand(string option) { //prevent giantic file name map variables; variables["[filename]"] = filename; - if (fastaFileNames.size() > 3) { variables["[filename]"] = outputDir + "merge"; } + if (fastaFileNames.size() > 3) { variables["[filename]"] = "merge"; } filename = getOutputFileName("group",variables); //make sure there is at least one valid file left diff --git a/source/commands/mergecountcommand.cpp b/source/commands/mergecountcommand.cpp new file mode 100644 index 00000000..42e99176 --- /dev/null +++ b/source/commands/mergecountcommand.cpp @@ -0,0 +1,226 @@ +// +// mergecountcommand.cpp +// Mothur +// +// Created by Sarah Westcott on 8/3/16. +// Copyright © 2016 Schloss Lab. All rights reserved. +// + +#include "mergecountcommand.hpp" +#include "counttable.h" + +//********************************************************************************************************************** +vector MergeCountCommand::setParameters(){ + try { + CommandParameter pcount("count", "InputTypes", "", "", "", "", "","count",false,false,true); parameters.push_back(pcount); + CommandParameter poutput("output", "String", "", "", "", "", "","",false,true,true); parameters.push_back(poutput); + CommandParameter pseed("seed", "Number", "", "0", "", "", "","",false,false); parameters.push_back(pseed); + CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir); + CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir); + + vector myArray; + for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); } + return myArray; + } + catch(exception& e) { + m->errorOut(e, "MergeCountCommand", "setParameters"); + exit(1); + } +} +//********************************************************************************************************************** +string MergeCountCommand::getHelpString(){ + try { + string helpString = ""; + helpString += "The merge.count command takes a list of count files separated by dashes and merges them into one file."; + helpString += "The merge.count command parameters are count and output."; + helpString += "Example merge.count(count=final.count_table-new.count_table, output=complete.count_table)."; + helpString += "Note: No spaces between parameter labels (i.e. output), '=' and parameters (i.e.yourOutputFileName).\n"; + return helpString; + } + catch(exception& e) { + m->errorOut(e, "MergeCountCommand", "getHelpString"); + exit(1); + } +} +//********************************************************************************************************************** +MergeCountCommand::MergeCountCommand(){ + try { + abort = true; calledHelp = true; + setParameters(); + vector tempOutNames; + outputTypes["count"] = tempOutNames; + } + catch(exception& e) { + m->errorOut(e, "MergeCountCommand", "MergeCountCommand"); + exit(1); + } +} +//********************************************************************************************************************** + +MergeCountCommand::MergeCountCommand(string option) { + try { + abort = false; calledHelp = false; + + if(option == "help") { + help(); + abort = true; calledHelp = true; + }else if(option == "citation") { citation(); abort = true; calledHelp = true;} + else { + vector myArray = setParameters(); + + OptionParser parser(option); + map parameters = parser.getParameters(); + + ValidParameters validParameter; + + //check to make sure all parameters are valid for command + for (map::iterator it = parameters.begin(); it != parameters.end(); it++) { + if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; } + } + + //initialize outputTypes + vector tempOutNames; + outputTypes["count"] = tempOutNames; + + //if the user changes the input directory command factory will send this info to us in the output parameter + string inputDir = validParameter.validFile(parameters, "inputdir", false); + if (inputDir == "not found"){ inputDir = ""; } + + string fileList = validParameter.validFile(parameters, "count", false); + if(fileList == "not found") { m->mothurOut("[ERROR]: you must enter two or more count file names"); m->mothurOutEndLine(); abort=true; } + else{ m->splitAtDash(fileList, fileNames); } + + //if the user changes the output directory command factory will send this info to us in the output parameter + string outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found") { outputDir = ""; } + + + numInputFiles = fileNames.size(); + ifstream testFile; + if(numInputFiles == 0){ + m->mothurOut("you must enter two or more file names and you entered " + toString(fileNames.size()) + " file names"); m->mothurOutEndLine(); + abort=true; + } + else{ + for(int i=0;ihasPath(fileNames[i]); + //if the user has not given a path then, add inputdir. else leave path alone. + if (path == "") { fileNames[i] = inputDir + fileNames[i]; } + } + + map file; file["file"] = fileNames[i]; + fileNames[i] = validParameter.validFile(file, "file", true); + if(fileNames[i] == "not found"){ abort = true; } + } + } + + outputFileName = validParameter.validFile(parameters, "output", false); + if (outputFileName == "not found") { m->mothurOut("you must enter an output file name"); m->mothurOutEndLine(); abort=true; } + else if (outputDir != "") { outputFileName = outputDir + m->getSimpleName(outputFileName); } + } + + } + catch(exception& e) { + m->errorOut(e, "MergeCountCommand", "MergeCountCommand"); + exit(1); + } +} +//********************************************************************************************************************** + +int MergeCountCommand::execute(){ + try { + if (abort == true) { if (calledHelp) { return 0; } return 2; } + + m->mothurRemove(outputFileName); + + //read headers from each file to confirm all contain groupinfo or all do not + //Also collect all group names + bool allContainGroups = true; bool allNoGroups = true; + set allGroups; + for(int i = 0; i < numInputFiles; i++) { + + if (m->control_pressed) { return 0; } + + vector thisTablesGroups; + CountTable table; + bool hasGroups = table.testGroups(fileNames[i], thisTablesGroups); + + if (hasGroups) { + allNoGroups = false; + for (int j = 0; j < thisTablesGroups.size(); j++) { allGroups.insert(thisTablesGroups[j]); } + }else { allContainGroups = false; } + } + int numGroups = allGroups.size(); + + //check to make sure all files are one type - quit if not + if (!allContainGroups && !allNoGroups) { m->mothurOut("[ERROR]: your have countfiles that contains group information and count files that do not. These cannot be combined without loss of information, please correct.\n"); m->control_pressed = true; return 0; } + + if (m->control_pressed) { return 0; } + + //Create Blank Table - (set&, map&, set&); //seqNames, seqName->group, groupNames + set seqNames; map seqGroup; set g; + CountTable completeTable; + completeTable.createTable(seqNames, seqGroup, g); + + //append first one to get headers + map groupIndex; + if (allNoGroups) { m->appendBinaryFiles(fileNames[0], outputFileName); } + else { //create groupMap to save time setting abundance vector + int count = 0; + for (set::iterator it = allGroups.begin(); it != allGroups.end(); it++) { + completeTable.addGroup(*it); + groupIndex[*it] = count; count++; + } + } + + //for each file + for(int i = 0; i < numInputFiles; i++) { + + if (m->control_pressed) { break; } + + if (allContainGroups) { + + CountTable table; table.readTable(fileNames[i], true, false); + vector groups = table.getNamesOfGroups(); + + vector seqs = table.getNamesOfSeqs(); + for (int j = 0; j < seqs.size(); j++) { + if (m->control_pressed) { break; } + vector abunds = table.getGroupCounts(seqs[j]); + vector newAbunds; newAbunds.resize(numGroups, 0); + for (int k = 0; k < abunds.size(); k++) { + if (abunds[k] != 0) { //we need to set abundance in vector with all groups + //groups and abunds are in matching order. we know all groups are in groupIndex from above. + int newIndex = groupIndex[groups[k]]; + newAbunds[newIndex] = abunds[k]; + } + } + completeTable.push_back(seqs[j], newAbunds); + } + } + else { m->appendFilesWithoutHeaders(fileNames[i], outputFileName); } //No group info so simple append + } + + if (m->control_pressed) { m->mothurRemove(outputFileName); return 0; } + + //print new table + if (allContainGroups) { completeTable.printTable(outputFileName); } + + if (m->control_pressed) { m->mothurRemove(outputFileName); return 0; } + + //update current count file + m->setCountTableFile(outputFileName); + + m->mothurOutEndLine(); + m->mothurOut("Output File Names: "); m->mothurOutEndLine(); + m->mothurOut(outputFileName); m->mothurOutEndLine(); outputNames.push_back(outputFileName); outputTypes["merge"].push_back(outputFileName); + m->mothurOutEndLine(); + + return 0; + } + catch(exception& e) { + m->errorOut(e, "MergeCountCommand", "execute"); + exit(1); + } +} +//********************************************************************************************************************** diff --git a/source/commands/mergecountcommand.hpp b/source/commands/mergecountcommand.hpp new file mode 100644 index 00000000..5edfd4df --- /dev/null +++ b/source/commands/mergecountcommand.hpp @@ -0,0 +1,48 @@ +// +// mergecountcommand.hpp +// Mothur +// +// Created by Sarah Westcott on 8/3/16. +// Copyright © 2016 Schloss Lab. All rights reserved. +// + +#ifndef mergecountcommand_hpp +#define mergecountcommand_hpp + +#include "command.hpp" + +class MergeCountCommand : public Command { + +#ifdef UNIT_TEST + //friend class TestMergeCountCommand; +#endif + +public: + MergeCountCommand(string); + MergeCountCommand(); + ~MergeCountCommand() {} + + vector setParameters(); + string getCommandName() { return "merge.count"; } + string getCommandCategory() { return "General"; } + + string getHelpString(); + string getOutputPattern(string) { return ""; } + string getCitation() { return "http://www.mothur.org/wiki/Merge.count"; } + string getDescription() { return "reads count files and combines them into a single count file"; } + + + int execute(); + void help() { m->mothurOut(getHelpString()); } + +private: + + bool abort; + string outputDir, inputDir, countfile, output, outputFileName; + vector outputNames, fileNames; + int numInputFiles; + +}; + + +#endif /* mergecountcommand_hpp */ diff --git a/source/commands/mergegroupscommand.cpp b/source/commands/mergegroupscommand.cpp index 8d36d2b2..7c40ce86 100644 --- a/source/commands/mergegroupscommand.cpp +++ b/source/commands/mergegroupscommand.cpp @@ -308,6 +308,11 @@ int MergeGroupsCommand::execute(){ if (itTypes != outputTypes.end()) { if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); } } + + itTypes = outputTypes.find("count"); + if (itTypes != outputTypes.end()) { + if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setCountTableFile(current); } + } m->mothurOutEndLine(); m->mothurOut("Output File Names: "); m->mothurOutEndLine(); diff --git a/source/commands/parselistscommand.cpp b/source/commands/parselistscommand.cpp index cbd50099..66596923 100644 --- a/source/commands/parselistscommand.cpp +++ b/source/commands/parselistscommand.cpp @@ -324,14 +324,7 @@ int ParseListCommand::execute(){ /**********************************************************************************************************************/ int ParseListCommand::parse(ListVector* thisList) { try { - map files; - map::iterator it3; - - //set fileroot - map variables; - variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(listfile)); - variables["[distance]"] = thisList->getLabel(); - + //fill filehandles with neccessary ofstreams vector gGroups; if (groupfile != "") { gGroups = groupMap->getNamesOfGroups(); } @@ -342,11 +335,18 @@ int ParseListCommand::parse(ListVector* thisList) { map::iterator itGroup; map groupNumBins; + map files; + + //set fileroot + map variables; + variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(listfile)); + variables["[distance]"] = thisList->getLabel(); + for (int i=0; iopenOutputFile(filename, temp); + m->openOutputFile(filename, temp); temp.close(); files[gGroups[i]] = filename; outputNames.push_back(filename); outputTypes["list"].push_back(filename); groupNumBins[gGroups[i]] = 0; @@ -404,9 +404,10 @@ int ParseListCommand::parse(ListVector* thisList) { } //end list vector - for (it3 = files.begin(); it3 != files.end(); it3++) { + for (map::iterator it3 = files.begin(); it3 != files.end(); it3++) { ofstream out; - m->openOutputFileAppend(files[it3->second], out); + string filename = it3->second; + m->openOutputFileAppend(filename, out); out << groupLabels[it3->first] << endl; out << thisList->getLabel() << '\t' << groupNumBins[it3->first] << groupVector[it3->first] << endl; // label numBins listvector for that group out.close(); diff --git a/source/commands/seqerrorcommand.cpp b/source/commands/seqerrorcommand.cpp index f061fd38..a56e9434 100644 --- a/source/commands/seqerrorcommand.cpp +++ b/source/commands/seqerrorcommand.cpp @@ -1374,6 +1374,7 @@ int SeqErrorCommand::setLines(string filename, string qfilename, string rfilenam unsigned long long size; //get num bytes in file + qfilename = m->getFullPathName(qfilename); pFile = fopen (qfilename.c_str(),"rb"); if (pFile==NULL) perror ("Error opening file"); else{ @@ -1436,6 +1437,7 @@ int SeqErrorCommand::setLines(string filename, string qfilename, string rfilenam unsigned long long sizeR; //get num bytes in file + rfilename = m->getFullPathName(rfilename); rFile = fopen (rfilename.c_str(),"rb"); if (rFile==NULL) perror ("Error opening file"); else{ @@ -1455,6 +1457,7 @@ int SeqErrorCommand::setLines(string filename, string qfilename, string rfilenam unsigned long long size; //get num bytes in file + filename = m->getFullPathName(filename); pFile = fopen (filename.c_str(),"rb"); if (pFile==NULL) perror ("Error opening file"); else{ @@ -1469,6 +1472,7 @@ int SeqErrorCommand::setLines(string filename, string qfilename, string rfilenam FILE * qFile; //get num bytes in file + qfilename = m->getFullPathName(qfilename); qFile = fopen (qfilename.c_str(),"rb"); if (qFile==NULL) perror ("Error opening file"); else{ @@ -1486,6 +1490,7 @@ int SeqErrorCommand::setLines(string filename, string qfilename, string rfilenam FILE * rFile; //get num bytes in file + rfilename = m->getFullPathName(rfilename); rFile = fopen (rfilename.c_str(),"rb"); if (rFile==NULL) perror ("Error opening file"); else{ diff --git a/source/commands/sracommand.cpp b/source/commands/sracommand.cpp index 14f84754..17fac110 100644 --- a/source/commands/sracommand.cpp +++ b/source/commands/sracommand.cpp @@ -1327,15 +1327,19 @@ int SRACommand::mapGroupToFile(map >& files, vectorgetSimpleName(theseFiles[j]); //if ((tempName == "GZGO5KL01.F006D146.sff") || (tempName == "G3BMWHG01.F008D021.sff") || (tempName == "GO2JXTW01.M002D125.sff") || (tempName == "GO5715J01.M003D125.sff")) { cout << Groups[i] << '\t' << theseFiles[j] << endl; } //cout << i << '\t' << j << '\t' << Groups[i] << '\t' << theseFiles[j] << endl; - int pos = theseFiles[j].find(Groups[i]); + int pos = theseFiles[j].find(thisGroup); if (pos != string::npos) { //you have a potential match, make sure you dont have a case of partial name - if (theseFiles[j][pos+Groups[i].length()] == '.') { //final.soil.sff vs final.soil2.sff both would match soil. - map >::iterator it = files.find(Groups[i]); + if (theseFiles[j][pos+thisGroup.length()] == '.') { //final.soil.sff vs final.soil2.sff both would match soil. + map >::iterator it = files.find(thisGroup); if (it == files.end()) { vector temp; temp.push_back(theseFiles[j]); files[Groups[i]] = temp; @@ -1346,6 +1350,7 @@ int SRACommand::mapGroupToFile(map >& files, vectorgetFullPathName(barcodePrimerComboFileNames[i][j]); pFile = fopen (barcodePrimerComboFileNames[i][j].c_str(),"rb"); if (pFile==NULL) perror ("Error opening file"); else{ @@ -777,6 +778,7 @@ vector TrimFlowsCommand::getFlowFileBreaks() { unsigned long long size; //get num bytes in file + flowFileName = m->getFullPathName(flowFileName); pFile = fopen (flowFileName.c_str(),"rb"); if (pFile==NULL) perror ("Error opening file"); else{ diff --git a/source/commands/trimseqscommand.cpp b/source/commands/trimseqscommand.cpp index eb9a73f8..037f8ed1 100644 --- a/source/commands/trimseqscommand.cpp +++ b/source/commands/trimseqscommand.cpp @@ -1646,6 +1646,7 @@ int TrimSeqsCommand::setLines(string filename, string qfilename) { unsigned long long size; //get num bytes in file + qfilename = m->getFullPathName(qfilename); pFile = fopen (qfilename.c_str(),"rb"); if (pFile==NULL) perror ("Error opening file"); else{ diff --git a/source/datastructures/counttable.cpp b/source/datastructures/counttable.cpp index 4cd2aa34..cf078fc1 100644 --- a/source/datastructures/counttable.cpp +++ b/source/datastructures/counttable.cpp @@ -11,6 +11,7 @@ /************************************************************/ int CountTable::createTable(set& n, map& g, set& gs) { try { + hasGroups = false; int numGroups = 0; groups.clear(); totalGroups.clear(); @@ -81,13 +82,34 @@ int CountTable::createTable(set& n, map& g, set& /************************************************************/ bool CountTable::testGroups(string file) { try { + vector nothing; + return testGroups(file, nothing); + } + catch(exception& e) { + m->errorOut(e, "CountTable", "testGroups"); + exit(1); + } +} + +/************************************************************/ +bool CountTable::testGroups(string file, vector& groups) { + try { m = MothurOut::getInstance(); hasGroups = false; total = 0; ifstream in; m->openInputFile(file, in); string headers = m->getline(in); m->gobble(in); vector columnHeaders = m->splitWhiteSpace(headers); - if (columnHeaders.size() > 2) { hasGroups = true; } + if (columnHeaders.size() > 2) { + hasGroups = true; + + for (int i = 2; i < columnHeaders.size(); i++) { + groups.push_back(columnHeaders[i]); + } + //sort groups to keep consistent with how we store the groups in groupmap + sort(groups.begin(), groups.end()); + } + return hasGroups; } catch(exception& e) { diff --git a/source/datastructures/counttable.h b/source/datastructures/counttable.h index 64def2e0..f9150d18 100644 --- a/source/datastructures/counttable.h +++ b/source/datastructures/counttable.h @@ -50,12 +50,13 @@ class CountTable { //reads and creates smart enough to eliminate groups with zero counts int createTable(set&, map&, set&); //seqNames, seqName->group, groupNames int createTable(string, string, bool); //namefile, groupfile, createGroup - int readTable(string, bool, bool); + int readTable(string, bool, bool); //file, readGroups, mothurRunning int printTable(string); int printHeaders(ofstream&); int printSeq(ofstream&, string); - bool testGroups(string file); //used to check if file has group data without reading it. + bool testGroups(string file); //used to check if file has group data without reading it + bool testGroups(string file, vector&); //used to check if file has group data without reading it, return groups if found. int copy(CountTable*); bool hasGroupInfo() { return hasGroups; } diff --git a/source/mothurout.cpp b/source/mothurout.cpp index 86d9e528..eadce7eb 100644 --- a/source/mothurout.cpp +++ b/source/mothurout.cpp @@ -1356,6 +1356,8 @@ vector MothurOut::isGZ(string filename){ int ableToOpen = openInputFileBinary(filename, fileHandle, gzin, ""); //no error + if (debug) { if (ableToOpen == 1) { mothurOut("[DEBUG]: unable to open gz file. \n"); } } + if (ableToOpen == 1) { return results; } // results[0] = false; results[1] = false; else { results[0] = true; } @@ -2991,7 +2993,7 @@ bool MothurOut::checkGroupName(string name) { } if (!goodName) { - mothurOut("\n[ERROR]: group " + name + " contains illegal characters in the name. Group names cannot include :, -, or / characters. The ':' character is a special character used in trees. Using ':' will result in your tree being unreadable by tree reading software. The '-' character is a special character used by mothur to parse group names. Using the '-' character will prevent you from selecting groups. The '/' character will created unreadable filenames when mothur includes the group in an output filename. Quitting. \n\n"); control_pressed = true; + mothurOut("\n[WARNING]: group " + name + " contains illegal characters in the name. Group names should not include :, -, or / characters. The ':' character is a special character used in trees. Using ':' will result in your tree being unreadable by tree reading software. The '-' character is a special character used by mothur to parse group names. Using the '-' character will prevent you from selecting groups. The '/' character will created unreadable filenames when mothur includes the group in an output filename. \n\n"); } return goodName;