nanoporetech / modkit

A bioinformatics tool for working with modified bases
https://nanoporetech.com/
Other
136 stars 7 forks source link

Error! unable to open SAM/BAM/CRAM index #169

Closed habibsaky closed 5 months ago

habibsaky commented 5 months ago

(base) [mmolla@dg-gpunode05 ~]$ modkit pileup /gpfs2/scratch/mmolla/Z/calls.bam output/gpfs2/scratch/mmolla/Z/pileup.bed --log-filepath pileup.log

Error! unable to open SAM/BAM/CRAM index for /gpfs2/scratch/mmolla/Z/calls.bam; please create an index (base) [mmolla@dg-gpunode05 ~

ArtRand commented 5 months ago

Could you check that /gpfs2/scratch/mmolla/Z/calls.bam.bai exists? If it doesn't

$ samtools index /gpfs2/scratch/mmolla/Z/calls.bam

will do it.

habibsaky commented 5 months ago

Could you check that /gpfs2/scratch/mmolla/Z/calls.bam.bai exists? If it doesn't

$ samtools index /gpfs2/scratch/mmolla/Z/calls.bam

will do it.

no it is not bam.bai

i run again with samtools but i got error like this...

(base) [mmolla@dg-gpunode05 ~]$ modkit pileup /gpfs2/scratch/mmolla/Z/calls.bam output/gpfs2/scratch/mmolla/Z/pileup.bed --log-filepath pileup.log

Error! unable to open SAM/BAM/CRAM index for /gpfs2/scratch/mmolla/Z/calls.bam; please create an index (base) [mmolla@dg-gpunode05 ~]$ modkit pileup samtools index /gpfs2/scratch/mmolla/Z/calls.bam output/gpfs2/scratch/mmolla/Z/pileup.bed --log-filepath pileup.log error: unexpected argument '/gpfs2/scratch/mmolla/Z/calls.bam' found

Usage: modkit pileup [OPTIONS]

For more information, try '--help'. (base) [mmolla@dg-gpunode05 ~]$

ArtRand commented 5 months ago

@habibsaky

Sorry for not being clear.

First run:

$ samtools index /gpfs2/scratch/mmolla/Z/calls.bam

this command creates the .bai BAM index file. Then you can run modkit pileup like you were before:

modkit pileup /gpfs2/scratch/mmolla/Z/calls.bam output/gpfs2/scratch/mmolla/Z/pileup.bed --log-filepath pileup.log
habibsaky commented 5 months ago

oh i did both but still now error

(base) [mmolla@dg-gpunode05 ~]$ modkit pileup /gpfs2/scratch/mmolla/Z/ output/gpfs2/scratch/mmolla/Z/pileup.bed --log-filepath pileup.log

Error! unable to open SAM/BAM/CRAM file at /gpfs2/scratch/mmolla/Z/ (base) [mmolla@dg-gpunode05 ~]$ modkit pileup /gpfs2/scratch/mmolla/Z/index.bai output/gpfs2/scratch/mmolla/Z/pileup.bed --log-filepath pileup.log Error! unable to open SAM/BAM/CRAM file at /gpfs2/scratch/mmolla/Z/index.bai (base) [mmolla@dg-gpunode05 ~]$ modkit pileup /gpfs2/scratch/mmolla/Z/sorted.bam output/gpfs2/scratch/mmolla/Z/pileup.bed --log-filepath pileup.log Error! unable to open SAM/BAM/CRAM index for /gpfs2/scratch/mmolla/Z/sorted.bam; please create an index (base) [mmolla@dg-gpunode05 ~]$ modkit pileup /gpfs2/scratch/mmolla/Z/ output/gpfs2/scratch/mmolla/Z/pileup.bed --log-filepath pileup.log Error! unable to open SAM/BAM/CRAM file at /gpfs2/scratch/mmolla/Z/ (base) [mmolla@dg-gpunode05 ~]$

ArtRand commented 5 months ago

You need to specify the file (/gpfs2/scratch/mmolla/Z/calls.bam in your case), not just the directory. See my command:

modkit pileup \
  /gpfs2/scratch/mmolla/Z/calls.bam \
  output/gpfs2/scratch/mmolla/Z/pileup.bed \
  --log-filepath pileup.log
habibsaky commented 5 months ago

(base) [mmolla@dg-gpunode05 Z]$ modkit pileup sorted.bam pileup.bed --log-filepath pileup.log

calculated chunk size: 6, interval size 100000, processing 600000 positions concurrently attempting to sample 10042 reads Error! zero reads found in bam index (base) [mmolla@dg-gpunode05 Z]$

ArtRand commented 5 months ago

Sounds like you need to align your reads first. I would use dorado aligner for this, see the documentation on how to do this.

ArtRand commented 5 months ago

Sounds like we took care of this in #171.