Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
guandailu authored Oct 13, 2022
1 parent 99ef0c8 commit b263cf4
Show file tree
Hide file tree
Showing 19 changed files with 211 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Rules/bwa.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
rule bwa_mem:
input:
fq1 = "02_trimmed/{sample}_val_1.fq.gz",
fq2 = "02_trimmed/{sample}_val_2.fq.gz",
ref_fa=REF_FASTA,
IDX=REF_FASTA+'.bwt'
output:
aligned = "tmp/{sample}.aligned.bam"
threads: 12
conda:
"../Envs/bwa.yaml"
shell:
"bwa mem -5SP -T0 -t {threads} {input.ref_fa} {input.fq1} {input.fq2} | samtools view -bS - > {output.aligned}"
8 changes: 8 additions & 0 deletions Rules/call_loop.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rule call_loop:
input:
hic = "06_contact_map/{sample}.contact_map.hic"
output:
loop = "10_called_loop/{sample}.loop.txt"
threads: 16
shell:
"/home/dguan/.local/bin/mustache -p {threads} -norm KR -f {input.hic} -r 5000 -pt 0.05 -o {output.loop}"
12 changes: 12 additions & 0 deletions Rules/call_tad.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
rule call_tad:
input:
hic = "06_contact_map/{sample}.hic"
output:
tad = "09_called_TAD/{sample}.{res}/{res}_blocks.bedpe" # directory("09_called_TAD/{sample}.{res}")
threads: 16
params:
jucier=JUCIER,
res="{res}",
out_dir="09_called_TAD/{sample}.{res}"
shell:
"java -Xmx24G -Djava.awt.headless=true -jar {params.jucier} arrowhead --threads {threads} -k VC -r {params.res} {input.hic} {params.out_dir}"
9 changes: 9 additions & 0 deletions Rules/compart_plot.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rule compart_plot:
input:
ab = "08_AB_compart/{sample}.ab",
bed = "08_AB_compart/{sample}.AB_compart.bed"
output:
plot="08_AB_compart/{sample}.ab.chr5.pdf"
threads: 1
shell:
"/home/dguan/.local/bin/fancplot -o {output.plot} 5 -p square {input.ab} -p line {input.bed}"
10 changes: 10 additions & 0 deletions Rules/compress_pairs.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rule compress_pairs:
input:
pairs = "04_pairs/{sample}.pairs",
output:
pairs_gz = "04_pairs/{sample}.pairs.gz",
threads: 16
conda:
"../Envs/bgzip.yaml"
shell:
"bgzip -f -l -c {input.pairs} > {output.pairs_gz}"
12 changes: 12 additions & 0 deletions Rules/cont_map.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
rule cont_map:
input:
pairs = "04_pairs/{sample}.pairs.gz",
chrom_size = CHROM
output:
cont_map = "06_contact_map/{sample}.hic"
threads: 30
params:
jucier=JUCIER
shell:
"java -Xmx240G -Djava.awt.headless=true -jar {params.jucier} pre -q 30 --threads {threads} {input.pairs} {output.cont_map} {input.chrom_size}"

12 changes: 12 additions & 0 deletions Rules/cooler_matrix.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
rule cooler_matrix:
input:
pairs = "04_pairs/{sample}.pairs.gz",
ref_fa = CHROM
output:
matrix = "07_cooler_map/{sample}.matrix.cool"
threads: 16
conda:
"../Envs/cooler.yaml"
shell:
"cooler cload pairix -p {threads} {input.ref_fa}:5000 {input.pairs} {output.matrix}"

12 changes: 12 additions & 0 deletions Rules/dedup_sam.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
rule dedup_sam:
input:
sorted = "tmp/{sample}.parsed.sorted.pairsam.gz"
output:
dedup = "03_dedup/{sample}.dedup.pairsam.gz",
stats = "03_dedup/{sample}.dedup.stats"
threads: 8
conda:
"../Envs/pairtools.yaml"
shell:
"pairtools dedup --nproc-in {threads} --nproc-out {threads} --mark-dups --output-stats {output.stats} --output {output.dedup} {input.sorted}"

10 changes: 10 additions & 0 deletions Rules/genome_idx.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rule genome_idx:
input:
fa = REF_FASTA
output:
bwa_idx = genome_idx
threads: 12
conda:
"../Envs/bwa.yaml"
shell:
"bwa index {input.fa}; samtools faidx {input.fa}"
10 changes: 10 additions & 0 deletions Rules/get_qc.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rule get_qc:
input:
"03_dedup/{sample}.dedup.stats"
output:
"03_dedup/{sample}.stats.sum.txt"
threads: 1
conda:
"../Envs/getqc.yaml"
shell:
"python3 /home/dguan/bin/MicroC/get_qc.py -p {input} > {output}"
10 changes: 10 additions & 0 deletions Rules/idx_pairix.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rule idx_pairix:
input:
pairs = "04_pairs/{sample}.pairs.gz",
output:
idx = "04_pairs/{sample}.pairs.gz.px2"
threads: 1
conda:
"../Envs/pairix.yaml"
shell:
"pairix {input}"
10 changes: 10 additions & 0 deletions Rules/lib_compx.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rule lib_compx:
input:
"05_mapped/{sample}.sorted.bam"
output:
"05_mapped/{sample}.lc_extrap.txt"
threads: 1
conda:
"../Envs/preseq.yaml"
shell:
"preseq lc_extrap -bam -pe -extrap 2.1e9 -step 1e8 -seg_len 1000000000 -output {output} {input}"
10 changes: 10 additions & 0 deletions Rules/merge_libs.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rule merge_libs:
input:
make_libs
output:
temp("tmp/{sample}.dedup.pairsam.gz")
threads: 8
conda:
"../Envs/pairtools.yaml"
shell:
"pairtools merge -o {output} --memory 64G --nproc-in {threads} --nproc-out {threads} {input}"
10 changes: 10 additions & 0 deletions Rules/mul_res_matrix.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rule mul_res_matrix:
input:
matrix = "07_cooler_map/{sample}.matrix.cool"
output:
mres = "07_cooler_map/{sample}.matrix.mcool"
threads: 16
conda:
"../Envs/cooler.yaml"
shell:
"cooler zoomify --balance -p {threads} {input}"
11 changes: 11 additions & 0 deletions Rules/parse_bam.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
rule parse_bam:
input:
aligned = "tmp/{sample}.aligned.bam",
chrom_size=CHROM
output:
parsed = "tmp/{sample}.parsed.pairsam.gz"
threads: 8
conda:
"../Envs/pairtools.yaml"
shell:
"pairtools parse --min-mapq 40 --walks-policy 5unique --max-inter-align-gap 30 --nproc-in {threads} --nproc-out {threads} --chroms-path {input.chrom_size} {input.aligned} -o {output.parsed}"
10 changes: 10 additions & 0 deletions Rules/sort_bam.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rule sort_bam:
input:
split = "tmp/{sample}.unsorted.bam"
output:
sorted = "05_mapped/{sample}.sorted.bam"
threads: 8
conda:
"../Envs/samtools.yaml"
shell:
"samtools sort -@ {threads} -o {output.sorted} {input.split}; samtools index {output.sorted}"
13 changes: 13 additions & 0 deletions Rules/sort_parse.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
rule sort_parse:
input:
parsed = "tmp/{sample}.parsed.pairsam.gz",
ref_fa=REF_FASTA
output:
sorted = "tmp/{sample}.parsed.sorted.pairsam.gz"
threads: 16
params:
tmp=TEMP
conda:
"../Envs/pairtools.yaml"
shell:
"pairtools sort --nproc {threads} --tmpdir={params.tmp} {input.parsed} -o {output.sorted}"
12 changes: 12 additions & 0 deletions Rules/split_sam.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
rule split_sam:
input:
dedup =rules.merge_libs.output
output:
unsorted = temp("tmp/{sample}.unsorted.bam"),
pairs = "04_pairs/{sample}.pairs"
threads: 8
conda:
"../Envs/pairtools.yaml"
shell:
"pairtools split --nproc-in {threads} --nproc-out {threads} --output-pairs {output.pairs} --output-sam {output.unsorted} {input.dedup}"

17 changes: 17 additions & 0 deletions Rules/trim_reads.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
rule trim_reads:
input:
R1 = "01_raw_fq/{sample}_R1.fq.gz",
R2 = "01_raw_fq/{sample}_R2.fq.gz"
output:
R1 = "02_trimmed/{sample}_val_1.fq.gz",
R2 = "02_trimmed/{sample}_val_2.fq.gz",
RP1 = "02_trimmed/{sample}_R1.fq.gz_trimming_report.txt",
RP2 = "02_trimmed/{sample}_R2.fq.gz_trimming_report.txt"
threads: 16
params:
base = "{sample}",
outdir = "02_trimmed"
conda:
"../Envs/trimgalore.yaml"
shell:
"trim_galore --paired --cores {threads} --basename {params.base} -o {params.outdir} --gzip {input.R1} {input.R2}"

0 comments on commit b263cf4

Please sign in to comment.