|
@@ -11,8 +11,8 @@ GENOME = config["genome"]
|
|
RESOLUTIONS = config["resolutions"]
|
|
RESOLUTIONS = config["resolutions"]
|
|
BASE_RESOLUTION = min(RESOLUTIONS)
|
|
BASE_RESOLUTION = min(RESOLUTIONS)
|
|
|
|
|
|
-with open('chromosomes.txt', 'r') as file:
|
|
|
|
- CHROMOSOMES = [line.strip() for line in file]
|
|
|
|
|
|
+#with open('chromosomes.txt', 'r') as file:
|
|
|
|
+# CHROMOSOMES = [line.strip() for line in file]
|
|
|
|
|
|
|
|
|
|
meta_data = pd.read_csv('samples.txt', sep='\t')
|
|
meta_data = pd.read_csv('samples.txt', sep='\t')
|
|
@@ -39,19 +39,15 @@ rule all:
|
|
#第四步: 格式转换
|
|
#第四步: 格式转换
|
|
expand("Matrix/Final/{sample}.{format}", sample=SAMPLES, format=["mcool"]),
|
|
expand("Matrix/Final/{sample}.{format}", sample=SAMPLES, format=["mcool"]),
|
|
#第五步: 接触矩阵质控
|
|
#第五步: 接触矩阵质控
|
|
- "Matrix/Raw/hicQC.html",
|
|
|
|
- "Matrix/Raw/SCC.csv",
|
|
|
|
|
|
+ #"Matrix/Raw/hicQC.html",
|
|
|
|
+ #"Matrix/Raw/SCC.csv",
|
|
expand("Matrix/Final/{sample}_res.csv", sample=SAMPLES),
|
|
expand("Matrix/Final/{sample}_res.csv", sample=SAMPLES),
|
|
#第六步: AB compartment, TADs, Loops
|
|
#第六步: AB compartment, TADs, Loops
|
|
- expand("Matrix/Diff/{resolution}/{contrast}.cool", resolution=config["TAD_resolution"], contrast=CONTRASTS),
|
|
|
|
expand("Compartments/CALDER2/{resolution}/{sample}/sub_compartments/all_sub_compartments.bed", resolution=config["Compartment_resolution"], sample=SAMPLES),
|
|
expand("Compartments/CALDER2/{resolution}/{sample}/sub_compartments/all_sub_compartments.bed", resolution=config["Compartment_resolution"], sample=SAMPLES),
|
|
expand("TADs/HiCExplorer/{resolution}/{sample}_domains.bed", resolution=config["TAD_resolution"], sample=SAMPLES),
|
|
expand("TADs/HiCExplorer/{resolution}/{sample}_domains.bed", resolution=config["TAD_resolution"], sample=SAMPLES),
|
|
expand("TADs/HiCExplorer/{resolution}/{contrast}_accepted.diff_tad", resolution=config["TAD_resolution"],contrast=CONTRASTS),
|
|
expand("TADs/HiCExplorer/{resolution}/{contrast}_accepted.diff_tad", resolution=config["TAD_resolution"],contrast=CONTRASTS),
|
|
expand("Loops/Mustache/{resolution}/{sample}.tsv", resolution=config["Loop_resolution"], sample=SAMPLES),
|
|
expand("Loops/Mustache/{resolution}/{sample}.tsv", resolution=config["Loop_resolution"], sample=SAMPLES),
|
|
- expand("Loops/Mustache/{resolution}/{contrast}.diffloop1", resolution=config["Loop_resolution"], contrast=CONTRASTS),
|
|
|
|
- # 可视化
|
|
|
|
- expand("plots/{resolution}/{sample}_plotmatrix_allchr.png", resolution=config["Plot_matrix_resolution"], sample=SAMPLES),
|
|
|
|
- expand("plots/{resolution}/{sample}_plotmatrix_perchr.png", resolution=config["Plot_matrix_resolution"], sample=SAMPLES)
|
|
|
|
|
|
+ expand("Loops/Mustache/{resolution}/{contrast}.diffloop1", resolution=config["Loop_resolution"], contrast=CONTRASTS)
|
|
|
|
|
|
|
|
|
|
#********************************************************#
|
|
#********************************************************#
|
|
@@ -451,37 +447,3 @@ rule diff_mustache:
|
|
"""
|
|
"""
|
|
python /opt/conda/lib/python3.12/site-packages/mustache/diff_mustache.py -f1 {input.treatment_mcool} -f2 {input.control_mcool} --resolution {params.resolution} --outfile {params.prefix} --processes {threads} {params.diff_mustache}
|
|
python /opt/conda/lib/python3.12/site-packages/mustache/diff_mustache.py -f1 {input.treatment_mcool} -f2 {input.control_mcool} --resolution {params.resolution} --outfile {params.prefix} --processes {threads} {params.diff_mustache}
|
|
"""
|
|
"""
|
|
-
|
|
|
|
-#********************************************************#
|
|
|
|
-# 可视化 #
|
|
|
|
-#********************************************************#
|
|
|
|
-rule hicPlotMatrix:
|
|
|
|
- input:
|
|
|
|
- mcool="Matrix/Final/{sample}.mcool"
|
|
|
|
- output:
|
|
|
|
- allchr_png="plots/{resolution}/{sample}_plotmatrix_allchr.png",
|
|
|
|
- perchr_png="plots/{resolution}/{sample}_plotmatrix_perchr.png"
|
|
|
|
- params:
|
|
|
|
- resolution="{resolution}"
|
|
|
|
- shell:
|
|
|
|
- """
|
|
|
|
- hicPlotMatrix -m {input.mcool}::/resolutions/{params.resolution} -o {output.allchr_png} --log1p --colorMap YlOrRd --clearMaskedBins --log1p
|
|
|
|
- hicPlotMatrix -m {input.mcool}::/resolutions/{params.resolution} -o {output.perchr_png} --log1p --colorMap YlOrRd --clearMaskedBins --perChromosome --log1p
|
|
|
|
- """
|
|
|
|
-
|
|
|
|
-# 使用 hicCompareMatrices 比较矩阵
|
|
|
|
-rule hicCompareMatrices:
|
|
|
|
- input:
|
|
|
|
- treatment_mcool="Matrix/Final/{treatment}.mcool",
|
|
|
|
- control_mcool="Matrix/Final/{control}.mcool",
|
|
|
|
- output:
|
|
|
|
- cool="Matrix/Diff/{resolution}/{treatment}_vs_{control}.cool"
|
|
|
|
- params:
|
|
|
|
- resolution="{resolution}"
|
|
|
|
- singularity:
|
|
|
|
- HICSNAKE_HOME + "/sifs/hicexplorer_20240327.sif"
|
|
|
|
- threads: 6
|
|
|
|
- shell:
|
|
|
|
- """
|
|
|
|
- hicCompareMatrices --matrices {input.treatment_mcool}::resolutions/{params.resolution} {input.control_mcool}::resolutions/{params.resolution} --operation log2ratio -o {output.cool}
|
|
|
|
- """
|
|
|