genome / bam-readcount

Count bases in BAM/CRAM files
MIT License
298 stars 95 forks source link

Fail to open BAM file –q #70

Closed Souzavgp closed 3 years ago

Souzavgp commented 3 years ago

I'm running the False Positive Filter recommended in Support Protocol 1 by Koboldt et al (2013) (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4278659/). The recommendations are:

Obtain metrics for the list of variants:

bam-readcount –q 1 –b 20 –f reference.fasta –l varScan.variants BAM_FILE> varScan.variants.readcounts

When trying to perform the command line:

bam-readcount –q 1 –b 20 –f hg38_genome.fa –l sample.varScan.snp.filter bqsr_output.bam> varScan.variants.readcounts

I get the following output:

Minimum mapping quality is set to 0 open: No such file or directory Fail to open BAM file –q

I consulted some guidelines and it was suggested that the varScan.variants file should be in bed format. I made the following attempts:

vcf2bed varScan.variants.bed

awk '$ 1 ~ / ^ # / {next} {print $ 1, $ 2-1, $ 2}' sample.varScan.snp.filter | sort -k1,1 -k2,2n -u> filter_out.bed

But in both attempts the exit was:

Minimum mapping quality is set to 0 open: No such file or directory Fail to open BAM file –q

As recommended in the article it is suggested that "A list of variants (SNVs or indels) in VarScan format (tab-delimited; the first five columns must be chromosome, position, reference allele, variant allele)".

So, I also tried:

awk -F '\ t' '{print $ 1, $ 2, $ 4, $ 5, $ 3, $ 6, $ 7, $ 8, $ 9, $ 10}' sample.varScan.snp.filter> snp_filter_out.bed

And the failure remained.

What's wrong?

[bam-readcount version: 0.8.0]

susannasiebert commented 3 years ago

It looks to me like you're using a long-dash (also called em-dash) when specifying your parameters instead of a normal dash (minus sign). The parsers is not interpreting the –q as an option but as a string and thinks that that is the path to your bam file. Please replace the em-dashes in your bam-readcount commands with simple dashes e.g. -q.

Souzavgp commented 3 years ago

It looks to me like you're using a long-dash (also called em-dash) when specifying your parameters instead of a normal dash (minus sign). The parsers is not interpreting the –q as an option but as a string and thinks that that is the path to your bam file. Please replace the em-dashes in your bam-readcount commands with simple dashes e.g. -q.

Hello Susannasiebert, your observation is correct.

Thank you.

susannasiebert commented 3 years ago

Awesome. Closing this issue.