Passing .bed files to nQuire create command
1
0
Entering edit mode
8 hours ago
akoontz11 • 0

I'm trying to use the nQuire create command to assess the ploidy of an individual. Specifically, I'm trying to include a .bed file along with the .bam file, in order to assess ploidy for different regions of the genome (described here), using the command below:

 nQuire create -x -r sample-6099.bed -b sample-6099.bam -o sample-6099

This command consistently throws the error "Could not open bam index"; the command below, however, works:

nQuire create -x -b sample-6099.bam -o sample-6099

Which suggests there's an issue with the .bed file. An example of the .bed file I'm using is shown below:

LG1     16730   16821   390_8_2113_18477_47366  0       -
LG1     33561   33595   390_8_2216_20730_30556  0       +
LG1     54112   54143   259_8_2202_22008_25386  0       -
LG1     79573   79664   259_8_1201_20446_16594  0       +

If anyone is familiar with nQuire and knows how to use it to assess ploidy in different regions, please let me know. Thanks!

bed alignment nQuire ploidy • 88 views
ADD COMMENT
0
Entering edit mode
6 hours ago

Hey akoontz11,

The error "Could not open bam index" is a common one when working with tools that require random access to BAM files, like nQuire does when you specify regions via -r. Without -r, nQuire can likely process the BAM sequentially, which is why that version of the command succeeds. But with -r, it needs the index for efficient jumping to specific genomic regions.

The fix is straightforward: you need to index your BAM file first using samtools. Assuming you have samtools installed, run:

samtools index sample-6099.bam

This will create sample-6099.bam.bai in the same directory. Make sure the .bai file is alongside the .bam, and that your working directory paths are correct when running nQuire.

Your BED file looks fine—nQuire expects at least chrom, start, end, and region name (columns 1-4), and extra columns like score and strand should be ignored. Just ensure the BED is tab-delimited and the coordinates are 0-based start, 1-based end.

Once indexed, retry:

nQuire create -x -r sample-6099.bed -b sample-6099.bam -o sample-6099

If it still fails, double-check that the BAM is sorted (nQuire requires it), or re-sort/index if needed:

samtools sort -o sample-6099.sorted.bam sample-6099.bam
samtools index sample-6099.sorted.bam

Then update your nQuire command to use the sorted BAM.

That should get you assessing ploidy per region.

Kevin

ADD COMMENT

Login before adding your answer.

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