Hi there,
I use Rsubread to produce the BAM files and then use Rsamtools to manipulate the BAM files.
A few errors were thrown out:
1)
> indexBam(files = "sample.bam")
Error in FUN(X[[i]], ...) : failed to build index
2)
> 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?
Many thanks,
Tom
Sounds like you have a SAM file rather than a BAM file.
No. I have checked that it is BAM file. I can use asSam() function to convert sample.bam to sample.sam but cannot convert back from sample.sam to sample.bam using asBam() function.
Can you show output of
samtools quickcheck -vvv that.bam
on that bam file via terminal?I run the following command line on terminal:
The output is empty.
Please use
vvv
, this is not a typo. Tripple-v means "set verbosity to 3" which is "output everything". It will give a more detailed output message from the tool. A simplehead(sample.bam)
will also tellyou if it is not a SAM file in terms of not being binary.OK. I have run the command line:
samtools quickcheck -vvv sample.bam
The output is below:
Hmm, ok next step, checking the header:
samtools view -H sample.bam