Snakemake with bwa_mem2_mem unable to open the ref file and doesn' t work
1
0
Entering edit mode
29 days ago
aka • 0

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:
ref="../resources/reference/Qrob_PM1N.fa"
output:
log:
"../results/logs/bwa_mem2/{sample}.log"
message: """--- Alignment in process ---"""
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
[Fri Apr 16 08:07:18 2021]
Error in rule bwa_mem2_mem:
jobid: 4
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:
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


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

bwa-mem2 conda snakemake pipeline • 282 views
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

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 ?

0
Entering edit mode
29 days ago
colindaven ★ 2.8k

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

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