Htseq Count Sam
3
1
Entering edit mode
12.1 years ago
Varun Gupta ★ 1.3k

Hi everyone

I want to use htseq-count to count the number of reads for the features i have but htseq-count says:

If you have paired-end data, you have to sort the SAM file by read name first.

How can i do that if i don't want to use msort.

Regards V

htseq counts • 5.5k views
ADD COMMENT
2
Entering edit mode
12.1 years ago
Linxe ▴ 30

Use samtools for sorting: samtools sort -n file.bam filesortedbyreadname

ADD COMMENT
0
Entering edit mode

Does 'samtools sort -n' properly handle paired end data with multiple alignments per read (e.g. rna-seq reads aligned by TopHat)?

ADD REPLY
0
Entering edit mode

Hi Malachi, i am having exactly the same problem. Did you sort out how to deal with this?

ADD REPLY
0
Entering edit mode

For htseq-count it won't actually matter as multimapping reads will be ignored in any case (htseq-count looks at the NH:i: auxiliary tag).

ADD REPLY
0
Entering edit mode

You have mentioned that SAM file has to be sorted but in the answer you have mentioned a BAM file. ??? Is that a TYPO ???

ADD REPLY
1
Entering edit mode
10.5 years ago
Irsan ★ 7.8k

You can also use SortSam.jar from picardtools

java -jar /path_to_folder_picardtools/SortSam.jar INPUT=yourfile.sam OUTPUT=readSorted.sam SORT_ORDER=queryname VALIDATION_STRINGENCY=lenient
ADD COMMENT
0
Entering edit mode
10.5 years ago
sethugunja ▴ 60

I have the same question, I have sorted the .bam file and convert it to .sam file : didnt work for ht seq, then I have sorted the .sam file and given for ht seq, didnt work..!! Do you have any other suggestions for sorting the sam file (paired end data) by read name?

ADD COMMENT
1
Entering edit mode

Firstly, try starting a new thread rather than just answering an almost year-old question with another question. Secondly, we can't help you if you just says "does not work" without providing any details. We're good, but we don't read minds.

ADD REPLY

Login before adding your answer.

Traffic: 1997 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