This is a test version of Biostars. For the public version, visit https://www.biostars.org.
R featureCounts throws error over SAF format

Hello,

I'm trying to run R featureCounts on SAM files with a SAF annotation file that looks like this:

Chr Start   End Strand  GeneID
NC_000067.6 3102016 3102125 +   LOC115487594
NC_000067.6 3102016 3102125 +   LOC115487594
NC_000067.6 3199733 3671948 -   Xkr4
NC_000067.6 3199733 3671948 -   Xkr4
NC_000067.6 3214482 3671498 -   Xkr4
NC_000067.6 3216022 3671348 -   Xkr4
NC_000067.6 3216022 3671348 -   Xkr4
NC_000067.6 3252734 3253236 +   Gm18956
NC_000067.6 3322816 3671948 -   Xkr4
........

The Chr values are accessions on purpose, since this is what appears in my SAM files and I read they should me the same.

I ran the following command:

> fc <- featureCounts(filenames, annot.ext ="./feature_table_intervals.tsv", isGTFAnnotationFile = FALSE)

And got the following output:

        ==========     _____ _    _ ____  _____  ______          _____  
        =====         / ____| |  | |  _ \|  __ \|  ____|   /\   |  __ \ 
          =====      | (___ | |  | | |_) | |__) | |__     /  \  | |  | |
            ====      \___ \| |  | |  _ <|  _  /|  __|   / /\ \ | |  | |
              ====    ____) | |__| | |_) | | \ \| |____ / ____ \| |__| |
        ==========   |_____/ \____/|____/|_|  \_\______/_/    \_\_____/
       Rsubread 1.32.4

//========================== featureCounts setting ===========================\\
||                                                                            ||
||             Input files : 1 SAM file                                       ||
||                           S aged12h2002.fastq_1_40.trimmed_genome_-l_4 ... ||
||                                                                            ||
||              Annotation : feature_table_intervals.tsv (SAF)                ||
||      Dir for temp files : .                                                ||
||                 Threads : 1                                                ||
||                   Level : meta-feature level                               ||
||              Paired-end : no                                               ||
||      Multimapping reads : counted                                          ||
|| Multi-overlapping reads : not counted                                      ||
||   Min overlapping bases : 1                                                ||
||                                                                            ||
\\===================== http://subread.sourceforge.net/ ======================//

//================================= Running ==================================\\
||                                                                            ||
|| Load annotation file feature_table_intervals.tsv ...                       ||

Error: Line 1 contains a format error. The expected annotation format is SAF.
Error in featureCounts(filenames, annot.ext = "./feature_table_intervals.tsv",  : 
  No counts were generated.
>

Can anyone help me with what the problem is here? I generated the tsv file according to the SAF format definition I found here: https://www.rdocumentation.org/packages/Rsubread/versions/1.22.2/topics/featureCounts Ant idea what am I doing wrong? Thank you

r rna-seq

1 answer

This is not SAF format. SAF is Name-Chr-Start-End-Strand separated by tab, you are missing Name as $1 where Name in your case is GeneID. Please read the manual and please first follow up on your previous question before opening new questions on the same basic topic.

The OP's link says that SAF format has Gene ID as a column header, and says that the columns may be in any order.

The featureCounts() documentation page I cited states:

Users may also choose to provide their own annotation for summarization. If users provide a SAF (Simplified Annotation Format) annotation, the annotation should have the following format:

GeneID Chr Start End Strand 497097 chr1 3204563 3207049 - 497097 chr1 3411783 3411982 - 497097 chr1 3660633 3661579 - 100503874 chr1 3637390 3640590 - 100503874 chr1 3648928 3648985 - 100038431 chr1 3670236 3671869 - ... The SAF annotation format has five required columns, including GeneID, Chr, Start, End and Strand. These columns can be in any order. More columns can be included in the annotation. Columns are tab-delimited. Column names are case insensitive. GeneID column may contain integers or character strings. Chromosomal names included in the Chr column must match those used inclued in the mapping results, otherwise reads will fail to be assigned. Users may provide a SAF annotation in the form of a data frame or a file using the annot.ext argument.

Log in to answer this question.