]> git.donarmstrong.com Git - samtools.git/commitdiff
fixed a bug for unmapped sequences in indexing
authorHeng Li <lh3@live.co.uk>
Sun, 13 Jun 2010 21:29:52 +0000 (21:29 +0000)
committerHeng Li <lh3@live.co.uk>
Sun, 13 Jun 2010 21:29:52 +0000 (21:29 +0000)
bam_index.c

index 6fffd75e1ed5c58c363847abd42fed04e638c5b0..7e026b3e80ebcec17ed4022e6484bd15fbdcf0f4 100644 (file)
@@ -178,7 +178,7 @@ bam_index_t *bam_index_core(bamFile fp)
                                        bam1_qname(b), last_coor, c->pos, c->tid+1);
                        exit(1);
                }
-               insert_offset2(&idx->index2[b->core.tid], b, last_off);
+               if (c->tid >= 0) insert_offset2(&idx->index2[b->core.tid], b, last_off);
                if (c->bin != last_bin) { // then possibly write the binning index
                        if (save_bin != 0xffffffffu) // save_bin==0xffffffffu only happens to the first record
                                insert_offset(idx->index[save_tid], save_bin, save_off, last_off);