@@ -12,11 +12,15 @@ for x in check_these:
12
12
if x not in config:
13
13
raise IOError("The option '{}' must be in the config".format(x))
14
14
15
+ if "hifiasm_options" not in config:
16
+ config["hifiasm_options"] = ""
17
+
15
18
rule all:
16
19
# genome assem
17
20
input:
18
- "step1_hifiasm_hic/" + config["prefix"] + ".hic.hap1.p_ctg.gfa",
19
- "step1_hifiasm_hic/" + config["prefix"] + ".hic.hap2.p_ctg.gfa"
21
+ expand("step1_hifiasm_hic/" + config["prefix"] + ".hic.hap{hap}.p_ctg.fasta",
22
+ hap = ["1", "2"])
23
+
20
24
21
25
rule assemble:
22
26
input:
@@ -31,6 +35,7 @@ rule assemble:
31
35
hic_R1_string = ",".join([config["HiC"][lib]["R1"] for lib in config["HiC"]]),
32
36
hic_R2_string = ",".join([config["HiC"][lib]["R2"] for lib in config["HiC"]]),
33
37
LR_string = " ".join(config["LR"]),
38
+ hifiasm_opts = config["hifiasm_options"],
34
39
prefix = config["prefix"]
35
40
shell:
36
41
"""
@@ -41,6 +46,20 @@ rule assemble:
41
46
--h1 {params.hic_R1_string} \
42
47
--h2 {params.hic_R2_string} \
43
48
--n-weight 5 \
44
- {params.LR_string}
49
+ {params.hifiasm_opts} \
50
+ {params.LR_string}
45
51
cd ..
46
52
"""
53
+
54
+ rule gfa_to_fasta:
55
+ input:
56
+ gfa = "step1_hifiasm_hic/" + config["prefix"] + ".hic.hap{hap}.p_ctg.gfa",
57
+ output:
58
+ gfa = "step1_hifiasm_hic/" + config["prefix"] + ".hic.hap{hap}.p_ctg.fasta",
59
+ threads: 1
60
+ shell:
61
+ """
62
+ cat {input.gfa} | \
63
+ awk '{{if ($1 == "S"){{printf(">%s\\n%s\\n", $2, $3)}} }}' | \
64
+ fold -60 > {output.gfa}
65
+ """
0 commit comments