Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTSeq: mismatched quotes issue? Artur Jaroszewicz RNA Sequencing 11 09-26-2014 12:23 PM
HTSeq-count issue zuco RNA Sequencing 2 08-16-2013 12:30 AM
MV emPCR issue ajthomas 454 Pyrosequencing 1 10-23-2012 09:12 PM
Issue with htseq-count cpleis Bioinformatics 8 10-15-2012 10:31 AM
samtools sort stdout pederworning Bioinformatics 4 04-09-2011 09:02 AM

Thread Tools
Old 11-20-2013, 05:52 PM   #1
Junior Member
Location: New York, USA

Join Date: May 2013
Posts: 5
Default HTSeq issue with stdout/stdin

Hello All,

I like to apply HTSeq-count on a .bam file, but if I directly pipe the output of samtools to htseq it gives me an error. However, if I first write the sorted file in a temporary file and then apply samtools-view and htseq-count on this temp file, there is no error!
Do you know what might be causing this problem?

Case (1): [generates error]

$ samtools sort -on -m 300000000 accepted_hits.bam | samtools view -h - | htseq-count -m union - hg19.gtf > output.count

Error occured when reading first line of sam file.
[Exception type: StopIteration, raised in]

Case (2): [no error!]
$ samtools sort -n -m 300000000 accepted_hits.bam temp-sorted.bam
$ samtools view -h temp-sorted.bam | htseq-count -m union - hg19.gtf > output.count

Thank You,
norafar is offline   Reply With Quote
Old 11-27-2013, 11:55 PM   #2
Simon Anders
Senior Member
Location: Heidelberg, Germany

Join Date: Feb 2010
Posts: 994

'samtools sort' does not write to stdout, so you cannot use piping.
Simon Anders is offline   Reply With Quote
Old 11-30-2013, 04:22 PM   #3
Junior Member
Location: Seattle, WA

Join Date: Feb 2013
Posts: 3

norafar, include the - file marker as output on the sort and it should work.

samtools sort -on -m 300000000 accepted_hits.bam - | samtools view -h - | htseq-count -m union - hg19.gtf > output.count

Last edited by arm55; 11-30-2013 at 04:25 PM. Reason: Better answer
arm55 is offline   Reply With Quote

htseq, htseq count, rna seq

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -8. The time now is 02:50 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO