featuresCount order sam file?
1
0
Entering edit mode
4.4 years ago
noeD ▴ 100

Hello!

I am using featuresCount for read summarization, with the following command:

featureCounts -T 5 -t exon -g gene_name -a genomehg38.gtf -o counts.txt file.sam

I am wondering if I had to sort by name my sam file before to use featureCounts. I have read the featuresCount's documentation but I didn't understand it.

Thank you in advance

Best

featuresCount RNA-Seq gtf sort • 2.8k views
ADD COMMENT
2
Entering edit mode

It would be helpful for you to understand how featurecounts works if you tried both the options. Try it with and without sorted sam and let us know if it makes any difference.

From here ,

Due to internal requirements of featureCounts (ie., since it only counts feature hits if both read ends align to the same feature), these coordinate-sorted BAM input files are detected by the featureCounts binary and name-sorted prior to processing. Name-sorting occurs by featureCounts itself (as part of the binary), on a single core and in the current working directory.

ADD REPLY
1
Entering edit mode

Thank you! I have tried now and the results were the same :) Thank you again!

ADD REPLY
0
Entering edit mode

Thanks @noeD

ADD REPLY
2
Entering edit mode
4.4 years ago
h.mon 33k

No, you do not need to sort by name, although it needs either position or name sorted sam / bam. From the manual, page 29:

Automatically detect input format (SAM or BAM).

Automatically sort paired-end reads. Users can provide either location-sorted or name- sorted bams files to featureCounts. Read sorting is implemented on the fly and it only incurs minimal time cost.

ADD COMMENT
0
Entering edit mode

I apologize in advance for the stupid question... but what you mean with "No, you do not need to sort by name, although it needs either position or name sorted sam / bam"? I tried the tool without providing other files and it works, but I would like to be sure that it is the right procedure. Thank you for your kindly help!

ADD REPLY
0
Entering edit mode

How did you get your sam file? Did you sort it, or know if the mapper sorts it on the fly? And what do you mean by

I tried the tool without providing other files

What other files? You only need the gtf annotation and the sam / bam mapping file.

ADD REPLY
0
Entering edit mode

It is the result of the alignment by HISAT 2... I didn't re-order it after that and I don't know if the mapper sorts it on the fly...

ADD REPLY
1
Entering edit mode

I don't think it does. You may want to try samtools sort on the HiSAT2 output.

ADD REPLY
0
Entering edit mode

I have tried to use featuresCount sorting the read and without doing it... I obtained the same result...

ADD REPLY

Login before adding your answer.

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