Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snippy-multi ERROR: Can't open --ref BZ100/ref.fa #591

Open
makerer5 opened this issue Jul 3, 2024 · 8 comments
Open

snippy-multi ERROR: Can't open --ref BZ100/ref.fa #591

makerer5 opened this issue Jul 3, 2024 · 8 comments

Comments

@makerer5
Copy link

makerer5 commented Jul 3, 2024

Hi,
I have a question for you about snippy-multi:
I tried to run snippy-multi.
I first generated a label file (input.tab) as follows:
BZ93 /home/disk/project/G20240703/genome_analysis/geome/BZ93.fsa
BZ_48_8 /home/disk/project/G20240703/genome_analysis/geome/BZ_48_8.fsa
BZ107 /home/disk/project/G20240703/genome_analysis/geome/BZ107.fsa
BZ85 /home/disk/project/G20240703/genome_analysis/geome/BZ85.fsa
BZ77 /home/disk/project/G20240703/genome_analysis/geome/BZ77.fsa
BZ67 /home/disk/project/G20240703/genome_analysis/geome/BZ67.fsa
BZ79 /home/disk/project/G20240703/genome_analysis/geome/BZ79.fsa
BZ98 /home/disk/project/G20240703/genome_analysis/geome/BZ98.fsa

When I run the following command, I get the following error:
snippy-multi input.tab --ref sequence.fasta --cpus 16 --outdir mysnippy > multi.sh
sh multi.sh
ERROR: Can't open --ref BZ100/ref.fa

I tried to find the answer in the github issue, and the #463 issue is exactly the same as my current situation. But he solved the problem by replacing the GBK file with a fasta file, but my reference genome is a fasta file.
Why does "ERROR: Can't open --ref BZ100/ref.fa" still appear now?

@lanroad-tiger
Copy link

can you try 'less multi.sh' and show your result? Maybe I can help u after seeing that

@makerer5
Copy link
Author

makerer5 commented Jul 8, 2024

Thank you very much for helping me solve this error.
Below is my input file (input.txt) and error message (snippy38583.log), as well as the information generated by the "less multi.sh" command (less_multi.log)
less_multi.log
input.txt
snippy38583.log

@lanroad-tiger
Copy link

Please confirm:
Whether a series of folders (such as ‘BZ_63’) have been generated in the ‘mysnippy’ path?
In your question, you mentioned that your ref file is in fasta format instead of gbk, but in ‘multi.sh’, it shows ‘--ref MW2.gb’. Please double check your reference genome and confirm whether it contains sequences.
If none of the above works, you can try running a single line command in ‘mult.sh’ to see if it is effective (e.g., snippy --outdir ‘BZ_63’ --R1 ‘/public/home/xxluo/metagenome/project/G20240703/genome_analysis/genome_RawData/BZ_63_R1.fq.gz’ --R2 ‘/public/home/xxluo/metagenome/project/G20240703/genome_analysis/genome_RawData/BZ_63_R2.fq.gz’ --ref MW2.gb --cpus 16 --outdir mysnippy).

@makerer5
Copy link
Author

makerer5 commented Jul 9, 2024

Sorry, I made a mistake in the previous statement.

  1. There are no BZ_63...BZ_100 folders in the mysnippy directory.
  2. I tried setting the reference genome to .gb and .fasta format files, but neither worked (serialtest38593.log).
  3. I ran the single-line command you mentioned and did not receive any error message (serialtest38595.log).
    serialtest38595.log
    serialtest38593.log
    2024-07-09 14-00-39MW2

@fanvanf
Copy link

fanvanf commented Jul 12, 2024

make sure the output path changed to an absolute path

@makerer5
Copy link
Author

make sure the output path changed to an absolute path

I eventually solved this problem by adding comments to the input.tab file. For example, when reading a paired-end sequencing file, add '# input.tab = ID R1 [R2]' to the first line of the input.tab file.
Finally, the error ‘ERROR: Can't open --ref BZ100/ref.fa’ was resolved and the program ran normally.

@mjnramos
Copy link

Hi there,

When you run snippy-multi input.tab --ref <ref> --outdir <outdir> --cpus 16 > runme.sh, the runme.sh file will have 2 --outdir instructions on each snippy command. This will make the output of all runs to be redirected to <outdir>, which will make them to be overwritten and, when calling snippy-core (last line of runme.sh), the files will not be where expected.

In detail:

Consider this input.tab

S1	/data/S1.fasta
S2	/data/S2.fasta

By running snippy-multi input.tab --ref /data/genomic.fna --outdir mysnps --cpus 16 > runme.sh...

you will end up with this runme.sh file (cat)

snippy --outdir 'S1' --ctgs '/data/S1.fasta' --ref /data/genomic.fna --outdir mysnps --cpus 16
snippy --outdir 'S2' --ctgs '/data/S2.fasta' --ref /data/genomic.fna --outdir mysnps --cpus 16
snippy-core --ref 'S1/ref.fa' S1 S2

As you see, you have --outdir twice.

To solve this:
Run snippy-multi without --outdir. The files generated for each run will be stored in each directory, and the global ones will be on your working directory.

snippy-multi input.tab --ref /data/genomic.fna --cpus 16 > runme.sh
cat runme.sh
snippy --outdir 'S1' --ctgs '/data/S1.fasta' --ref /data/genomic.fna --cpus 16
snippy --outdir 'S2' --ctgs '/data/S2.fasta' --ref /data/genomic.fna --cpus 16
snippy-core --ref 'S1/ref.fa' S1 S2

@makerer5
Copy link
Author

你好呀,

当您运行 时snippy-multi input.tab --ref <ref> --outdir <outdir> --cpus 16 > runme.sh,runme.sh 文件将--outdir在每个命令上包含 2 条指令snippy。这将使所有运行的输出重定向到<outdir>,从而导致它们被覆盖,并且在调用snippy-core(runme.sh 的最后一行)时,文件将不会位于预期的位置。

详细:

考虑这个 input.tab

S1	/data/S1.fasta
S2	/data/S2.fasta

通过运行snippy-multi input.tab --ref /data/genomic.fna --outdir mysnps --cpus 16 > runme.sh...

你最终会得到这个 runme.sh 文件 (cat)

snippy --outdir 'S1' --ctgs '/data/S1.fasta' --ref /data/genomic.fna --outdir mysnps --cpus 16
snippy --outdir 'S2' --ctgs '/data/S2.fasta' --ref /data/genomic.fna --outdir mysnps --cpus 16
snippy-core --ref 'S1/ref.fa' S1 S2

如您所见,您有--outdir两次。

**解决此问题的方法:**不带 运行 。每次运行生成的文件将存储在每个目录中,全局文件将位于您的工作目录中。snippy-multi``--outdir

snippy-multi input.tab --ref /data/genomic.fna --cpus 16 > runme.sh
cat runme.sh
snippy --outdir 'S1' --ctgs '/data/S1.fasta' --ref /data/genomic.fna --cpus 16
snippy --outdir 'S2' --ctgs '/data/S2.fasta' --ref /data/genomic.fna --cpus 16
snippy-core --ref 'S1/ref.fa' S1 S2

You pointed out my mistakes and gave a clear and concise principle. My knowledge of bioinformatics has been further improved. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants