Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. rule tool-a:
  2. input:
  3. counts=config['general']['paths']["count_matrix"]
  4.  
  5. output:
  6. os.path.join(config['general']['paths']['outdir'], 'diff','tool-a', 'tool-a.tsv')
  7. params:
  8. result_dir=os.path.join(config['general']['paths']['outdir'], 'diff','tool-a')
  9.  
  10. shell:
  11. """
  12. mkdir -p {params.result_dir}
  13. Rscript {GENE_TEST_DIFF_SCRIPT} {input.counts} {params.result_dir}
  14. """
  15.  
  16. rule tool-b:
  17. input:
  18. counts=config['general']['paths']["count_matrix"]
  19.  
  20. output:
  21. os.path.join(config['general']['paths']['outdir'], 'diff','tool-b', 'tool-b.tsv')
  22.  
  23. params:
  24. result_dir=os.path.join(config['general']['paths']['outdir'], 'diff','tool-b')
  25. shell:
  26. """
  27. mkdir -p {params.result_dir}
  28. Rscript {GENE_TEST_DIFF_SCRIPT} {input.counts}
  29. """
  30.  
  31. import pandas as pd
  32. from snakemake.utils import min_version
  33. import itertools
  34.  
  35. ### set min snakemake requirement
  36. min_version("5.4.1")
  37.  
  38. ### load config
  39. configfile: "config.yaml"
  40.  
  41. ### load sample data
  42.  
  43. DIFF_METH = config['general']['method']
  44. Tool_a = config['general']['paths']['tool_a-script']
  45. Tool_b = config['general']['paths']['tool_b-script']
  46.  
  47. if DIFF_METH == "tool-a":
  48. GENE_TEST_DIFF_SCRIPT = Tool_a
  49. elif DIFF_METH == "tool-b":
  50. GENE_TEST_DIFF_SCRIPT = Tool_b
  51. else:
  52. sys.exit("Invalid value for 'method', possible choices are: 'tool-a' and 'tool-b'")
  53.  
  54. onstart:
  55. sys.stderr.write("GENE_DIFF_METH = " + GENE_DIFF_METH + "n")
  56. return []
  57.  
  58. ### define rules not to be executed on the cluster
  59. localrules: all
  60.  
  61. ### define target rules
  62. rule all:
  63. input:
  64. expand(os.path.join(config['general']['paths']['outdir'], 'diff','tool-a','tool-a.tsv')),
  65. expand(os.path.join(config['general']['paths']['outdir'], 'diff','tool-b','tool-b.tsv')),
  66.  
  67.  
  68.  
  69. include: "rules/tools.smk"
  70.  
  71. general:
  72. gene_diff_method: 'tool-b'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement