simroux / VirSorter2_to_Anvio

Draft script to generate Anvi'o-compatible annotation files from VirSorter2 output, for visualization of VS2 results in Anvi'o
0 stars 0 forks source link

consistent error with conversion script #1

Open dnolin13 opened 1 year ago

dnolin13 commented 1 year ago

hello! I’m trying to input my virsorter2 results into anvio and I’m having some issues with the conversion script. Here’s the error I am getting: ./convert2anvio.sh ######################## Reading all relevant VirSorter2 data Traceback (most recent call last): File "/home/delaney/software/VirSorter2_to_Anvio/virsorter_to_anvio.py", line 148, in <module> with open(arg_dict['affi_file'], newline='') as csvfile: FileNotFoundError: [Errno 2] No such file or directory: '2014_4_10_Gb0149066_derep.fasta.output/for-dramv/viral-affi-contigs-for-dramv.tab' ... reading /home/delaney/db/virsorter2-db/group/lavidaviridae/hallmark-gene.list ... reading /home/delaney/db/virsorter2-db/group/NCLDV/hallmark-gene.list ... reading /home/delaney/db/virsorter2-db/group/RNA/hallmark-gene.list ... reading /home/delaney/db/virsorter2-db/group/ssDNA/hallmark-gene.list ... reading /home/delaney/db/virsorter2-db/group/dsDNAphage/hallmark-gene.list ######################## Reading all relevant VirSorter2 data Traceback (most recent call last): File "/home/delaney/software/VirSorter2_to_Anvio/virsorter_to_anvio.py", line 148, in <module> with open(arg_dict['affi_file'], newline='') as csvfile: FileNotFoundError: [Errno 2] No such file or directory: '2014_5_21_Gb0149067_derep.fasta.output/for-dramv/viral-affi-contigs-for-dramv.tab' ... reading /home/delaney/db/virsorter2-db/group/lavidaviridae/hallmark-gene.list ... reading /home/delaney/db/virsorter2-db/group/NCLDV/hallmark-gene.list ... reading /home/delaney/db/virsorter2-db/group/RNA/hallmark-gene.list ... reading /home/delaney/db/virsorter2-db/group/ssDNA/hallmark-gene.list ... reading /home/delaney/db/virsorter2-db/group/dsDNAphage/hallmark-gene.list ######################## Reading all relevant VirSorter2 data Traceback (most recent call last): File "/home/delaney/software/VirSorter2_to_Anvio/virsorter_to_anvio.py", line 148, in <module> with open(arg_dict['affi_file'], newline='') as csvfile: FileNotFoundError: [Errno 2] No such file or directory: '2014_7_17_Gb0149068_derep.fasta.output/for-dramv/viral-affi-contigs-for-dramv.tab' ... reading /home/delaney/db/virsorter2-db/group/lavidaviridae/hallmark-gene.list ... reading /home/delaney/db/virsorter2-db/group/NCLDV/hallmark-gene.list ... reading /home/delaney/db/virsorter2-db/group/RNA/hallmark-gene.list ... reading /home/delaney/db/virsorter2-db/group/ssDNA/hallmark-gene.list ... reading /home/delaney/db/virsorter2-db/group/dsDNAphage/hallmark-gene.list

and here is the script I am using `#!/bin/bash -i

VS2_bysample="/home/delaney/5YV/JGI_assemblies/SH_QC_derep/31_VS2_results_by_sample" ANVIO_INPUTS=$VS2_bysample/Anvio mkdir -p $ANVIO_INPUTS

for dir in ls ${VS2_bysample}; do org_name=$dir BASENAME=$(basename $dir) FILESTEM="${BASENAME%_derep.fasta.output}" /home/delaney/software/VirSorter2_to_Anvio/virsorter_to_anvio.py -i ${dir} -s splits_basic_info.txt -n all_gene_calls.txt -d /home/db/virsorter-db_v2/ -A virsorter_additional_info.txt -C virsorter_collection.txt -F virsorter_annotations.txt

echo $dir

    #echo $FILESTEM

done echo "done"`

directory is set up with a different file for each sample with the vs2 results in each as attached.

any help would be really appreciated!!

simroux commented 1 year ago

Hi !

It looks like VirSorter2 output folders do not includes all the expected files. Specifically, it's complaining about the file "viral-affi-contigs-for-dramv.tab" missing. Were the virsorter 2 runs done with the "--prep-for-dramv" option ? If not, you can simply run virsorter 2 on the same output folder (so that it barely recompute anything) with the option, and you should see these "viral-affi-contigs-for-dramv.tab" appear in the output folder. From there, the "VirSorter2_to_Anvio" script should work (or at least, not throw this exact same error anymore).

Best, Simon

dnolin13 commented 1 year ago

thanks for your response! I tried running vs2 again with that flag, but it seems to be running the whole vs2 pipeline again? I tried using the classify mode to make it skip the first two steps but that didn't seem to work either. When I attempt to run it on the whole directory, it says it can't find the yaml file even though it's there in the directory. Any help is greatly appreciated, thanks!

(vs2) delaney@ada:~/5YV/JGI_assemblies/SH_QC_derep/31_VS2_results_by_sample$ virsorter run -w test-2013-11 -i 2013_11_13_Gb0149061_derep.fasta.output/ classify [2022-10-11 17:38 INFO] VirSorter 2.2.3 [2022-10-11 17:38 INFO] /home/delaney/miniconda3/envs/vs2/bin/virsorter run -w test-2013-11 -i 2013_11_13_Gb0149061_derep.fasta.output/ classify [2022-10-11 17:38 CRITICAL] No config.yaml dectected from previous run (vs2) delaney@ada:~/5YV/JGI_assemblies/SH_QC_derep/31_VS2_results_by_sample$ ls 2013_11_13_Gb0149061_derep.fasta.output/ 2013_11_13_Gb0149061_final-viral-boundary.tsv config.yaml final-viral-score.tsv test 2013_11_13_Gb0149061_final-viral-combined.fa final-viral-boundary.tsv iter-0 test-dramv 2013_11_13_Gb0149061_final-viral-score.tsv final-viral-combined.fa log

simroux commented 1 year ago

Yikes, sorry, this looks like a VirSorter2 error, which will need to be asked at https://github.com/jiarong/VirSorter2/issues

In the meantime, one way to check whether the original error was solved would be to rerun VirSorter2 from scratch on a small number of sequences, and then see if VirSorter2_to_Anvio now works when using "--prep-from-dramv" ?