snakemake學習筆記

什麼是snakemake?

snakemake 是一個流程搭建的工具,這裏主要用來記錄一些snakemake的使用方法python

  • 對於run或者shell部分的須要使用sample變量能夠使用wildcards.sample來獲取
  • 對於寫好的模塊能夠使用include來載入,而後使用rule all定義全部的輸出,這樣運行一個總的模塊就能夠直接開啓整個流程
rule all
    expand()

include:Filter.snakemake.py
  • 指定一個config文件能夠使用--configfile 參數來進行傳入
  • 若是隻控制運行某一個rule,能夠加上參數--forcerun rulex
  • 作出流程圖
snakemake --dag -s RNAseq.snakemake.py --configfile test.yaml |dot -Tpdf > dag.pdf
snakemake --dag -s RNAseq.snakemake.py --configfile test.yaml |dot -Tsvg > dag.svg
  • rule 流程圖
snakemake --rulegraph -s RNAseq.snakemake.py --configfile test.yaml |dot -Tpdf > rule.pdf
  • 強制去從新運行一遍rule
snakemake -s RNAseq.snakemake.py --configfile test.yaml --forcerun filter_stat
  • 指定運行的cpu數,使用-j參數
  • 只打印不運行使用-n參數
  • 在使用一個總的模塊來將全部的模塊串起來的過程當中,rule all聲明只能寫在這個總的模塊裏面

  • 以下報錯的緣由是由於rule all裏面的輸出在其餘的子rule裏面沒有作爲輸出
    http://vipkshttp0.wiz.cn/ks/share/resources/5caf615e-4bee-45f1-a60e-acb0883bde2d/35f4832b-c5d4-4be7-833b-39d57b621f8c/index_files/6e57199a-ce72-4390-bd32-57e1855b7ad3.png

使用snakemake投遞任務時shell

snakemake --cluster 'qsub -l vf=15G,num_proc=12 -cwd -q st.q -P P18Z10200N0170 -binding linear:12' --configfile test.yaml --snakefile Denovo.stLFR.snakemake.py --jobs 6
  • --jobs 能設置並行投遞的任務
  • 投遞的命令須要加引號svg

  • 當投遞到集羣,殺掉snakemake進程時,任務也會殺掉,而wdl是不會出現這種狀況的
  • shell裏面的命令{}須要用{{}}的方式來寫,與python有點相似工具

相關文章
相關標籤/搜索