This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Copy Number Detection with ExomeDepth.. parsing error of bam file

Hello,

I am trying to use ExomeDepth tool for copy number analysis.

I have used the tophat in order to align my paired-end ngs data and got the accepted_hits.bam file. Here is the exact command I have used. (I refer the Differential gene and transcript expression analysis of RNA-seq experiment with TopHat and Cufflinks tool , nature protocol paper).

tophat -G gene.gtf -o patient1_thout --no-novel-juncs genome xxx_1.fq xxxx_2.fq

(In the genome.fa and genes.gtf files, chromosome is marked as "chr1" instead of 1.

This command return the xxx_accepted_hits.bam file into the patient1_thout directory..

To analyze the CNV, I have used the following command.

my.counts <- getBamCounts(bed.frame=exons.hg19, bam.file="xxx_accpeted_hits.bam", include.chr=TRUE)

then, I got the following error.

Error in value[[3L]](cond) :
  failed to open BamFile: failed to load BAM index
  file: xxxx_accepted_hits.bam
In addition: Warning message:
In doTryCatch(return(expr), name, parentenv, handler) :
  [bam_index_load] fail to load BAM index.

If I remove the include.chr option, which means that it is set as "FALSE". then, I can successfully run the command..

However, my object read counts would be equal to 0 over all ranges.. which is wrong.

I am not sure how can I fix it. Could you please someone help me?

exome-depth copy-number

1 answer

Maybe you should try to index your .bam file using samtools:

samtools index xxxx_accepted_hits.bam

The result should be a .bai file. You should place both .bam & .bai files in the same folder.

Log in to answer this question.