|
|
@@ -3927,27 +3927,6 @@ void MothurOut::splitAtDash(string& estim, vector<string>& container) { |
|
|
string individual = "";
|
|
|
int estimLength = estim.size();
|
|
|
bool prevEscape = false;
|
|
|
- /*for(int i=0;i<estimLength;i++){
|
|
|
- if(prevEscape){
|
|
|
- individual += estim[i];
|
|
|
- prevEscape = false;
|
|
|
- }
|
|
|
- else{
|
|
|
- if(estim[i] == '\\'){
|
|
|
- prevEscape = true;
|
|
|
- }
|
|
|
- else if(estim[i] == '-'){
|
|
|
- container.push_back(individual);
|
|
|
- individual = "";
|
|
|
- prevEscape = false;
|
|
|
- }
|
|
|
- else{
|
|
|
- individual += estim[i];
|
|
|
- prevEscape = false;
|
|
|
- }
|
|
|
- }
|
|
|
- }*/
|
|
|
-
|
|
|
|
|
|
for(int i=0;i<estimLength;i++){
|
|
|
if(estim[i] == '-'){
|
|
|
@@ -3983,28 +3962,6 @@ void MothurOut::splitAtDash(string& estim, set<string>& container) { |
|
|
string individual = "";
|
|
|
int estimLength = estim.size();
|
|
|
bool prevEscape = false;
|
|
|
- /*
|
|
|
- for(int i=0;i<estimLength;i++){
|
|
|
- if(prevEscape){
|
|
|
- individual += estim[i];
|
|
|
- prevEscape = false;
|
|
|
- }
|
|
|
- else{
|
|
|
- if(estim[i] == '\\'){
|
|
|
- prevEscape = true;
|
|
|
- }
|
|
|
- else if(estim[i] == '-'){
|
|
|
- container.insert(individual);
|
|
|
- individual = "";
|
|
|
- prevEscape = false;
|
|
|
- }
|
|
|
- else{
|
|
|
- individual += estim[i];
|
|
|
- prevEscape = false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- */
|
|
|
|
|
|
for(int i=0;i<estimLength;i++){
|
|
|
if(estim[i] == '-'){
|
|
|
@@ -4038,28 +3995,6 @@ void MothurOut::splitAtDash(string& estim, set<int>& container) { |
|
|
int lineNum;
|
|
|
int estimLength = estim.size();
|
|
|
bool prevEscape = false;
|
|
|
- /*
|
|
|
- for(int i=0;i<estimLength;i++){
|
|
|
- if(prevEscape){
|
|
|
- individual += estim[i];
|
|
|
- prevEscape = false;
|
|
|
- }
|
|
|
- else{
|
|
|
- if(estim[i] == '\\'){
|
|
|
- prevEscape = true;
|
|
|
- }
|
|
|
- else if(estim[i] == '-'){
|
|
|
- convert(individual, lineNum); //convert the string to int
|
|
|
- container.insert(lineNum);
|
|
|
- individual = "";
|
|
|
- prevEscape = false;
|
|
|
- }
|
|
|
- else{
|
|
|
- individual += estim[i];
|
|
|
- prevEscape = false;
|
|
|
- }
|
|
|
- }
|
|
|
- }*/
|
|
|
|
|
|
for(int i=0;i<estimLength;i++){
|
|
|
if(estim[i] == '-'){
|
|
|
@@ -4125,20 +4060,6 @@ void MothurOut::splitAtComma(string& estim, vector<string>& container) { |
|
|
}
|
|
|
container.push_back(individual);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// string individual;
|
|
|
-//
|
|
|
-// while (estim.find_first_of(',') != -1) {
|
|
|
-// individual = estim.substr(0,estim.find_first_of(','));
|
|
|
-// if ((estim.find_first_of(',')+1) <= estim.length()) { //checks to make sure you don't have comma at end of string
|
|
|
-// estim = estim.substr(estim.find_first_of(',')+1, estim.length());
|
|
|
-// container.push_back(individual);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// //get last one
|
|
|
-// container.push_back(estim);
|
|
|
}
|
|
|
catch(exception& e) {
|
|
|
errorOut(e, "MothurOut", "splitAtComma");
|
|
|
@@ -4163,18 +4084,6 @@ void MothurOut::splitAtChar(string& prefix, string& suffix, char c){ |
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /*
|
|
|
-
|
|
|
- prefix = suffix.substr(0,suffix.find_first_of(c));
|
|
|
- if ((suffix.find_first_of(c)+2) <= suffix.length()) { //checks to make sure you don't have comma at end of string
|
|
|
- suffix = suffix.substr(suffix.find_first_of(c)+1, suffix.length());
|
|
|
- string space = " ";
|
|
|
- while(suffix.at(0) == ' ')
|
|
|
- suffix = suffix.substr(1, suffix.length());
|
|
|
- }else { suffix = ""; }
|
|
|
- */
|
|
|
-
|
|
|
}
|
|
|
catch(exception& e) {
|
|
|
errorOut(e, "MothurOut", "splitAtChar");
|
|
|
@@ -4430,6 +4339,63 @@ bool MothurOut::checkReleaseVersion(ifstream& file, string version) { |
|
|
}
|
|
|
}
|
|
|
/**************************************************************************************************/
|
|
|
+int MothurOut::getTimeStamp(string filename) {
|
|
|
+ try {
|
|
|
+ int timeStamp = 0;
|
|
|
+
|
|
|
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
|
|
|
+ struct stat st;
|
|
|
+ int errorCode = stat (filename.c_str(), &st);
|
|
|
+ if (errorCode != 0) {
|
|
|
+ mothurOut("[ERROR]: Can't find timestamp for " + filename + "\n"); control_pressed = true;
|
|
|
+ }else {
|
|
|
+ timeStamp = st.st_mtime;
|
|
|
+ }
|
|
|
+#else
|
|
|
+ HANDLE hFile;
|
|
|
+
|
|
|
+ hFile = CreateFile(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL,
|
|
|
+ OPEN_EXISTING, 0, NULL);
|
|
|
+
|
|
|
+ if(hFile == INVALID_HANDLE_VALUE) {
|
|
|
+ mothurOut("[ERROR]: Can't find timestamp for " + filename + "\n"); control_pressed = true;
|
|
|
+ return timestamp;
|
|
|
+ }
|
|
|
+
|
|
|
+ FILETIME ftCreate, ftAccess, ftWrite;
|
|
|
+ SYSTEMTIME stUTC;
|
|
|
+ DWORD dwRet;
|
|
|
+
|
|
|
+ // Retrieve the file times for the file.
|
|
|
+ bool success = GetFileTime(hFile, &ftCreate, &ftAccess, &ftWrite);
|
|
|
+
|
|
|
+ if (success) {
|
|
|
+ FileTimeToSystemTime(&ftWrite, &stUTC);
|
|
|
+
|
|
|
+ tm time;
|
|
|
+ time.tm_sec = stUTC.wSecond;
|
|
|
+ time.tm_min = stUTC.wMinute;
|
|
|
+ time.tm_hour = stUTC.wHour;
|
|
|
+ time.tm_mday = stUTC.wDay;
|
|
|
+ time.tm_mon = stUTC.wMonth - 1;
|
|
|
+ time.tm_year = stUTC.wYear - 1900;
|
|
|
+ time.tm_isdst = -1;
|
|
|
+ time_t t = mktime(&time);
|
|
|
+
|
|
|
+ timeStamp = t;
|
|
|
+ }
|
|
|
+ else { mothurOut("[ERROR]: Can't find timestamp for " + filename + "\n"); control_pressed = true; }
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
+ return timeStamp;
|
|
|
+ }
|
|
|
+ catch(exception& e) {
|
|
|
+ errorOut(e, "MothurOut", "getTimeStamp");
|
|
|
+ exit(1);
|
|
|
+ }
|
|
|
+}
|
|
|
+/**************************************************************************************************/
|
|
|
vector<double> MothurOut::getAverages(vector< vector<double> >& dists) {
|
|
|
try{
|
|
|
vector<double> averages; //averages.resize(numComp, 0.0);
|
|
|
|
0 comments on commit
1e4fe98