I use Rsubread to produce the BAM files and then use Rsamtools to manipulate the BAM files.
A few errors were thrown out:
> indexBam(files = "sample.bam") Error in FUN(X[[i]], ...) : failed to build index
> asSam(file = "sample.bam") > asBam(file = "sample.sam") Error in value[[3L]](cond) : 'asBam' truncated input file at record 8
I have checked the content of the BAM file generated by Rsubread by converting it into a SAM file and it seems that it uses quite a few CR (carriage return) in the middle of each long line. Does Rsamtools not recognise this format?