ok I will try this.
I am getting following error while using htseq-count over BAM file.
Command used
htseq-count -f bam -s no -a 15 -t exon -m intersection-strict input.sorted_genome_alignments.bam gencode.gtf > output.sorted_genome_alignments.htseq
Input first line:
INPUT_121:8:2205:3570:86937/2 153 chr1 10534 58 50M * 0 0 AGTACCACCGAAATCTGTGCAGAGGAGAACGCAGCTCCGCCCTCGCGGTG CC>2B??DDCCCCEECCDDFHEFHEHJIGGDGEGF@DADHFGFFDFD@@@ RG:Z:110912_UNC15-SN850_0121_AD0E16ABXX_8_ IH:i:7 HI:i:1 NM:i:1
Error as follows
100000 GFF lines processed.
2500000 GFF lines processed.
2536790 GFF lines processed.
Error occured when processing SAM input (record #1 in file input.sorted_genome_alignments.bam):
tid -1 out of range 0<=tid<25
[Exception type: ValueError, raised in csamtools.pyx:897]
Please let me know if there is any solution exists.
1 answer
Oh, I missed the -1 part of that error message. htseq-count doesn't play well with unmapped reads. Just filter them out or:
samtools view -F 4 input.sorted_genome_alignments.bam | htseq-count -f bam -s no -a 15 -t exon -m - intersection-strict gencode.gtf > output.sorted_genome_alignments.htseq
Keep in mind that htseq-count may still compain (you should only get a warning though). You might also try featureCounts, which is much faster.
The hyphen u mentions was after '-m -'.... but it should be after '-m intersection-strict -'
you meant like this rite !!!
samtools view -F 4 input.sorted_genome_alignments.bam | htseq-count -f bam -s no -a 15 -t exon -m intersection-strict **-** gencode.gtf > output.sorted_genome_alignments.htseq
I have tried it ... it seems like htseq-count not getting input from pipe.
Error occured when reading beginning of SAM/BAM file.
Argument must be string or unicode.
[Exception type: TypeError, raised in csamtools.pyx:50]
Try adding -h to the samtools view command (I wrote scripts to automate this sort of thing long enough ago that my memory of the exact details of doing this manually is a bit fuzzy).
It gives the same error even after adding '-h'.
That's a first. You can always just
samtools view -bF 4 input.sorted_genome_alignments.bam > filtered.bam
and use the result, though that's annoying. I think featureCounts is OK with the unmapped reads.
Oops, yeah, that was a typo!
Log in to answer this question.
Can you post the entire header of that file? Just
samtools view -H input.sorted_genome_alignments.bam. The error relates to seeing an alignment to a chromosome that it doesn't think is in the header.Also, please mention which version of htseq-count
I am using HTSeq version 0.6.1p1.
Hello Santhilal Subhash!
It appears that your post has been cross-posted to another site: SeqAnswers.
This is typically not recommended as it runs the risk of annoying people in both communities.
Sorry I have redirected it to biostars.