Hi,
I'm using featureCounts (subread v2.0.2) to generate a count matrix for an RNAseq experiment. I have aligned paired-end .sam files sorted by read name and have specified the -p flag and the −−countReadPairs parameter (please see code below). When I run the command, I get ERROR: invalid parameter: '−−countReadPairs'. featureCounts will work just fine if the −−countReadPairs is not included but as I understand it, in version 2.0.2, −−countReadPairs must be included in order to get counts by fragments (as opposed to earlier versions where -p took care of 1) specifying if reads were paired-end & 2) that read pairs were to be counted). A note on the code below: I changed the path names to the .gtf, output .txt and sorted.sam files in this post for privacy reasons.
Thank you so much for your help! Sandra
$ featureCounts -T 4 -s 2 -p \
--countReadPairs \
-a /path/to/genes.gtf \
-t exon \
-g gene_id \
-o /path/to/featurecountsPE.txt /path/to/aligned/*.sorted.sam \
2> /path/to/aligned/results/counts/featurecountsPE.screen-output1.log
Hi Yang,
Thank you so much for your quick response. It was the ASCII/unicode difference. I ran featureCounts with no problems last nite. I thought I'd checked this before but clearly did not. I'm sorry to have sent you on a semi-wild goose chase testing the source code!
I also ran the command
featureCounts -v
and got[smuroy@ln003 ~]$ featureCounts -v
featureCounts v2.0.2
If I may add a small suggestion. In the Subread users guide (Subread v2.0.2; 17 Jun 2021) Section 6.3, the example command line for paired-end reads is given as:
Summarize paired-end reads and count fragments (instead of reads):
Could you include the
--countReadPairs
for clarity?Thanks again! Sandra
Thank you. We will have the relevant commands updated in the users guide.
Hi Yang,
There seems to a bug with subread when it comes to reading bam files from command line
I am using subread featureCounts 2.0.6 and I am trying this on command line
It gives me an error
I tried the above in 2 different ways
Please also note: If I have only 1 bam file in my directory and I do this below, i.e. not supplying the bam file on command line, then the program starts with creation of temp-core.sam files but nothing happens. Am I missing something?
It would be ideal to fix the above such that explicit bam files can be provided as input on the command line.
Thanks in advance.
NOTE: I tried to post this as a new post - however, the UI keeps preventing it without notifying what is wrong
I don't think that
featureCounts
has this bug.Your first command for running
featureCounts
is correct.FeatureCounts
v2.0.6 ran without errors when I tested the same command in my computer. Can you please make sure thatinput.bam
is in the current directory? You can also use theSAMtools view
command to see if this BAM file has the correct format.Your second command is also correct.
FeatureCounts
will run on the STDIN mode when no input files are given to it. On this mode,featureCounts
will receive SAM-format input from STDIN. But if there is no input fed from STDIN, it will hang forever. It also creates a file namedtemp-core-xxxxxx-xxxxxx.sam
(xxxxxx are random strings) for temporarily storing the input.