Question: how to generate a bai ?
0
gravatar for manubiomed20
12 months ago by
manubiomed2010
manubiomed2010 wrote:

I made a complete genome assembly and then tried to generate a bai using this command (with the file path):

samtools index /home/ims.santos06/bam/SRR062634.bam/home/ims.santos06/bam/SRR062634.bam.bai

but it did not work because of this error:

[E :: hts_idx_push] Unsorted positions on sequence # 6: 68538456 followed by 68538386
samtools index: failed to create index for "/home/ims.santos06/bam/SRR062634.bam".

Was it a mistake in the assembly? How do I solve this problem?

assembly • 380 views
ADD COMMENTlink modified 12 months ago by RamRS27k • written 12 months ago by manubiomed2010

A message to both manubiomed20 and darbinator :

Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.
code_formatting

ADD REPLYlink written 12 months ago by RamRS27k

Indexing automatically generates a file which ends in .bai and uses the name of the BAM file you used as an input for samtools index.

ADD REPLYlink written 12 months ago by genomax84k
3
gravatar for darbinator
12 months ago by
darbinator220
darbinator220 wrote:

You need to sort your alignments files before to index them:

samtools sort yourfile.bam > yourfile.sorted.bam
ADD COMMENTlink modified 12 months ago by RamRS27k • written 12 months ago by darbinator220
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1343 users visited in the last hour