I have a total RNAseq dataset that I aligned using STAR producing BAM files (sorted by coordinates). I am now trying to get counts for the lncRNA sequences using htseq-count, with the command:

htseq-count -m intersection-nonempty -f bam -i gene_id -r pos -s reverse ./OVCA429_Aligned.sortedByCoord.out.bam ./GRCh38_latest_genomic.gtf > ./OVCA429.counts.txt

This is the output:

[E::idx_find_and_load] Could not retrieve index file for './OVCA429_587680_1_1.rnaseq.fastqAligned.sortedByCoord.out.bam'
100000 GFF lines processed.
200000 GFF lines processed.
300000 GFF lines processed.
400000 GFF lines processed.
...(truncated output here)...
3775001 GFF lines processed.
[E::idx_find_and_load] Could not retrieve index file for './OVCA429_587680_1_1.rnaseq.fastqAligned.sortedByCoord.out.bam'
100000 alignment records processed.
200000 alignment records processed.
300000 alignment records processed.
...(truncated output here)...

Output text file:
__no_feature    20368875
__ambiguous 0
__too_low_aQual 0
__not_aligned   0
__alignment_not_unique  2634439

I've read through the htseq-count literature but it never asks to include an index file, therefore i'm not sure how to deal with this problem. Any help/ suggestions would be welcome! Thank you, in advance.


The problem seems to be missing index files of the bam files (therefore the error message that the index file is missing). You should be able to generate those with samtools, e.g.

samtools index ./OVCA429_587680_1_1.rnaseq.fastqAligned.sortedByCoord.out.bam
  • $\begingroup$ As it happens I did have the index file as well, I just ended up naming it differently and so the application probably didn't recognise it. Once I changed the name to match the bam file, it worked out perfectly file. Nevertheless, thank you for your help! :) $\endgroup$
    – anjali_yen
    Sep 13 '20 at 18:56
  • $\begingroup$ Ah, I did not even think this could be a problem as samtools do not give you an option to give it a different name. GLad you resolved it! $\endgroup$
    – Kamil S Jaron
    Sep 14 '20 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.