02_caps_sort_input.patch 976 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. diff -pruN old/caps.cpp new/caps.cpp
  2. --- old/caps.cpp 2022-01-20 09:30:24.409886691 +0200
  3. +++ new/caps.cpp 2022-01-20 09:39:10.669845265 +0200
  4. @@ -1,4 +1,5 @@
  5. #include<iostream>
  6. +#include <algorithm>
  7. #include<fstream>
  8. #include"BCFasta.h"
  9. #include"file_manip.h"
  10. @@ -15,7 +16,7 @@
  11. #include<sys/time.h>
  12. #include<iomanip>
  13. #include <bits/stdc++.h>
  14. -
  15. +#include <vector>
  16. #include <Seq/SequenceApplicationTools.h>
  17. @@ -69,6 +70,10 @@
  18. const gsl_rng_type * T;
  19. gsl_rng *r;
  20. +// make sure filenames are sorted!
  21. +// https://stackoverflow.com/a/34757557
  22. +bool compareFunction (std::string a, std::string b) {return a<b;}
  23. +
  24. vector<double> totaltempnew;
  25. double alphathresh = 0;
  26. int main(int argc, char *argv[]){
  27. @@ -189,6 +194,8 @@ int main(int argc, char *argv[]){
  28. vector<string> files;
  29. files = Folder_to_vector(mystring.c_str());
  30. + // make sure filenames are sorted!
  31. + std::sort(files.begin(),files.end(),compareFunction);
  32. Fasta_vector file;
  33. file.ref_num=0;