Aborted session in R using featureCounts in Rsubread
2
0
Entering edit mode
8.4 years ago
PSB • 0

Hi,

I'm using Ubuntu 14.04 and R version 3.2.2 with RStudio version 0.99.484 and my session crash when I'm using featureCounts from Rsubread version 1.20.2 package.

I used featureCounts with no problems using mus_musculus.grcm38.82.gtf GTF archive from Ensembl over 12 miRNA-Seq BAM files. This is the code:

newcount = featureCounts(
    files=c("1077_C274.bam", "1078_C283.bam",
        "1079_C3_MAC-277.bam", "1080_M1-MA-269.bam",
        "1081_M2-MA-239.bam", "1082_M3-MA-305.bam",
        "1083_CM1-363.bam", "1084_CM2-369.bam",
        "1085_CM3-MAC-360.bam", "1086_MM1-MA-376.bam",
        "1087_MM2-MA-383.bam", "1088_MM3-MA-342.bam"),
    annot.ext="Mus_musculus.GRCm38.82.gtf",
    isGTFAnnotationFile=TRUE)

I tried to repeat that but with a SAF file obtained from mmu.gff3 from miRBase. The file I created (using awk mostly) looks like:

GeneID    Chr    Start    End    Strand
MI0021869    chr1    12425986    12426106    +
MIMAT0025084    chr1    12426016    12426038    +
MI0000249    chr1    20679010    20679082    +
MIMAT0017004    chr1    20679017    20679039    +
MIMAT0000239    chr1    20679055    20679076    +
MI0000821    chr1    20682769    20682887    +
MIMAT0017083    chr1    20682797    20682818    +
MIMAT0000769    chr1    20682834    20682855    +
MI0000144    chr1    23272269    23272339    +
MIMAT0000128    chr1    23272274    23272295    +
MIMAT0000129    chr1    23272315    23272336    +
MI0000548    chr1    23291701    23291784    +
MIMAT0000514    chr1    23291714    23291736    +

Both R and Rstudio crash when I used this code:

countmiRNAs = featureCounts(
    files=c("1077_C274.bam", "1078_C283.bam",
        "1079_C3_MAC-277.bam", "1080_M1-MA-269.bam",
        "1081_M2-MA-239.bam", "1082_M3-MA-305.bam",
        "1083_CM1-363.bam", "1084_CM2-369.bam",
        "1085_CM3-MAC-360.bam", "1086_MM1-MA-376.bam",
        "1087_MM2-MA-383.bam", "1088_MM3-MA-342.bam"),
    annot.ext="miRNAs_mmu")

I also used featureCounts version 1.5.0 from the Subread package from sourceforge. It gives me a segfault error.

Surprisingly, RStudio crashes even when I use the first code I posted. I thought it was something about the memory usage but it keeps low. I tried deleting some objects from the workspace and reinstalling the package, but nothing changed.

A friend gave me her annotation file and 1 of her BAM files and featureCounts worked fine. I did not change nothing of the original BAM files.

Have you ever crossed with this issue? Any idea about fixing it? Maybe creating a new SAF file in some other way?

Thanks in advance and sorry for my english. If you need more info or it is incomplete, I'd be glad to update.

Edit: Using a BAM file with no header featureCounts runs with no problem. The header of one of the BAM files looks like:

@HD    VN:1.4    GO:none    SO:coordinate
@SQ    SN:chr1    LN:195471971
@SQ    SN:chr2    LN:182113224
@SQ    SN:chr3    LN:160039680
@SQ    SN:chr4    LN:156508116
@SQ    SN:chr5    LN:151834684
@SQ    SN:chr6    LN:149736546
@SQ    SN:chr7    LN:145441459
@SQ    SN:chr8    LN:129401213
@SQ    SN:chr9    LN:124595110
@SQ    SN:chr10    LN:130694993
@SQ    SN:chr11    LN:122082543
@SQ    SN:chr12    LN:120129022
@SQ    SN:chr13    LN:120421639
@SQ    SN:chr14    LN:124902244
@SQ    SN:chr15    LN:104043685
@SQ    SN:chr16    LN:98207768
@SQ    SN:chr17    LN:94987271
@SQ    SN:chr18    LN:90702639
@SQ    SN:chr19    LN:61431566
@SQ    SN:chrX    LN:171031299
@SQ    SN:chrY    LN:91744698
@SQ    SN:chrM    LN:16299
Rsubread featureCounts R BAM miRNA-Seq • 4.8k views
ADD COMMENT
0
Entering edit mode

No error message?

ADD REPLY
0
Entering edit mode

Hi, just pop-ups a window saying:

R Session aborted

R encountered a fatal error.

The session was terminated.

And a button of "Start New Session".

ADD REPLY
0
Entering edit mode

And if you try the same mapping using the command-line version of featureCounts? Does it works?

edit: I like RStudio a lot, but it interacts badly with some packages. Did you try running on a plain R session?

Sorry, I overlooked this bit.

ADD REPLY
0
Entering edit mode

Hi, it gives me a segfault error.

ADD REPLY
0
Entering edit mode

Yes, it seems your SAF is to blame. Maybe it has hidden characters? Or wrong number of columns? To check for number of columns:

awk '{print NF}" miRNAs_mmu | uniq -

To grep for hidden characters, you may try this tip.

ADD REPLY
0
Entering edit mode

Hi, thanks for your answer.

Using awk I found I have the required 5 columns. The file is also tab-delimited.

I tried some of the options of the link, None of them show any result. Nevertheless, I will explore this option.

Apart from that, featureCounts fails at the very beginning of the analysis, so I'm suspicious if it is about the BAM files. As I said, I didn't change nothing of them but maybe is an issue about a previous version of Rsubread? Unfortunately, I don't know the version I used the first time so maybe the version I have now works diferent? This are just some thoughts I have, in case somebody came across to a related issue.

Thanks again for your time!

ADD REPLY
0
Entering edit mode

where is the function featureCounts coming from? Does it use compiled code, does it use external binaries? Maybe it makes sense to get the latest version of the package sources and compile them instead of installing a binary package?

ADD REPLY
0
Entering edit mode

Hi, thanks for your reply.

featureCounts comes from both Rsubread, an R package and from Subread, an executable command-line package.

I ignore what version (binary/source) Rsubread uses, but I used the binary version of Subread. I'll try the source version.

Thanks again!

ADD REPLY
0
Entering edit mode

Hi, I used the source package and it gives the same segfault error, both using my SAF file and using an unmodified GTF file from Emsembl.

ADD REPLY
0
Entering edit mode

Could you post a reproducible example, including one of your bam files, the GTF file that give a seg fault?

ADD REPLY
0
Entering edit mode

Hi, you mean post some screenshots of the files or copy paste them here or in my original post?

The SAM file from one BAM file looks like:

The GTF file looks like:

Hope it helps, thank you in advance.

ADD REPLY
0
Entering edit mode

Hi,

I am facing a similiar problem. Using Ubuntu 14.04 and R version 3.2.2 on Amazon EC2. Using same mouse Ensembl GTF. R is crashing on using a single bam file.

featureCounts(files="aaa/xxx.bam", annot.ext = "musgenome/Mus_musculus.GRCm38.82.gtf", isGTFAnnotationFile = TRUE)

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

//========================== featureCounts setting ===========================\\
||                                                                            ||
||             Input files : 1 BAM file                                       ||

 *** caught segfault ***
address (nil), cause 'unknown'

Traceback:
 1: .C("R_readSummary_wrapper", as.integer(n), as.character(cmd),     PACKAGE = "Rsubread")
 2: featureCounts(files = "aaa/xxx.bam", annot.ext = "musgenome/Mus_musculus.GRCm38.82.gtf",     isGTFAnnotationFile = TRUE)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

Thanks

ADD REPLY
0
Entering edit mode

Hi, I don't know if is the main reason but I notice in my case the problem was caused by the header of the BAM file. However, I didn't find the problematic line or tag.

ADD REPLY
0
Entering edit mode
8.4 years ago
Wei Shi • 0

Hi @PSB,

Could you provide complete screen output when you ran featureCounts in R and on the command line? This will give us a better understanding of what went wrong.

ADD COMMENT
0
Entering edit mode

Hi, using this code in both RStudio and R:

conteototalnuevo = featureCounts(files=c("1077_C274.bam", "1078_C283.bam", "1079_C3_MAC-277.bam", "1080_M1-MA-269.bam", "1081_M2-MA-239.bam", "1082_M3-MA-305.bam", "1083_CM1-363.bam", "1084_CM2-369.bam", "1085_CM3-MAC-360.bam", "1086_MM1-MA-376.bam", "1087_MM2-MA-383.bam", "1088_MM3-MA-342.bam"), annot.ext="Mus_musculus.GRCm38.82.gtf", isGTFAnnotationFile=TRUE)

In Rstudio pop-ups a window with a bomb saying:

R Session aborted
R encountered a fatal error.
The session was terminated.

In R:

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

//========================== featureCounts setting ===========================\\
||                                                                            ||
||             Input files : 12 BAM files                                     ||

 *** caught segfault ***
address (nil), cause 'unknown'

Traceback:
 1: .C("R_readSummary_wrapper", as.integer(n), as.character(cmd),     PACKAGE = "Rsubread")
 2: featureCounts(files = c("1077_C274.bam", "1078_C283.bam", "1079_C3_MAC-277.bam",     "1080_M1-MA-269.bam", "1081_M2-MA-239.bam", "1082_M3-MA-305.bam",     "1083_CM1-363.bam", "1084_CM2-369.bam", "1085_CM3-MAC-360.bam",     "1086_MM1-MA-376.bam", "1087_MM2-MA-383.bam", "1088_MM3-MA-342.bam"),     annot.ext = "/media/pablo/datos/TFM/Mus_musculus.GRCm38.82.gtf",     isGTFAnnotationFile = TRUE)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:

Hope it helps, thanks in advance.

ADD REPLY

Login before adding your answer.

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