簡體   English   中英

如何限制 Snakemake 中磁盤空間的使用?

[英]How to limit usage of disk space in Snakemake?

我使用 8 個雙端 fastq 文件,每個文件 150 GB,這些文件需要由具有空間要求的子任務的管道處理。 我嘗試了幾個選項,但磁盤空間仍然不足:

  • 不再需要時使用 temp 刪除輸出文件
  • 使用 disk_mb 資源來限制並行作業的數量。

我使用以下執行將我的磁盤空間使用限制為 500GB,但顯然這不能保證並且超過了 500GB。 如何將磁盤使用限制為固定值以避免磁盤空間不足?

snakemake --resources disk_mb=500000 --use-conda --cores 16  -p
rule merge:
  input:
    fw="{sample}_1.fq.gz",
    rv="{sample}_2.fq.gz",
  output:
    temp("{sample}.assembled.fastq")
  resources:
    disk_mb=100000
  threads: 16
  shell:
    """
    merger-tool -f {input.fw} -r {input.rv} -o {output}
    """


rule filter:
  input:
    "{sample}.assembled.fastq"
  output:
    temp("{sample}.assembled.filtered.fastq")
  resources:
    disk_mb=100000
  shell:
    """
    filter-tool {input} {output}
    """


rule mapping:
  input:
    "{sample}.assembled.filtered.fastq"
  output:
    "{sample}_mapping_table.txt"
  resources:
    disk_mb=100000
  shell:
    """
    mapping-tool {input} {output}
    """

Snakemake沒有限制資源的功能,但只能以尊重資源限制的方式安排作業。

現在, snakemake使用resources來限制並發作業,而您的問題具有累積性。 看一下這個答案,解決這個問題的一種方法是引入priority ,以便下游任務具有最高優先級。

在您的特定文件中,似乎為mapping規則添加priority就足夠了:

rule mapping:
    input:
        "{sample}.assembled.filtered.fastq"
    output:
        "{sample}_mapping_table.txt"
    resources:
        disk_mb=100_000
    priority: 100
    shell:
        """
        mapping-tool {input} {output}
        """

您可能還希望在最初啟動規則時要小心(以避免用merge的結果填滿磁盤空間)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM