Annotation.snake 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ######################################################
  2. # Annotation with eggnog-mapper
  3. ######################################################
  4. Annotation_Input = config["Annotation_Input"]
  5. Annotation_Dir = config["Annotation_Dir"]
  6. EMAPPER_HOME = config["EMAPPER_HOME"]
  7. diamond_nr_db = config["diamond_nr_db"]
  8. blast_method = "blastp"
  9. emapper_method = " "
  10. if config["data_type"] == "nucl":
  11. blast_method = "blastx"
  12. emapper_method = " --translate "
  13. rule emapper_search:
  14. input:
  15. Annotation_Input
  16. output:
  17. Annotation_Dir + "/my.emapper.seed_orthologs"
  18. threads: 32
  19. shell:
  20. "export PATH={EMAPPER_HOME}/bin:$PATH;"
  21. "python2 {EMAPPER_HOME}/emapper.py -m diamond -i {input} -o {Annotation_Dir}/my --cpu {threads} --no_annot --no_file_comments {emapper_method}"
  22. rule emapper_annot:
  23. input:
  24. Annotation_Dir + "/my.emapper.seed_orthologs"
  25. output:
  26. Annotation_Dir + "/my.emapper.annotations"
  27. threads: 32
  28. shell:
  29. "export PATH={EMAPPER_HOME}/bin:$PATH;"
  30. "python2 {EMAPPER_HOME}/emapper.py --annotate_hits_table {input} -o {Annotation_Dir}/my --cpu {threads} "
  31. rule makeOrgDB:
  32. input:
  33. emapper = Annotation_Dir + "/my.emapper.annotations",
  34. Annotation_Input = Annotation_Input
  35. output:
  36. Annotation_Dir + "/anno_stat.txt"
  37. shell:
  38. "cd {Annotation_Dir} ;"
  39. "Rscript ../tools/emcp/makeOrgPackageFromEmapper.R my.emapper.annotations;"
  40. "Rscript ../tools/emcp/AnnoStat.R ../{input.Annotation_Input};"
  41. "cd ..;"
  42. rule nr:
  43. input:
  44. Annotation_Input
  45. output:
  46. Annotation_Dir + "/my.nr.diamond.tab"
  47. threads:
  48. 20
  49. shell:
  50. "diamond {blast_method} --threads {threads} --evalue 1e-10 --outfmt 6 -o {output} --query {input} --db {diamond_nr_db} --max-target-seqs 5"