From 8b60619484158bbbbf8c51f52b6ec91620704acf Mon Sep 17 00:00:00 2001
From: rlyu <rlyu@svi.edu.au>
Date: Wed, 12 May 2021 10:46:30 +1000
Subject: [PATCH] fix splitN read count bug

---
 .gitlab-ci.yml     |  2 ++
 src/sscocaller.nim | 11 +++++------
 tests/bcAA.tsv     |  2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f6f0c99..9addc7f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -28,6 +28,7 @@ testUbuntu:
   stage: testStatic
   script:
     - ./src/sscocaller -h
+
 testDebian:
   tags:
     - docker
@@ -35,6 +36,7 @@ testDebian:
   stage: testStatic
   script:
     - ./src/sscocaller -h
+
 ## shell executer    
 testFunction:
   stage: testStatic
diff --git a/src/sscocaller.nim b/src/sscocaller.nim
index 51c77c9..5002669 100755
--- a/src/sscocaller.nim
+++ b/src/sscocaller.nim
@@ -33,8 +33,7 @@ proc sscocaller(argv: var seq[string]): int =
       -minDP --minDP <minDP> the minimum DP for a SNP to be included in the output file [default: 1]
       -maxDP --maxDP <maxDP> the maximum DP for a SNP to be included in the output file [default: 5]
       -maxTotalDP --maxTotalDP <maxTotalDP> the maximum DP across all barcodes for a SNP to be included in the output file [default: 25]
-      -minTotalDP --minTotalDP <minTotalDP> the minimum DP across all barcodes for a SNP to be included in the output file [default: 10]
-                             
+      -minTotalDP --minTotalDP <minTotalDP> the minimum DP across all barcodes for a SNP to be included in the output file [default: 10]          
       -chrName --chrName <chrName> the chr names with chr prefix or not, if not supplied then no prefix
       -thetaREF --thetaREF <thetaREF> the theta for the binomial distribution conditioning on hidden state being REF [default: 0.1]
       -thetaALT --thetaALT <thetaALT> the theta for the binomial distribution conditioning on hidden state being ALT [default: 0.9]
@@ -243,12 +242,12 @@ proc sscocaller(argv: var seq[string]): int =
           qoff+=event.len ## the offs to the query sequences
         if cons.reference:
           off += event.len ## the offs to the reference sequences
-          if not cons.query:
-            roff_only += event.len
+          # if not cons.query:
+          #   roff_only += event.len
         if off <= position: continue
-        over = off - position - roff_only
+        over = off - position
         # get the base 
-        base = aln.base_at(qoff - over)
+        #base = aln.base_at(qoff - over-1)
         break
       if aln.base_quality_at(qoff - over-1).cint < minbsq: continue
       total_reads+=1
diff --git a/tests/bcAA.tsv b/tests/bcAA.tsv
index 5d5963d..858dd56 100644
--- a/tests/bcAA.tsv
+++ b/tests/bcAA.tsv
@@ -1,2 +1,2 @@
 AAAGTAGCACGTCTCT-1
-AAAGTAGCACGTCTCT-1
+TAAGTAGCACGTCTCT-1
-- 
GitLab