Issues with running featureCounts with STAR
1
0
Entering edit mode
2.2 years ago
ckim159 • 0

I am trying to generate a count table after aligning my CLIP-seq results to a genome index. I have been using several online tutorials, but I am running into an issue when using featureCounts from bioconda subread. I have tried referencing a folder containing BAM files as well as single BAM files for my input, but I keep getting the same invalid parameters error:

featureCounts -a Mus_musculus.GRCm39.109.gtf -o count.out -T 8 bams/*.bam

ERROR: invalid parameter: 'bams/SRR202.fastqAligned.sortedByCoord.out.bam'

Or when I move the bam files to the folder I am in and try a single input:

featureCounts -a Mus_musculus.GRCm39.109.gtf -o count.out -T 8 SRR202fastqAligned.sortedByCoord.out.bam

ERROR: invalid parameter: 'SRR202.fastqAligned.sortedByCoord.out.bam'
RNA CLIP-seq RNA-seq STAR • 2.6k views
ADD COMMENT
0
Entering edit mode

What's the featureCounts version you're using? Can you run featureCounts -h and show the output please?

ADD REPLY
0
Entering edit mode
featureCounts -h

featureCounts: invalid option -- h
Version 2.0.1
ADD REPLY
0
Entering edit mode

That is odd. What is the output of this command file SRR202fastqAligned.sortedByCoord.out.bam?

You should see something like

 gzip compressed data, extra field, original size 0

Edit: Unlike @rfran010 I don't see any problems with the command, switching the order of options etc. Surprisingly *.bam specification picks up all the files automatically (learned something new). I am using v.2.0.3.

ADD REPLY
0
Entering edit mode

I don't think it's a problem with the content of the file or its existence - it's like featureCounts expects a parameter and errors out weirdly.

ADD REPLY
0
Entering edit mode

It seems like there's an issue with you bam file. How does it look?

on version 2.0.6, if I run your command, I get the same error. If I swap the bam file for one of my own, it will start, give the subread output, but then fail to open the annotation file

ADD REPLY
0
Entering edit mode

Hello,

I am running into a similar issue. I am doing RNA seq on cancer cell lines. Workflow: I got back the fastq.gz files, used trimmomatic for trimming, then mapping with STAR, then conversion to BAM, then sorting, all without any issues reported, and then tried running featurecounts. I have done the same thing for various samples in one go, but with this bam file (and other bam files from this particular cell line) I have the following issue:

commandline:

sbatch -n 1 --mem-per-cpu=8000 -c 10 featureCounts_90-8.sh

.sh file:

#!/bin/bash
echo "Start - `date`"
START=$(date +%s)
module load SUBREAD
featureCounts -a Homo_sapiens.GRCh38.105.gtf -p -o 90-8_D21_R2_featurecounts 90-8_D21d_R2_sorted_Aligned.out.bam
ls -R /etc > /tmp/x
rm -f /tmp/x

Slurm content:

Start - Tue Aug 22 16:35:03 BST 2023
[+] Loading SUBREAD 2.0.3
ERROR: invalid parameter: '90-8_D21d_R2_sorted_Aligned.out.bam'

Again, it has worked for all my files (with other cell lines) except for the files with this cell line.

Does anyone know what might be going on? I am using featureCounts v2.0.3. Any help is much appreciated. Please let me know if you need further information.

BW

ADD REPLY
1
Entering edit mode

I wonder if the - in output name is being interpreted as an option. Can you try replacing the - with _ and see if it helps?

I don't remember for v.2.0.3 but for recent version you need to add --countReadPairs in addition to -p to count fragments with PE data.

ADD REPLY
0
Entering edit mode

Are you sure the file 90-8_D21d_R2_sorted_Aligned.out.bam exists? Just going with an educated guess - should the bam file even have R1/R2 in its name?

ADD REPLY
1
Entering edit mode
2.1 years ago
pzm ▴ 10

okay thanks to you I found the issue: I missed a small d for all the files, and so it couldn't find them. Very obvious mistakes. I guess I should have used more easy file names.

I also checked and the - vs _ and it didn't seem to matter.

I should have been able to figure this out by myself, but I checked the file names by eye. Should always do a ctrl F search I suppose. Anyway, Thanks so much for your help!!

ADD COMMENT

Login before adding your answer.

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