Browse code

fixes for keep_ref=TRUE

Michael Lawrence authored on 14/09/2017 18:30:38
Showing2 changed files

... ...
@@ -9,7 +9,7 @@ Description: GSNAP and GMAP are a pair of tools to align short-read
9 9
         methods to work with GMAP and GSNAP from within R. In addition,
10 10
         it provides methods to tally alignment results on a
11 11
         per-nucleotide basis using the bam_tally tool.
12
-Version: 1.19.1
12
+Version: 1.19.2
13 13
 Depends: R (>= 2.15.0), methods, GenomeInfoDb (>= 1.1.3),
14 14
         GenomicRanges (>= 1.17.12), Rsamtools (>= 1.17.8)
15 15
 Imports: S4Vectors (>= 0.13.13), IRanges, 
... ...
@@ -152,7 +152,8 @@ variantSummary <- function(x, read_pos_breaks = NULL,
152 152
   gr <- with(tally,
153 153
              VRanges(seqnames,
154 154
                      IRanges(pos,
155
-                             width = ifelse(nchar(alt) == 0, nchar(ref), 1L)),
155
+                             width = ifelse(nchar(alt) == 0 & !is.na(alt),
156
+                                            nchar(ref), 1L)),
156 157
                      ref, alt,
157 158
                      count.total, count.ref, count,
158 159
                      seqlengths = seqlengths(genome)))
... ...
@@ -173,7 +174,7 @@ checkTallyConsistency <- function(x) {
173 174
 }
174 175
 
175 176
 normalizeIndelAlleles <- function(x, genome) {
176
-  is.indel <- nchar(ref(x)) == 0L | nchar(alt(x)) == 0L
177
+  is.indel <- nchar(ref(x)) == 0L | (nchar(alt(x)) == 0L & !is.na(alt(x)))
177 178
   if (any(is.indel)) {
178 179
     indels <- x[is.indel]
179 180
     flanks <- flank(indels, 1)