[med-svn] [Git][med-team/kallisto][upstream] New upstream version 0.46.0+dfsg

Andreas Tille gitlab at salsa.debian.org
Wed Aug 7 12:04:34 BST 2019



Andreas Tille pushed to branch upstream at Debian Med / kallisto


Commits:
c28e1ce9 by Andreas Tille at 2019-08-07T11:00:53Z
New upstream version 0.46.0+dfsg
- - - - -


3 changed files:

- src/BUSData.h
- src/common.h
- src/main.cpp


Changes:

=====================================
src/BUSData.h
=====================================
@@ -18,6 +18,11 @@ struct BUSHeader {
   std::string text;
   std::vector<BUSTranscript> transcripts;
   std::vector<std::vector<int32_t>> ecs;
+  uint32_t version;
+  uint32_t bclen;
+  uint32_t umilen;
+  BUSHeader() : version(0), bclen(0), umilen(0) {}
+
 };
 
 struct BUSData {
@@ -26,8 +31,8 @@ struct BUSData {
   int32_t ec;
   uint32_t count;
   uint32_t flags;  
-
-  BUSData() : barcode(0), UMI(0), ec(-1), count(0), flags(0) {}
+  uint32_t pad;
+  BUSData() : barcode(0), UMI(0), ec(-1), count(0), flags(0), pad(0) {}
 };
 
 uint64_t stringToBinary(const std::string &s, uint32_t &flag);


=====================================
src/common.h
=====================================
@@ -1,7 +1,7 @@
 #ifndef KALLISTO_COMMON_H
 #define KALLISTO_COMMON_H
 
-#define KALLISTO_VERSION "0.45.1"
+#define KALLISTO_VERSION "0.46.0"
 
 #include <string>
 #include <vector>


=====================================
src/main.cpp
=====================================
@@ -600,6 +600,106 @@ void ParseOptionsBus(int argc, char **argv, ProgramOptions& opt) {
  
 }
 
+bool ParseTechnology(const std::string &techstr, std::vector<BUSOptionSubstr> &values, std::vector<int> &files, std::vector<std::string> &errorList, std::vector<BUSOptionSubstr> &bcValues) {
+  int lastIndex = 0; //the last place in the string a colon and punctuation was found
+  int currValue = 1; //tells us the index of the three sequences needed barcode, umi, sequence
+  vector<int> numbers; //stores the numbers in a pairs
+  const char punctuationCompare = ',';
+  const char colonCompare = ':';
+  bool colon;
+  bool duplicate = false;
+  std::string stringVal;
+  int val;
+
+  for(int i = 1; i < techstr.length(); i++) {
+    colon = false;
+    if(techstr[i] == colonCompare) {
+      colon = true;
+    }
+
+    if(techstr[i] == punctuationCompare || colon) {
+      stringVal = techstr.substr(lastIndex, i-lastIndex);
+      try {
+        val = stoi(stringVal);
+        numbers.push_back(val);
+        if(numbers.size() == 1) {
+          if(!files.empty()) {
+            for(int j = 0; j < files.size(); j++) {
+              if(val == files[j]) {
+                duplicate = true;
+                break;
+              }
+            }
+            if(!duplicate) {
+              files.push_back(val);
+            } else {
+              duplicate = false;
+            }
+          } else {
+            files.push_back(val);
+          }
+        }
+        lastIndex = i + 1;
+      } catch(const std:: invalid_argument& ia) {
+        errorList.push_back("Error: Invalid argument");
+        return true;
+      }
+
+      if(colon) {
+        if(numbers.size() != 3) {
+          errorList.push_back("Error: Wrong number of pairs provided");
+          return true;
+        }
+      }
+    }
+    if(numbers.size() == 3) {
+      if(currValue == 1) {
+        bcValues.push_back(BUSOptionSubstr(numbers[0], numbers[1], numbers[2]));
+      } else {
+        values.push_back(BUSOptionSubstr(numbers[0], numbers[1], numbers[2]));
+      }
+      numbers.clear();
+    }
+    if(colon) {
+      currValue++;
+    }
+  }
+
+  if (files.empty()) {
+    errorList.push_back(std::string("Error: parsing technology string \"") + techstr + "\"");
+    return true;
+  }
+
+  std::sort(files.begin(), files.end());
+  for(int k = 0; k < files.size()-1; k++) {
+    if(files[k]+1 != files[k+1]) {
+      errorList.push_back("Error: files aren't correctly referenced");
+      return true;
+    }
+  }
+
+  stringVal = techstr.substr(lastIndex, techstr.length()-lastIndex);
+  if(numbers.size() == 2) {
+    try {
+      val = stoi(stringVal);
+      numbers.push_back(val);
+      values.push_back(BUSOptionSubstr(numbers[0], numbers[1], numbers[2]));
+      numbers.clear();  
+    } catch(const std:: invalid_argument& ia) {
+      errorList.push_back("Error: Invalid argument");
+      return true;
+    }
+  } else {
+    errorList.push_back("Error: Wrong number of pairs provided");
+    return true;
+  }
+  if(currValue != 3) {
+    errorList.push_back("Error: Wrong number of substrings provided");
+    return true;
+  }
+  return false;
+}
+
 
 void ParseOptionsH5Dump(int argc, char **argv, ProgramOptions& opt) {
   int peek_flag = 0;
@@ -762,8 +862,25 @@ bool CheckOptionsBus(ProgramOptions& opt) {
       busopt.umi = BUSOptionSubstr(0,6,16);
       busopt.bc.push_back(BUSOptionSubstr(0,0,6));
     } else {
-      cerr << "Unknown technology: " << opt.technology << endl;
-      ret = false;
+      vector<int> files;
+      vector<BUSOptionSubstr> values;
+      vector<BUSOptionSubstr> bcValues;
+      vector<std::string> errorList;
+      bool invalid = ParseTechnology(opt.technology, values, files, errorList, bcValues);
+      if(!invalid) {
+        busopt.nfiles = files.size(); 
+        for(int i = 0; i < bcValues.size(); i++) {
+          busopt.bc.push_back(bcValues[i]);
+        }
+        busopt.umi = values[0];
+        busopt.seq = values[1];
+      } else {
+        for(int j = 0; j < errorList.size(); j++) {
+          cerr << errorList[j] << endl;
+        }
+        cerr << "Unable to create technology: " << opt.technology << endl;
+        ret = false;
+      }
     }
   }
 



View it on GitLab: https://salsa.debian.org/med-team/kallisto/commit/c28e1ce966c636a14a95247b7b9bfbf0cdb38f7f

-- 
View it on GitLab: https://salsa.debian.org/med-team/kallisto/commit/c28e1ce966c636a14a95247b7b9bfbf0cdb38f7f
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190807/1e86c7b9/attachment-0001.html>


More information about the debian-med-commit mailing list