Snakemake with bwa_mem2_mem unable to open the ref file and doesn' t work
1
0
Entering edit mode
3.6 years ago
aka ▴ 10

I am a beginer and I make a pipeline to do Rnaseq sequence alignment. I work with BWA, my code is the following:

rule bwa_mem2_mem:
input:
    reads=["../results/trimmed/{sample}_R1_trimmed.fastq.gz","../results/trimmed/{sample}_R1_trimmed.fastq.gz"],
    ref="../resources/reference/Qrob_PM1N.fa"
output:
    out= "../results/mapped_reads/{sample}.bam"
log:
    "../results/logs/bwa_mem2/{sample}.log"
message: """--- Alignment in process ---"""
threads: 8
shell:
    "(bwa-mem2 mem -M -t {threads} -v 2 {input.ref} {input.reads} | samtools view -Sb -> {output.out}) > {log}"

And the problem is that the terminal shows me the following, knowing that I have the right path and the fact that I have installed BWA-mem2 but I think my pc does not want to install it.

 [Fri Apr 16 08:07:18 2021]
Job 4: --- Alignment in process ---

/usr/bin/bash: bwa-mem2 : commande introuvable
[main_samview] fail to read the header from "-".
[Fri Apr 16 08:07:18 2021]
Error in rule bwa_mem2_mem:
    jobid: 4
    output: ../results/mapped_reads/sub1.bam
    log: ../results/logs/bwa_mem2/sub1.log (check log file(s) for error message)
    shell:
        (bwa-mem2 mem -M -t 4 -v 2 ../resources/reference/Qrob_PM1N.fa ../results/trimmed/sub1_R1_trimmed.fastq.gz ../results/trimmed/sub1_R1_trimmed.fastq.gz | samtools view -Sb -> ../results/mapped_reads/sub1.bam) > ../results/logs/bwa_mem2/sub1.log
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

Removing output files of failed job bwa_mem2_mem since they might be corrupted:
../results/mapped_reads/sub1.bam
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: /home/coralie/Bureau/epitree/workflow/.snakemake/log/2021-04-16T080718.069055.snakemake.log"

And the log file displays:

-----------------------------
Executing in AVX2 mode!!
-----------------------------
* Ref file: genome.fasta
* Entering FMI_search
ERROR! Unable to open the file: genome.fasta.bwt.8bit.32
[main_samview] fail to read the header from "-".

I'm a bit stuck, do you have any ideas?

Thanks in advance for your help

bwa-mem2 conda snakemake pipeline • 1.9k views
ADD COMMENT
0
Entering edit mode

Hello, a few things I see here, not sure if they will solve your problem.

1st your both inputs are the same R1 read, there is no R2.

2nd are you sure that your result folder is one level up than your Snakefile?

3rd make sure that your input in samtools has a valid header.

Good luck

ADD REPLY
0
Entering edit mode

Hi, Thank you for your help!

For the 1st it's a mistake sorry I change it and it's still the same. For the 2nd yes I am sure because with an other tool I use a file in the same directory

For the 3rd, how I can be sure I have a valid header ?

ADD REPLY
0
Entering edit mode
3.6 years ago

This is a pretty common task. Why not try out the snakemake pipeline put together by the Snakemake authors? Why reinvent the wheel ?

https://github.com/snakemake-workflows/rna-seq-star-deseq2

ADD COMMENT
0
Entering edit mode

I work in a research laboratory that has specific demands that make the general pipeline not fit, I have to create it from scratch, but thanks for the link

ADD REPLY

Login before adding your answer.

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