X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mothur.h;h=2c143e8667786c5740f0aa6324ea4062eab66b76;hb=ee8403d4eb5760187d62b42a9cf4272de8fc0ec4;hp=190254a96e4c7d7830f8405035933efda4b003ea;hpb=24083a26340293cb3a0e44bcf79edbc9b31f41db;p=mothur.git diff --git a/mothur.h b/mothur.h index 190254a..2c143e8 100644 --- a/mothur.h +++ b/mothur.h @@ -42,6 +42,7 @@ #include #include #include +#include //misc #include @@ -53,7 +54,7 @@ #endif /***********************************************************************/ -#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) #include #include #include @@ -72,6 +73,8 @@ #include #include #include + #include + #endif using namespace std; @@ -83,6 +86,7 @@ using namespace std; #define isnan(x) ((x) != (x)) #define isinf(x) (fabs(x) == std::numeric_limits::infinity()) + typedef unsigned long ull; struct IntNode { @@ -103,6 +107,19 @@ struct ThreadNode { IntNode* right; }; +struct diffPair { + float prob; + float reverseProb; + + diffPair() { + prob = 0; reverseProb = 0; + } + diffPair(float p, float rp) { + prob = p; + reverseProb = rp; + } +}; + /************************************************************/ struct clusterNode { int numSeq; @@ -114,9 +131,9 @@ struct clusterNode { struct seqDist { int seq1; int seq2; - float dist; + double dist; seqDist() {} - seqDist(int s1, int s2, float d) : seq1(s1), seq2(s2), dist(d) {} + seqDist(int s1, int s2, double d) : seq1(s1), seq2(s2), dist(d) {} ~seqDist() {} }; /************************************************************/ @@ -125,6 +142,15 @@ struct distlinePair { int end; }; +/************************************************************/ +struct seqPriorityNode { + int numIdentical; + string seq; + string name; + seqPriorityNode() {} + seqPriorityNode(int n, string s, string nm) : numIdentical(n), seq(s), name(nm) {} + ~seqPriorityNode() {} +}; /***************************************************************/ struct spearmanRank { string name; @@ -138,6 +164,11 @@ inline bool compareSpearman(spearmanRank left, spearmanRank right){ return (left.score > right.score); } //******************************************************************************************************************** +//sorts highest to lowest +inline bool compareSeqPriorityNodes(seqPriorityNode left, seqPriorityNode right){ + return (left.numIdentical > right.numIdentical); +} +//******************************************************************************************************************** //sorts lowest to highest inline bool compareSpearmanReverse(spearmanRank left, spearmanRank right){ return (left.score < right.score); @@ -172,7 +203,8 @@ void convert(const string& s, T& x, bool failIfLeftoverChars = true){ throw BadConversion(s); } - +//********************************************************************************************************************** +template int sgn(T val){ return (val > T(0)) - (val < T(0)); } //********************************************************************************************************************** template