]> git.donarmstrong.com Git - samtools.git/blobdiff - bam2bcf_indel.c
Fixed errors introduced by the 8c15f916dabce475febdf508a9cc0c708c5a7747 commit.
[samtools.git] / bam2bcf_indel.c
index 11cd371978e6e654987d35c35dd6465539a22523..ab9e83ca8f712ae7d7975d67b94b10c702e64908 100644 (file)
@@ -162,8 +162,8 @@ int bcf_call_gap_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos, bcf_calla
                        }
                }
         // To prevent long stretches of N's to be mistaken for indels (sometimes thousands of bases),
-        //  check the number of N's in the sequence. TODO: this may not be the best place and the best way of doing it
-        int nN=0; for (i=0; i<max_rd_len && ref[i]; i++) if ( ref[i]=='N' ) nN++;
+        //  check the number of N's in the sequence and skip places where half or more reference bases are Ns.
+        int nN=0; for (i=pos; i-pos<max_rd_len && ref[i]; i++) if ( ref[i]=='N' ) nN++;
         if ( nN*2>i ) return -1;
 
                ks_introsort(uint32_t, m, aux);