There is a fundamental limit in the BAI format for the reference limits, a
problem with some large genomes (e.g. barley, some marsupials). You appear
to have a reference nearly 760Mbp long, which exceeds the 512Mbp limit.
This is one of the benefits of using CSI instead.

If you have to use legacy callers which do not support CSI and only BAI,
you may be forced to truncate your references? Perhaps there are natural
break points (although the best choice will be influenced by the kind of
variants you are looking for)/

Peter

On Thu, Apr 21, 2022 at 6:39 AM Ruixue Liu <rli...@uoguelph.ca> wrote:

> Dear samtools staff,
>
> I would like to ask help about samtools index. The thing is I failed to
> generate indexed.bam.bai. Here is the error msg:
>
> $ samtools index -b -@ 20 aln.sorted.cy201704.bam
>
> [E::hts_idx_check_range] Region 536856988..536888726 cannot be stored in a
> bai index. Try using a csi index
> [E::sam_index] Read 'm64291e_211224_041609/132253067/22850_47574' with
> ref_name='chr1', ref_length=759857066, flags=16, pos=536856989 cannot be
> indexed
> samtools index: failed to create index for "aln.sorted.cy201704.bam":
> Numerical result out of range
>
> I guess there are some very long contigs/chromosomes in 
> aln.sorted.cy201704.bam.
> I know I should and actually have generated the csi index in this case. But
> the next step in my plan is to call the variants. Those callers I know,
> like sniffles, SVIM, only accept BAI index as input.
>
> Do you have suggestions for this situation? Maybe there is a caller that
> can take CSI index as input? Or there is a way to convert CSI index to BAI
> index?
>
> Thank you fou your time. I'm looking forward to your reply.
>
> Regards,
>
>
> Ruixue
>
> PhD Candidate | Jinzhong Fu’s Lab
>
> Department of Integrative Biology
>
> University of Guelph
> 50 Stone Rd E | Guelph, ON | N1G 2W1
>
> _______________________________________________
> Samtools-help mailing list
> Samtools-help@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/samtools-help
>
_______________________________________________
Samtools-help mailing list
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to