Commit 3e5b4e82 authored by MARIJON Pierre's avatar MARIJON Pierre

Add option self-lookup to run allow knot to search path between same extremity of same contig

parent e4459083
self_lookup = " --self-lookup" if config["self_lookup"] == True else ""
rule build_AGG:
input:
search = "{prefix}_knot/ext_search.csv",
......@@ -10,7 +12,7 @@ rule build_AGG:
"{prefix}_AAG.csv"
shell:
"knot.path_search {input.search} {output} {input.ovl_graph} {input.read2asm} {input.asm_graph} {input.tig2tig} --search-mode " + config["search_mode"]
"knot.path_search {input.search} {output} {input.ovl_graph} {input.read2asm} {input.asm_graph} {input.tig2tig} --search-mode " + config["search_mode"] + self_lookup
rule filter_contigs:
input:
......
......@@ -41,11 +41,15 @@ def main(args = None):
help="contig with size lower this parameter are ignored")
parser.add_argument("--read-type", choices=["pb", "ont"], default="pb",
help="type of input read, default pb")
parser.add_argument("--self-lookup", action="store_true", default=False,
help="if it set knot search path between extremity of same contig")
parser.add_argument("--help-all", action='store_true',
help="show knot help and snakemake help")
args, unknow_arg = parser.parse_known_args(args)
args = vars(args)
print(args)
# Check parameter
## raw_reads or correct
if args["help_all"]:
......@@ -68,6 +72,7 @@ def main(args = None):
"read_type="+args["read_type"],
"min_contig_length="+str(args["contig_min_length"]),
"search_mode="+args["search_mode"],
"self_lookup="+str(args["self_lookup"]),
"package_path="+package_path
]
......
......@@ -39,7 +39,9 @@ def main(args=None):
parser.add_argument("tig2tig", type=argparse.FileType('r'))
parser.add_argument("--search-mode", choices=["base", "node"], default="base",
help="what path search optimize, number of base or number of node")
parser.add_argument("--self-lookup", action='store_true',
help="if it set knot search path between extremity of same contig")
args = vars(parser.parse_args(args))
# gfa to sg
......@@ -62,10 +64,10 @@ def main(args=None):
no_search = path_search.get_ext_ovl(args["asm_graph"], args["tig2tig"])
for ext1, ext2 in itertools.permutations(tig_ext, 2):
if ext1[0][:-6] == ext2[0][:-4] or ext1[0][:-4] == ext2[0][:-6]:
if not args["self_lookup"] and (ext1[0][:-6] == ext2[0][:-4] or ext1[0][:-4] == ext2[0][:-6]):
continue # don't search path between same contig ext
node1 = path_search.choose_read_ori(ext1[1], ext1[2], ext1[0].split("_")[-1], True)
node2 = path_search.choose_read_ori(ext2[1], ext2[2], ext2[0].split("_")[-1], False)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment