Entering edit mode
5.9 years ago
sunnykevin97
▴
990
Hi after sorting not able to index the bam file showing error, how to sort it out ?
samtools index -b -@ 4 A-DS1546_1__R1_dedup_2_ReadGroupssorted.bam
[E::hts_idx_push] unsorted positions on sequence #1: 1 followed by 0 samtools index: failed to create index for "A-DS1546_1__R1_dedup_2_ReadGroupssorted.bam"
thanks!
As said finswimmer in this post : How to specify the sort based on name in samtools sort?
I tried to index the sorted bam file
Hello sunnykevin97,
Please use the formatting bar (especially the
code
option) to present your post better. I've done it for you this time.Thank you!
Can you show the sort command?
samtools sort -@ 4 A-DS1546_1__R1_dedup_2_ReadGroups.bam -o A-DS1546_1__R1_dedup_2_ReadGroupssorted.bam
Do you have information in your
A-DS1546_1__R1_dedup_2_ReadGroupssorted.bam
(not empty)It generated a sorted bam file ~70 GB
I shorten your comment as you reply the exact same thing to ATpoint and he has took his time to reformat your comment
This is a sam file not a bam fileCome on, show some effort. Did you try anything, did you look at the data? Please show some lines of the file.
Folks, is it normal for those first two entries to not have the -f 4 flagged, but to have mapping coordinates of 0?
Seems like the mate is unmapped for the two first entries. But if the read is mapped there should has be a position
Can we see the alignment command line please ?
hello, this the command line they used..
Could you check if your bam is not truncated or corrupt
How to systematically check if a bam file is truncated
How was the unsorted bam file generated? Is this the output from an aligner or is it converted from a sam file? Check to confirm that there is a header on your sam file:
For alignment BWA sampe they used, I downloaded 7 sorted bam files from a NCBI bioproject. I don't have any problem with other bam files except this. I tried to call variants using this bam file the problems persists repeatedly. How to sort it out ?
samtools view -H A-DS1546_1__R1_dedup_2_ReadGroupssorted.bam | head