Entering edit mode
3.1 years ago
meisam.radfar
•
0
hi
i have a bam file (from tophat2)
i use :
samtools view -b -h -T Triticum_aestivum.fa 19358.bam -o 119358.bam
then:
samtools sort -n 119358.bam -o 119358.sorted.bam
but when i use:
samtools index 119358.sorted.bam
or
samtools index -c 119358.sorted.bam
i see this error:
[E::hts_idx_push] Unsorted positions on sequence #18: 102855883 followed by 102853406
[E::sam_index] Read 'A00783:167:HTLJ3DSXX:3:1101:1036:16689' with ref_name='6D', ref_length=473592718, flags=163, pos=102853406 cannot be indexed
samtools index: failed to create index for "119358.sorted.bam"
i need a sorted bam file (by name or pos.) and a index file for that sorted bam file to use in HTSeq-count. i have to write (-r name or -r pos) in htseq-count. but it seems that when i sort my bam file by -n i cant make index file for it and so i cant count it by htseq-count
htseq-count -q -t gene -i gene_id -s no -r ?????? -f bam x.bam x.gff3 > x.txt