-
Notifications
You must be signed in to change notification settings - Fork 18
/
Tombo
58 lines (53 loc) · 2.24 KB
/
Tombo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
rule detect_modification:
input:
fast5="data/{sample}",
ref="data/ecoli_k12_mg1655.fasta"
output:
"{sample}.CpG.tombo.stats",
"{sample}.CpG.tombo.per_read_stats"
shell:
"tombo resquiggle --dna {input.fast5} {input.ref} --processes 10 --overwrite && tombo detect_modifications alternative_model --dna --fast5-basedirs {input.fast5} --statistics-file-basename {wildcards.sample} --per-read-statistics-basename {wildcards.sample} --alternate-bases CpG --processes 8"
rule output_browser_files:
input:
fast5="data/{sample}",
stats="{sample}.CpG.tombo.stats"
output:
"{sample}.valid_coverage.minus.wig",
"{sample}.valid_coverage.plus.wig",
"{sample}.fraction_modified_reads.minus.wig",
"{sample}.fraction_modified_reads.plus.wig"
shell:
"tombo text_output browser_files --fast5-basedirs {input.fast5} --statistics-filename {input.stats} --file-types valid_coverage fraction --browser-file-basename {wildcards.sample}"
rule wig_to_tsv_for_mod:
input:
plus="{sample}.fraction_modified_reads.plus.wig",
minus="{sample}.fraction_modified_reads.minus.wig"
output:
"tombo_results/{sample}_tombo-freq-only.tsv"
script:
"script_in_snakemake/wig2bed.py"
rule wig_to_tsv_for_cov:
input:
plus="{sample}.valid_coverage.plus.wig",
minus="{sample}.valid_coverage.minus.wig"
output:
"tombo_results/{sample}_tombo-cov-only.tsv"
script:
"script_in_snakemake/wig2bed.py"
rule combine_freq_and_cov:
input:
script="script_in_snakemake/run_tombo.R",
freq="tombo_results/{sample}_tombo-freq-only.tsv",
cov="tombo_results/{sample}_tombo-cov-only.tsv"
output:
file1="tombo_results/{sample}_tombo-freq-perCG.tsv",
file2="tombo_results/{sample}_tombo-freq-perCG-combStrand.tsv"
shell:
"Rscript {input.script} {input.freq} {input.cov} {output.file1} {output.file2}"
rule extract_per_read_results:
input:
"{sample}.CpG.tombo.per_read_stats"
output:
"tombo_results/{sample}_tombo-perRead-score.tsv"
script:
"script_in_snakemake/extract_tombo_per_read_results.py"