htseq-count error
1
0
Entering edit mode
2.7 years ago

Hi,

htseq-count -f bam -s yes ~/htseq-trial/SRR13826419_Aligned.sortedByName.out.bam ~refgen/gencode.v39.primary_assembly.annotation.gtf > counts.txt

I am trying to run htseq-count with command above but in the err file

  [E::idx_find_and_load] Could not retrieve index file for '~/htseq-trial/SRR13826419_Aligned.sortedByName.out.bam'
    100000 GFF lines processed.
    200000 GFF lines processed.
    300000 GFF lines processed.
    400000 GFF lines processed.
    500000 GFF lines processed.
    600000 GFF lines processed.
    700000 GFF lines processed.
    800000 GFF lines processed.
    900000 GFF lines processed.
    1000000 GFF lines processed.
    1100000 GFF lines processed.
    1200000 GFF lines processed.
    1300000 GFF lines processed.
    1400000 GFF lines processed.
    1500000 GFF lines processed.
    1600000 GFF lines processed.
    1700000 GFF lines processed.
    1800000 GFF lines processed.
    1900000 GFF lines processed.
    2000000 GFF lines processed.
    2100000 GFF lines processed.
    2200000 GFF lines processed.
    2300000 GFF lines processed.
    2400000 GFF lines processed.
    2500000 GFF lines processed.
    2600000 GFF lines processed.
    2700000 GFF lines processed.
    2800000 GFF lines processed.
    2900000 GFF lines processed.
    3000000 GFF lines processed.
    3100000 GFF lines processed.
    3200000 GFF lines processed.
    3241580 GFF lines processed.
    [E::idx_find_and_load] Could not retrieve index file for '~/htseq-trial/SRR13826419_Aligned.sortedByName.out.bam'
    100000 alignment record pairs processed.
    200000 alignment record pairs processed.
    300000 alignment record pairs processed.
    400000 alignment record pairs processed.
    500000 alignment record pairs processed.
    600000 alignment record pairs processed.
    700000 alignment record pairs processed.
    800000 alignment record pairs processed.
    900000 alignment record pairs processed.
    1000000 alignment record pairs processed.
    1100000 alignment record pairs processed.
    1200000 alignment record pairs processed.
    1300000 alignment record pairs processed.
    1400000 alignment record pairs processed.
    1500000 alignment record pairs processed.
    1600000 alignment record pairs processed.
    1700000 alignment record pairs processed.
    1800000 alignment record pairs processed.
    1900000 alignment record pairs processed.
    2000000 alignment record pairs processed.
    2100000 alignment record pairs processed.
    2200000 alignment record pairs processed.
    2300000 alignment record pairs processed.
    2400000 alignment record pairs processed.
    2500000 alignment record pairs processed.
    2600000 alignment record pairs processed.
    2700000 alignment record pairs processed.
    2800000 alignment record pairs processed.
    2900000 alignment record pairs processed.
    3000000 alignment record pairs processed.
    3100000 alignment record pairs processed.
    3200000 alignment record pairs processed.
    3300000 alignment record pairs processed.
    3400000 alignment record pairs processed.
    3500000 alignment record pairs processed.
    3600000 alignment record pairs processed.
    3700000 alignment record pairs processed.
    3800000 alignment record pairs processed.
    3900000 alignment record pairs processed.
    4000000 alignment record pairs processed.
    4100000 alignment record pairs processed.
    4200000 alignment record pairs processed.
    4300000 alignment record pairs processed.
    4400000 alignment record pairs processed.
    4500000 alignment record pairs processed.
    4600000 alignment record pairs processed.
    4700000 alignment record pairs processed.
    4800000 alignment record pairs processed.
    4900000 alignment record pairs processed.
    5000000 alignment record pairs processed.
    5100000 alignment record pairs processed.
    5200000 alignment record pairs processed.
    5300000 alignment record pairs processed.
    5400000 alignment record pairs processed.
    5500000 alignment record pairs processed.
    5600000 alignment record pairs processed.
    5700000 alignment record pairs processed.
    5800000 alignment record pairs processed.
    5900000 alignment record pairs processed.
    6000000 alignment record pairs processed.
    6100000 alignment record pairs processed.
    6200000 alignment record pairs processed.
    6300000 alignment record pairs processed.
    6400000 alignment record pairs processed.
    6500000 alignment record pairs processed.
    6600000 alignment record pairs processed.
    6700000 alignment record pairs processed.
    6800000 alignment record pairs processed.
    6900000 alignment record pairs processed.
    7000000 alignment record pairs processed.
    7100000 alignment record pairs processed.
    7200000 alignment record pairs processed.
    7300000 alignment record pairs processed.
    7400000 alignment record pairs processed.
    7500000 alignment record pairs processed.
    7600000 alignment record pairs processed.
    7700000 alignment record pairs processed.
    7800000 alignment record pairs processed.
    7900000 alignment record pairs processed.
    8000000 alignment record pairs processed.
    8100000 alignment record pairs processed.
    8200000 alignment record pairs processed.
    8300000 alignment record pairs processed.
    8400000 alignment record pairs processed.
    8500000 alignment record pairs processed.
    8600000 alignment record pairs processed.
    8700000 alignment record pairs processed.
    8767930 alignment record pairs processed.

So what should I do for that index file?

htseq rnaseq rna-seq • 2.6k views
ADD COMMENT
3
Entering edit mode
2.7 years ago
iraun 6.2k

You have to index the bam file:

samtools index ~/htseq-trial/SRR13826419_Aligned.sortedByName.out.bam
ADD COMMENT
2
Entering edit mode

Yes, and for this you have to sort by coordinate. Make your life easy and use featureCounts, it is faster and works on name-sorted files out of the box.

ADD REPLY
0
Entering edit mode

I know featureCounts but my prof wants me to learn htseq besides featurecounts. Thanks again

ADD REPLY
0
Entering edit mode

I ran the same command but when I run the htseq;

OSError: [Errno 8] could not open alignment file `~/sbatch/SRR13826419_Aligned.sortedByName_index.out.bam`: Exec format error
ADD REPLY
1
Entering edit mode

the index should have extension .bai normally

ADD REPLY
0
Entering edit mode

but can i use .bai file as an input for htseq-count?

ADD REPLY
0
Entering edit mode

Should they be in the same path, the .bai and .bam?

ADD REPLY
2
Entering edit mode

You should use the bam files as input and leave the index files in the same folder as the bam files.

ADD REPLY
0
Entering edit mode

Yes I just figured that out thanks again :))

ADD REPLY

Login before adding your answer.

Traffic: 2701 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6