OK, so I figured it out, and it was not very intuitive to debug! The problem I had was that when I copied the --minOverlap flag from the user manual pdf, it must have had some non-unicode characters which made featureCounts to think that --minOverlap and 5 (the value I set) were files, not a flag and it's value.
Running the code below is bad:
/home/me/bin/subread-1.5.0-Linux-x86_64/bin/featureCounts -p -M −−minOverlap 1 --fraction -s 0 -T 1 -C -R -t exon -g gene_id -a /home/me/project/me/Reference/mouse/GRCm38_mm10/gencode.vM8.primary_assembly.annotation.gtf -o TestYA.multicounts.txt /home/me/test/star/TestYAAligned.sortedByCoord.out.bam
Looking at the pre-run log you can see:
========== _____ _ _ ____ _____ ______ _____
===== / ____| | | | _ \| __ \| ____| /\ | __ \
===== | (___ | | | | |_) | |__) | |__ / \ | | | |
==== \___ \| | | | _ <| _ /| __| / /\ \ | | | |
==== ____) | |__| | |_) | | \ \| |____ / ____ \| |__| |
========== |_____/ \____/|____/|_| \_\______/_/ \_\_____/
v1.5.0
//========================== featureCounts setting ===========================\\
|| ||
|| Input files : 1 BAM file 2 unknown files ||
|| ? −−minOverlap || <- LOOK HERE
|| ? 1 || <- HERE
|| P /home/me/test/TestYAAligned. ... ||
|| ||
|| Output file : TestYA.multicounts.txt ||
|| Annotations : /home/me/project/me/Reference/m ... ||
|| Assignment details : <input_file>.featureCounts ||
|| ||
|| Threads : 1 ||
|| Level : meta-feature level ||
|| Paired-end : yes ||
|| Strand specific : no ||
|| Multimapping reads : counted (as fractions) ||
|| Multi-overlapping reads : not counted ||
|| Read orientations : fr ||
|| ||
|| Chimeric reads : not counted ||
|| Both ends mapped : not required ||
|| ||
\\===================== http://subread.sourceforge.net/ ======================//
//================================= Running ==================================\\
|| ||
|| Load annotation file /home/me/project/me/Reference/mouse/ ... ||
|| Features : 701120 ||
|| Meta-features : 47069 ||
|| Chromosomes/contigs : 45 ||
|| ||
|| Process Unknown file −−minOverlap... ||
|| Single-end reads are included. ||
|| Failed to open file −−minOverlap ||
|| No counts were generated for this file. ||
|| ||
|| Process Unknown file 1... ||
|| Single-end reads are included. ||
|| Failed to open file 1 ||
|| No counts were generated for this file. ||
|| ||
|| Process BAM file /home/me/test/star/TestYAAligned.sortedByCoo ... ||
|| Paired-end reads are included. ||
|| Assign fragments (read pairs) to features... ||
|| Total fragments : 832 ||
|| Successfully assigned fragments : 18 (2.2%) ||
|| Running time : 0.00 minutes ||
|| ||
|| Read assignment finished. ||
|| ||
\\===================== http://subread.sourceforge.net/ ======================//
When the code is run this way, no reads are reported in the output file (although in theory they should, if you look at the log!/
If, however, I paste the flag from the command line (i.e. by pasting from running featureCounts without arguments) all is well and I get
/home/me/bin/subread-1.5.0-Linux-x86_64/bin/featureCounts --minOverlap 1 -p -M --fraction -s 0 -T 1 -C -R -t exon -g gene_id -a /home/me/project/me/Reference/mouse/GRCm38_mm10/gencode.vM8.primary_assembly.annotation.gtf -o TestYA.multicounts.txt /home/me/test/star/TestYAAligned.sortedByCoord.out.bam
This works!
The relevant bit of the log file looks like this:
//========================== featureCounts setting ===========================\\
|| ||
|| Input files : 1 BAM file ||
|| P /home/me/test/TestYAAligned. ... ||
|| ||
|| Output file : TestYA.multicounts.txt ||
|| Annotations : /home/me/project/me/Reference/m ... ||
|| Assignment details : <input_file>.featureCounts ||
And the output of my about head/awk pipe is:
cat TestYA.multicounts.txt| awk '{print $7}' | sort | uniq
0
1
2.50
/home/me/test/TestYAAligned.sortedByCoord.out.bam
"-p"
As I would expect.
Another thing I found out in the process is that if you include an incorrect flag for stranding:
/home/me/bin/subread-1.5.0-Linux-x86_64/bin/featureCounts --minOverlap 5 -p -M --fraction -s LALA -T 1 -C -R -t exon -g gene_id -a /home/me/project/me/Reference/mouse/GRCm38_mm10/gencode.vM8.primary_assembly.annotation.gtf -o TestYA.multicounts.txt /home/me/test/TestYAAligned.sortedByCoord.out.bam
Instead of flipping, featureCounts will just count the data as unstranded. An important GOTCHA ... Not sure which other variables are not tested for integrity...
You're working in bash, not R right?
From your first cat | awk | etc. you get: "--fraction"
So my guess there is something wrong with that? Maybe this argument is not correctly given? Are the dashes ok?
Yes, I'm in bash, but, unfortunately, that's not the case. If you look at the results of my head command, I'm getting exactly what I would expect:
"--fraction" from line 1:
And all of the rest of the lines of the file (wc -l identifies 47071 lines in the file, with each line looking like line 3) have nothing (not even a zero!) in the 7th field. I would think that if all was well, featureCounts would at least write all zeros ... But I can't see a message in the error file that would explain to me why it's all failing!
/Figured out below/