This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Rsubread featurecounts

Hi there, I seem to be getting this error when reading in a BAM file which was generated by PBMM2 align on pacbio data. I have tried to google the error message but there are no results. I wonder if anyone has ideas on what the error might be? Thanks in advance

ERROR: sequence length in the BAM record is out of the expected region

Here is the code

library(Rsubread)
mycounts<-featureCounts("test.bam",annot.ext="test.gtf", isGTFAnnotationFile=TRUE, isPaired                                      End=FALSE,allowMultiOverlap=T,GTF.featureType=c("transcript"),isLongRead=T,useMe                                      taFeatures=F,countMultiMappingReads=T,reportReads="CORE",minFragLength="100",max                                      FragLength="10000")

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

//========================== featureCounts setting ===========================\\
||                                                                            ||
||             Input files : 1 BAM file                                       ||
||                                                                            ||
||                           test.bam       ||
||                                                                            ||
||              Paired-end : no                                               ||
||        Count read pairs : no                                               ||
||              Annotation : test.gtf (GTF)                          ||
||      Dir for temp files : .                                                ||
||      Assignment details : <input_file>.featureCounts                       ||
||                      (Note that files are saved to the output directory)   ||
||                                                                            ||
||                 Threads : 1                                                ||
||                   Level : feature level                                    ||
||      Multimapping reads : counted                                          ||
|| Multi-overlapping reads : counted                                          ||
||   Min overlapping bases : 1                                                ||
||          Long read mode : yes                                              ||
||                                                                            ||
\\============================================================================//

//================================= Running ==================================\\
||                                                                            ||
|| Load annotation file test.gtf ...                                 ||
||    Features : 267787                                                       ||
||    Meta-features : 67977                                                   ||
||    Chromosomes/contigs : 440                                               ||
||                                                                            ||
|| Process BAM file test.bam...             ||
ERROR: sequence length in the BAM record is out of the expected region: 1467, 81                                      5
||    Single-end reads are included.                                          ||
||    Total alignments : 1180654                                              ||
||    Successfully assigned alignments : 1177384 (99.7%)                      ||
||    Running time : 0.26 minutes                                             ||
||                                                                            ||
|| Write the final count table.                                               ||
|| Write the read assignment summary.                                         ||
||                                                                            ||
\\============================================================================//
rsubread featurecounts

1 answer

I think you should not bother too much. The important information is Successfully assigned alignments : 1177384 (99.7%).

As far as the error is concerned, I would presume that you have a read that maps to a contig that is shorter than the read itself. What is the shortest length of reference contigs? Do you have a contig that is just 81bp long? In that case, I would presume you have a read of the length 1467 mapping to a contig of 81 bases. (Or maybe also being 81 bases longer than the contig?)

To know for sure, you would need to download the source-code of subread and then search for that error message. I usually do something like

grep "sequence length in the BAM record" -R src -C 5

Just replace src with the path to the actual directory of the code.

Log in to answer this question.